So in this lecture, we are going to look at how to apply the code, we just learned to the champagne
sales time series.
Now, one thing I want you to notice about this lecture is that it does not require any new code.
Only the data set has changed.
In fact, you should already have this data set from the previous exercises.
So if you'd like to stop this video and try to do this yourself, please take this opportunity to do
so now.
Otherwise, we'll continue.
Also note that I'm not exaggerating when I say that this did not require any new code.
I simply took the previous script, changed the yooralla of the data set and changed the column names
using fine and replace.
So if you've ever wondered what I mean by all data is the same.
This is a great example.
OK, so let's go through everything super quick.
We've got our imports.
Then we download the data.
Then we load in the data.
Then we take the log transform note that although the ADF test says the different data is stationary,
while the nine different data is non stationary, I did not bother to do any different thing.
So as an exercise, you may want to try that variation.
OK, so then we split the data into training test.
Then we create our data set for a supervised learning.
Then we do another train, says Blair.
Then we fit a linear regression.
OK, so our model seems to have a decent score.
As before we create our data frame indices and then we plot the one step forecast.
OK, so that looks pretty good, but remember, this is only the one step forecast.
The next step is to create our multi-step forecast.
OK, so as you can see, the salsa performed pretty well, in fact, maybe even a bit better than the
one step forecast.
OK, so the next step is to try the multi output forecast, remember that this is still the linear model.
Again, this requires us to create a new data set with multiple targets per row.
Again, we're going to split the data into train and test.
And again, we're going to fit a linear model.
So the score appears to be pretty good.
The next step is to plot our multi output forecast.
Again, it looks pretty accurate.
The next step is to check the map.
So interestingly, the map for the incremental forecast is a bit better than the multi output forecast.
OK, so the next step is to test other models, so we're going to create a helper function to do all
the above work.
So let's check the results for the support vector machine.
OK, so the support vector machine does pretty well.
The next step is to check the random forest.
Again, it does pretty well.
The next step is to create a helper function for the multi output forecast.
So this time we're just going to skip the support vector machine, if you want to implement the multi
output SVR wrapper, please feel free to try that.
OK, so when we check the result for the random forest, we see that it does OK.
So what is interesting about this script is that it seems linear regression with an incremental multistep
forecast was the best.
OK, so as an exercise, there are definitely some things you might want to experiment with that will
not require you to write any new code that you haven't seen before.
For example, comparing these results with previous models and seeing whether or not differences will
help.
So please try any variations you've thought of and share the results in the Q&A.