From the course: Applied AI for IT Operations (AIOps)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Building an LSTM model with Keras

Building an LSTM model with Keras - Python Tutorial

From the course: Applied AI for IT Operations (AIOps)

Start my 1-month free trial

Building an LSTM model with Keras

- Now, we will build an LSTM models with Keras to predict a time series. As discussed in the earlier video, to predict each data point, we need to provide a lookback of data points. For this, we need to create a data set that associates each data point with the previous 168 data points, which is a week's worth of lookback. We do so using the Create RNN Dataset function. This function takes as input, a data set and a lookback period. It then creates the feature Vector X, and the prediction Y. X contains the previous 168 data points for the corresponding Y. This means that if we pass four weeks of data, we will only get three weeks of X and Y, since the first week will be lost in the lookback. We iterate over the data set, we create X using the last 168 lookback points and Y being the current point. We return the final array then. We use this method to create X and Y arrays for the training data set. Then we reshape X as a three dimensional array for use with LSTM. Finally, we print…

Contents