O'Reilly logo

Practical Time Series Analysis by Dr. PKS Prakash, Dr. Avishek Pal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recurrent neural networks for time series forecasting

We will continue to use the dataset on air pollution to demonstrate recurrent neural networks for time series forecasting. LSTM is used to forecast air pressure and GRU is demonstrated on pm2.5.

Reading and preprocessing the data remains the same as we have done for the examples on MLPs. The original dataset is split into two sets-train and validation, which are used for model training and validation respectively.

The makeXy function is used to generate arrays of regressors and targets-X_train, X_val, y_train and y_val. X_train, and X_val, as generated by the makeXy function, are 2D arrays of shape (number of samples, number of timesteps). However, the input to RNN layers must be of shape ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required