1
00:00:00,000 --> 00:00:01,815
In the previous video,

2
00:00:01,815 --> 00:00:04,510
you saw how you could stack
a convolutional layer with

3
00:00:04,510 --> 00:00:08,865
LSTMs and bidirectional LSTMs
to do sequence prediction.

4
00:00:08,865 --> 00:00:11,910
In this video, we'll go
through a workbook for this,

5
00:00:11,910 --> 00:00:14,590
which you can then try
for yourself later.

6
00:00:14,930 --> 00:00:19,005
As always, let's check if we
have tensorflow installed.

7
00:00:19,005 --> 00:00:21,270
If it isn't, install
the latest either

8
00:00:21,270 --> 00:00:24,880
nightly or the latest
release from tensorflow.org.

9
00:00:26,030 --> 00:00:28,590
Once you know you
have version two,

10
00:00:28,590 --> 00:00:30,020
then this code will generate

11
00:00:30,020 --> 00:00:32,420
the synthetic time
series for you,

12
00:00:32,420 --> 00:00:34,880
and this code will
turn the array of

13
00:00:34,880 --> 00:00:37,040
data into a dataset for training.

14
00:00:37,040 --> 00:00:38,450
Note that we've expanded

15
00:00:38,450 --> 00:00:40,950
the dimensions on the first line.

16
00:00:41,740 --> 00:00:44,300
This helper function can perform

17
00:00:44,300 --> 00:00:46,895
the forecasting for
us after training.

18
00:00:46,895 --> 00:00:48,530
This first copy of

19
00:00:48,530 --> 00:00:50,810
the neural network has
run for a quick 100

20
00:00:50,810 --> 00:00:52,160
Epoch run to try and pick

21
00:00:52,160 --> 00:00:54,905
the optimum learning rate
for the optimizer.

22
00:00:54,905 --> 00:00:57,950
When it's done, we'll plot
the results and we'll

23
00:00:57,950 --> 00:01:00,625
see the 10 to the minus
5 is the optimum value,

24
00:01:00,625 --> 00:01:04,220
so we'll set that on the SGD
for the next training run.

25
00:01:04,220 --> 00:01:07,520
We'll train for
500 Epochs now and

26
00:01:07,520 --> 00:01:10,675
keep an eye on
our loss and our mae.

27
00:01:10,675 --> 00:01:12,590
When it's done, we'll run

28
00:01:12,590 --> 00:01:14,420
our forecast and
plot the results.

29
00:01:14,420 --> 00:01:17,180
Already the curve is
looking much better and

30
00:01:17,180 --> 00:01:18,380
the plateau that we'd seen in

31
00:01:18,380 --> 00:01:20,690
previous training has vanished,

32
00:01:20,690 --> 00:01:23,060
and our mae is low,

33
00:01:23,060 --> 00:01:25,975
it's just above five
at the validation set.

34
00:01:25,975 --> 00:01:29,400
Finally, if we plot
our training loss and mae,

35
00:01:29,400 --> 00:01:33,310
we also see a healthy
curve downwards.