In this video, we will learn how to create or toad aggression more than in Python.
In the last lecture, we have created my forecast model.
We'll also compare the performance of forward auto regression modern with the night forecast model.
So let's import the same dataset that is daily minimum temperature data say we are storing this data,
certain raw data from Quadri beef.
Now let's debate our data stream and to test and train.
We will be selecting last seven venues as our test venues and the remaining values as the screen value.
So let's run this also.
Let's look at the first five venues.
Overtrained did say.
No.
Or do regression model is available in a sex model library.
So we will import air from a sex model, not TSA, not air underscored modern.
And first, we are creating what here object and then we are fighting it, using don't fit my.
So our object name is model and we are calling here.
And then as an argument, we are pointing out trying to say that this screen.
Then we had fitting this model using don't fit my coat.
No.
You know, that on television means regression on the leg values.
So now let's see how many leg values are coming out to be important in our model
to see that we can just use North Gay underscored air, a tribute of for fitted model object.
So will rate model underscore fit.
This is our object.
And then we can right.
Don't get underscored here.
This day tribute of this object, if you run this, you can see that we are getting.
Output is 29.
This means that we are considering 29 lag variables for what model?
Now, let's see the coefficient of this 29 variables.
We can access the coefficient from not badam attribute.
So if we just state model lenders fit thought pattern and execute it, we'll get the coefficient of
all this twenty nine leg variables coefficient.
So first we have the Constanten.
Then we have the coefficient of legman, values like to allu and so on.
Builder Twenty 29 leg value.
The third leg very well sort not important in our model.
And only this 29 like variables are important for this model.
So now if you have values of last 29 timeframe, you can predict the future value using this coefficients
and the consent to that we are getting in this result.
The other way to predict future values is to radically use dort predict function.
So we can model, underscore fact, not predict.
And here we have to give the start and the end of the period for which we won the predictions.
So here we have one prediction on our test set.
So what a start is the length of green.
So suppose we are hundred records in the train and 20 records in test.
And in that case, if we won the prediction on test data, we won prediction from index number hundred.
Two hundred and twenty.
So this the same case, Len, of Cream will give us the land of the green dataset.
So if we have a hundred variables in our train dataset.
Land of Green will give us hundred as an output.
So what?
Assad will automatically become Andre.
And for the end, we have to write the end point of the prediction.
So again, we have hundred records and train 20 records in test.
So we want prediction from hundred to 120.
So that's why we are writing.
Length of green.
So this will give us suppose Henry Lantau test.
This will give us friendly and minus one because these are index.
So we want all the values from a hundred to 110 19th index.
So there are in total 20 values.
A hundred was just an example.
Here we are selecting Lentil Crane and then.
And this also determined by the length of print.
And test.
So if we just stand this, we are restoring this data.
And to add another variable called prediction, we just look at the values that are present in this
prediction.
So you can see what testator was of seven records.
That's why we are getting seven values here.
And this Saturday in Texas.
So this must be the length of work and they decide three, six, four, three.
So these are the prayer to tell of our lives.
If we just want to look at the first value, that is the first forecasted value we can use.
I lost.
You can see to get the venue in your suits prediction, but I.
And the Xeloda index.
So usually for the first argument, we just straight square record zero.
But here, the indexes are not starting from zero.
Here the indexes are starting from three six four three two three six four nine.
That's why we have to use a lock instead of just let it clear, I think predictions and then square
reconcile.
So since indexes are not starting from zero, we have to write like this to grab the first value for
the second one.
When do we have to write?
I know.
You can see we are getting the second.
Now let's calculate the masc value for our private data.
Again, we will use meaning squared error function from Eskil and not Matrix.
And here we have to throw it to a loose.
Our actual values of.
And then the predicted values of way.
So what actual values that is stored in Ascender Square.
And the predicted values are restored in predictions.
So just.
Slurping And I see here you can see that the MASC for this model is one point five if you compare with
a knife.
More than.
Hear them and message when he was three point four.
So our error is decreasing from three point four to one point five.
By using a more than.
So you can say that the twin cities that we are using is not a random walk.
There is some information stored in that time cities and we are restricting that information, using
your model and reducing the MSE from three point four to one point five.
Now, again, we can also applaud the predicted values and actual values on the plot.
We'll be just using by plot or plot.
First, we are plotting to why and then we are plotting predictions with a lot of people to we run this
this new are the actual values.
And the red line is the predicted values for this seven days.
So that's all for this video.
This is how we create our model in Python.
We use, said Smardon Liberty to basically create a model.
And in the next lecture, we will discuss how to use walk forward validation for each other.
That's all for this lecture.
Thank you.