In the previous video,
you saw how you could stack a convolutional layer with
LSTMs and bidirectional LSTMs to do sequence prediction.
In this video, we'll go through a workbook for this,
which you can then try for yourself later.
As always, let's check if we have tensorflow installed.
If it isn't, install the latest either
nightly or the latest release from tensorflow.org.
Once you know you have version two,
then this code will generate
the synthetic time series for you,
and this code will turn the array of
data into a dataset for training.
Note that we've expanded
the dimensions on the first line.
This helper function can perform
the forecasting for us after training.
This first copy of
the neural network has run for a quick 100
Epoch run to try and pick
the optimum learning rate for the optimizer.
When it's done, we'll plot the results and we'll
see the 10 to the minus 5 is the optimum value,
so we'll set that on the SGD for the next training run.
We'll train for 500 Epochs now and
keep an eye on our loss and our mae.
When it's done, we'll run
our forecast and plot the results.
Already the curve is looking much better and
the plateau that we'd seen in
previous training has vanished,
and our mae is low,
it's just above five at the validation set.
Finally, if we plot our training loss and mae,
we also see a healthy curve downwards.