1
00:00:01,030 --> 00:00:04,020
In the previous lesson,
you looked at using a real world data set,

2
00:00:04,020 --> 00:00:08,160
one with readings of sunspot activity
over a couple of hundred years.

3
00:00:08,160 --> 00:00:12,820
And you saw how to build a simple DNN to
predict activity using that data set.

4
00:00:12,820 --> 00:00:16,080
Now let's take a look at the notebook and
we'll see it in action for ourselves.

5
00:00:17,290 --> 00:00:19,850
As always, let's check if we
have TensorFlow 2 installed.

6
00:00:20,850 --> 00:00:23,360
And we do so we can just progress.

7
00:00:23,360 --> 00:00:27,500
This code just imports numpy and
pyplot and creates a helper function for

8
00:00:27,500 --> 00:00:29,100
plotting charts.

9
00:00:29,100 --> 00:00:32,290
This code downloads the data set and
puts it into the temp directory.

10
00:00:32,290 --> 00:00:35,120
It's a very small data set so
it should run very quickly.

11
00:00:36,270 --> 00:00:40,480
We'll now import the data from the CSV and
create numpy arrays from it.

12
00:00:40,480 --> 00:00:42,670
We can plot the data to
see it seasonality and

13
00:00:42,670 --> 00:00:44,690
its noise but there's no noticeable trend.

14
00:00:46,245 --> 00:00:49,110
We'll now split the data and
setup our constants.

15
00:00:49,110 --> 00:00:52,750
Most notably the window
size which I've set to 60.

16
00:00:52,750 --> 00:00:57,495
This code is a helper function for
turning the data into a Window data set.

17
00:00:59,100 --> 00:01:02,960
And now we'll train with a three layer
DNN having 2010, and one neurons.

18
00:01:04,000 --> 00:01:07,030
We'll use stochastic gradient
descent as our optimizer

19
00:01:07,030 --> 00:01:09,993
with a learning rate of 1e-7.

20
00:01:09,993 --> 00:01:13,780
When the training is done, we can get
forecasts across the validation set.

21
00:01:13,780 --> 00:01:15,350
And our plot looks pretty good.

22
00:01:16,460 --> 00:01:18,704
If we mentioned MAE, we're at about 15.

23
00:01:20,450 --> 00:01:23,450
You should get slightly different
values due to the randomness

24
00:01:23,450 --> 00:01:27,510
of the model initialization and
stochastic gradient descent.

25
00:01:27,510 --> 00:01:29,540
So don't worry if it's a little off.

26
00:01:29,540 --> 00:01:31,370
If it is way off, then go back and

27
00:01:31,370 --> 00:01:33,680
check your code or
restart the runtime and try again.