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

1D convolution for time series forecasting

We will continue to use the air pollution dataset to demonstrate 1D convolution for time series forecasting. The shape of input to the convolution layer is (number of samples, number of timesteps, number of features per timestep). In this case, number of timesteps is seven and number of feature per timestep is one as we are concerned about only air pressure, which is univariate. To develop a convolutional neural network, we need to import three new classes:

from keras.layers.convolutional import ZeroPadding1D 
from keras.layers.convolutional import Conv1D 
from keras.layers.pooling import AveragePooling1D 

A ZeroPadding1D layer is added after the input layer to add zeros at the beginning and end of ...

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