In this video, we will learn how to implement walk forward validation for a demo model.
So let's first aim for it.
We are going to use the same dataset.
That is simple dots.
Yes.
Let's look at the data
here.
You can see that we have the month value and the sales value.
So this month, values are four 19 zero one.
So if you see one nine zero is missing from this data and that twice, pandas will not be able to identify
that.
This is the date for me.
So for this example, you can also use the time it.
So first you have to define a password using this segment.
In this case.
And then you can also give this password as an argument while you are loading CSP in that way.
You will have a date.
Time for my trade data in your first column instead of this month value.
But for now, be our only focus on the sales value.
And we are running our model only on the sales value.
That's why we are not going to change our.
So let the wait over there trying to test and train.
So we will take 70 percent of our data and do training and remaining 30 percent of the time to test.
So first, I'm defining or train size and then I'm dividing my dataset.
That is the year to test and train.
Let's look at the shape of data so you can see that we have a long 25 records and green and their own
290 records and our best for this.
So, yeah.
Bill, I don't believe in the courts and test and 25, the courts and train.
So we have 36 records.
No implementing walk forward for a remise almost similar to the more forward validation we implemented
for year, more than we are willing to use the same, except first we are defining data.
Then we will run the loop for all the values in test.
We will create a model for each.
Then in this fall loop will save the first value all forward via data into a list called Predict.
And at the end of each one, we will include the test value and to dream data that we are going to use
to dream of what model in the next one.
So first we are initializing our data.
We will?
S train variable and we are also initializing or predict list.
Then 40 in test.
So this for loop will go on for eleven values of test.
First we are defining or more than that is Atima.
We are training this model on data and we are using BBC.
You and you find common one, common Xeloda respectively.
Then in the next step we are fitting or model.
Then we are forecasting the next value using weight.
We do model under Scott Fed dort forecast.
And since Y is a combination of three arrays, we are just extracting the value of forecasts from this
way.
I concede almost zero.
We are upending this VI forecast.
And to predict function and then we are also spending our data in the next cycle.
New data will going to bring my model.
And it will predict the next value of fly.
So let's run this.
You can see that we have eleven values, so this is the prediction four times better P plus one is the
prediction for time 30 plus two is the prediction for time.
Predict a plus three using or third model is the prediction for time period D plus for using our fourth
model and so on.
So we have implemented walk forward evaluation on our data using my model.
Now let's look at this list as well.
This will contain the same data.
Now to look at the MSCI value we will import.
I mean, squared error from Eskinder.
And then we will give the actual values or test that is test taught values and the predicted values
that we have in our product list.
So if you run this, this is the MASC value.
You can compare this MASC value with other models as well.
And so we implement Wolke forward validation on a premium order.
That's all for this lecture.
Thank you.