In the previous lesson, you looked at using a real world data set,
one with readings of sunspot activity over a couple of hundred years.
And you saw how to build a simple DNN to predict activity using that data set.
Now let's take a look at the notebook and we'll see it in action for ourselves.
As always, let's check if we have TensorFlow 2 installed.
And we do so we can just progress.
This code just imports numpy and pyplot and creates a helper function for
plotting charts.
This code downloads the data set and puts it into the temp directory.
It's a very small data set so it should run very quickly.
We'll now import the data from the CSV and create numpy arrays from it.
We can plot the data to see it seasonality and
its noise but there's no noticeable trend.
We'll now split the data and setup our constants.
Most notably the window size which I've set to 60.
This code is a helper function for turning the data into a Window data set.
And now we'll train with a three layer DNN having 2010, and one neurons.
We'll use stochastic gradient descent as our optimizer
with a learning rate of 1e-7.
When the training is done, we can get forecasts across the validation set.
And our plot looks pretty good.
If we mentioned MAE, we're at about 15.
You should get slightly different values due to the randomness
of the model initialization and stochastic gradient descent.
So don't worry if it's a little off.
If it is way off, then go back and
check your code or restart the runtime and try again.