In this video, we will be looking at how to implement CNN's intenser flow for airline passengers,
this script will follow the same pattern as the previous scripts with three steps.
We'll start with the ones that forecast, followed by an incremental, multi-step forecast.
The third option will try is the multi output multi-step forecast.
Please note that at this point you have the data and you know exactly the syntax will be using.
So if you'd like to treat this as an exercise using what you've learned, please stop this video and
try this yourself.
Otherwise, let's continue now, because most of this script is the same as before.
We will only look at the relevant parts.
So let's start with the imports.
You can see that there are a few new layers here, such as and Max pulling one D and global max pooling
one to the next step is to perform the rest of our imports and load in our data, which you've already
seen.
Note that again, we're using the different time series as before, if you believe that this should
work without defensing, you are welcome to try.
Also note that because the input data must have the shape and by TBD, we now add an extra superfluous
dimension at the end of X.
Previously it was end by T, now it's NBT by one.
The next step is to build our CNN noticed that the shape of our input has changed since our Time series
has one dimension.
Its correct shape is T by one.
The next step is to declare a kind one, delayer this as sixteen feature maps with a kernel size of
three as per the usual pattern.
We follow this with Max pulling.
The next step is to add another kind of wendie layer.
This has 32 feature maps with the kernel size of three.
Since this is our last convolution layer, we follow it with global max pooling.
Alternatively, you could use global average pooling or a simple flat in.
The next step is to add our final dense there with one output since we are doing one step predictions.
The next step is to call a very useful function called summary.
So what this does is it lifts each layer of your model and tells you the output shape of the data at
each step, along with the number of parameters of the layer.
This will help you understand how your data is transformed as it goes through the neural network.
So you can see that the model starts out as a 10 by one, meaning a length 10 time series with one dimension.
After doing convolution, it has a length of eight and 16 feature maps.
Note that the time dimension is smaller because by default, Tenzer flow uses valid mode convolution
since our maximal has size to the data shrinks by half.
So it goes from eight to four.
After one more valid mode convolution, it becomes size too.
We also specified a thirty two feature maps.
At that point we use global max pooling and the time dimension disappears.
So we now have a feature vector of size 30 to this can be passed through regular dense layers.
And so after our final linear layer, our output has size one.
OK, so the next step is to compile and fit as usual.
The next step is to look at the laws per epoch.
OK, so the last report looks fine.
The next step is to plot our predictions.
OK, so these are the differenced, one step predictions.
The next step is to undo the different saying.
So this is the one step unreferenced forecast, this looks good, but we know what really matters is
the multi-step forecast.
So this is the multi-step forecast, it seems to look just as good as the ones that forecast.
The next step will be to compute the multi output forecast.
So this is our CNN for the multi output forecast.
Notice that this has the same architecture as before, except with t y output's.
OK, so the next step is to call, compile and fit as usual.
The next step is to look at the laws epoch.
So the Lansberry Park looks fine.
The next step will be to plot a new model, predictions.
OK, so the multi output predictions look fine.
The next step will be to undo the different saying.
So these are the indifference, the multi outward predictions.
Note that it's difficult to tell which version is best.
The next step is to check the makeup.
So as you can see, the map looks pretty good in both cases, as always, you might want to try to undo
the logging and try different metrick so that you can compare this model with the other models we've
seen.
Please try that as an exercise and I'll see you in the next lecture.