In this lecture, we will learn how to create suspense, Martin, or my forecast model in Python.
In my forecast, we can simply assume that the last period value is the forecast for this period.
So let's create this modern on our daily minimum temperature data set.
So first, let's import that does it.
You're creating a data frame, B.F..
On let's look at the first five values of this stuff.
You can see that we have two columns.
First one is their data.
Second one is the temperature.
We have detailed data in the data column.
And we have to see these values in the same data.
Now, since we are creating my forecast model, that means that for this second and very well you our
forecast was previous day value.
So twenty point seven.
But the actual value is seventeen point nine.
Similarly, the forecast for Turn-off Jan is seventeen point nine.
And the actual value is eighteen point eight.
So to clear the forecast said value, we can simply create a lag value of this temperature data.
So let's just feared that we will use Dort shift manteau to do that.
And we are creating a new column that is B, we are naming that piece.
And this temperature value will actis the actual value at D plus one.
Let's spend this and let's again take a look at the herd values so you can see for a second no fap over
the forecasted values, twenty point seven and actually lose seventeen point nine four fifths of gen.
The forecasted value is fourteen point six.
And the actual value is fifteen point eight.
So you can say that this damn one is over via variable and the speed variable is what X variable and
the predicted value or the forecasted value is same as the X value.
So let's divide this data and do test centerin.
We are creating two different data frames.
First one is their train.
And second, when they start test, we are taking last seven values as their test data and the remaining
values as they were train data.
So here we are selecting from index one to be a dot Chaib zero minus seven.
So we are taking all the values out there.
Then this first value and the last seven values stream data and the last seven values as a test data.
We are ignoring the first value because we have an end in the first record.
So let's run this.
Let's look at the first five values of four dream dataset.
You can see we have ignored the first straw and we have the remaining in tell you.
Again, this is our way of a label and this is a works very well on that divide.
This green test and to crane necks.
Greenway and test X.
Test Y.
For trainings, we won this data.
So this is Colombe and for why we won this column that this column time.
Similarly, we will do the same thing for test data centers when.
So now we have divided our data into four parts.
Mix Greenway their specs.
That's way.
Now, usually we train a lot more than on this train data.
And we use test data, evaluate performance of that model.
Now, since we are building a night forecast model, there is no need to create another more than we
can just use X values as our forecasted value.
So let's create another data frame that is predictions.
And this will contain the country as X dataset.
So this fever news will become the production values for their test data.
So let's end this.
Now let's see the predicted values and the Y value or ordinarily.
So you can see first we have the bad values and here we have the actual Waverly's.
So you're also you can see that the actual value for index three six four three is the predicted value
for the record, three, six foot four.
So you can see that we have a naive forecast model for our data.
Now, let's look at data in our predictions.
We will use mean squared error, meaning squared error is just the sum of the squared of differences
between predicted value and Y value.
And we are going to use mean squared error from Escalon dot matrix.
And we are saving this data to a very well named MASC.
Let's run this.
Also, you can notice that we have deployed two series of data.
First is the actual values and then the credit card values.
So the MASC fought over this data set is three point four two.
And you can also plot their predictions and why on the graph.
So this blue line is the actual values.
And this red line is the predicted values.
We are just using by a plot or plot to plot this data.
Now, why this masc value for night forecast is important because we are going to evaluate what our
advance models using this MASC value.
So if what I advanced than is giving us a messy value of greater than this value, then we can say that
our model is not able to extract any information from that data.
And you can consider that Baym Sidis data as a random walk.
Since we are not able to extract any information better than the night forecast model.
So that is where night forecasts masc value is important because it will tell you whether your data
is a random walk or not.
If your advance models such as a model, a model or a rhema model is not able to improve on this MASC
value, then you can say that your time in cities is a random walk.
That's all for this lecture.
Thank you.