In the last video, we saw how to use
RNNs for prediction of sequences,
and we learned a little about how to
construct a neural network with them.
In this video, you'll work through
a notebook with all of the code,
and when you're done watching, you can
try out the notebook for yourself.
As usual, let's first ensure that we're running 2.0,
and then we'll run the code to set up
the data and create the dataset.
Then we'll run the neural network code but adjusting
the learning rate per epoch in
order to find the best one for the full training.
We'll plot the results to try to
find the optimal learning rate.
You can see here, it's between 10_minus 6 and 10_minus 5.
So I pick a value halfway say,
5 times 10_minus 5.
Here's the code to train the neural network.
I've set the optimal learning rates and
I've picked 400 epochs for which to train.
I'll now train the neural network for the 400 epochs.
Once it's trained, I can use it to
forecast for the validation range and plot the results.
On all my plot, I can see that my prediction
isn't too bad other than this plateau,
which is definitely going to impact my MA in a bad way.
But despite that my MA is only
about 6.41, so it's not too bad.
If I plot the MA and loss for training, I'll see this.
Showing that while it looks quite
flat after about epoch 50,
it was actually still reducing slowly,
and when we zoom in,
we can see that.
We saw instability after about epoch 400 earlier,
so I just stopped training at that point.