In this video, we will learn about this string split, four time series data, that trend is split
four times.
This data is very different from that strain.
Is it for any other machine learning algorithms such as linear regression, logistic regression decision,
trees, etc.?
The first differences for other machine learning algorithms.
We randomly choose a subsegment of our data as a set or validation set.
But we cannot randomly choose data from more time series because in case of TIME cities, their data
is organized in a particular order using dates or time values.
And we can not randomly choose a particular value from this time cities.
The second difference is that for other machine learning algorithms, we create three different sets
test cream and validation set.
We usually train our model on train set.
We tune out what hyper parameters using validation set.
And then and then we finally use the model to predict values on the test set.
But in times it is data.
We usually divide our data in just test and cream.
This is mainly because in most of the cases we have limited data and using validation, data and training,
the model makes more sense than using the validation data to validate the model.
So for time cities, we just divide our data into test and train.
And we do not randomly pick some values to create test set.
We generally store last few values of our time cities to act as a test site.
So if you have a month levalley data for some time cities, you may take last three or four months as
your test set.
Now, let's start creating test string data in Python.
We will be using the BAILLY minimum temperature dataset that we were using earlier.
So the data frame name is temp underscore B.F..
Oh, let's look at first five values.
You can see that we have two columns, date and time, 10 percent for templated, the date column contained
the date time values for our time cities.
You can see this, the daily data of Embitter.
So in the first row, we have Daito 1st of January in the second rowby of data of 2nd January.
We can also look at the last five mandu.
To get an idea of the lost value of these cities.
So these are the last five lives.
You can see we have data of 10 years from 1981 to 1990.
Now, let's look at how many values we have in our data frame.
So we are using dots, shape, attribute.
We have three thousand six hundred and fifty groups and just two columns now.
We are planning to use 80 percent of this data as our train site and the remaining 20 as a test site.
So what we are going to do out of this 10 years of data, we will use first 88 as our train site and
last two years as our test site.
So not just get the first value of this shape.
So this is the number of roads we have in our data.
Now, we will create another way, even that is train size, in which we will get how many records we
want in our train site.
So we have three thousand six hundred and fifty records and we want to take 80 percent of these records
and do our train set.
So we are using and then bam dot be a dot chip.
And we are getting the first element of our shape happen, which is three six five zero.
And we are multiplying this value with Boin Day.
And finally, we are converting this value in.
And so suppose after multiplication we get a value of suppose two thousand six hundred four point five.
We don't want that point five decimal value.
So we are converting this value into an integer value because sizes this should be an integer value.
Let's spend this Sauveur train sizes, two nine two zero records.
So we want two nine two zero records in our train set and remaining records intersect.
Not to create, Green said, we will split our time.
Yep.
Dappling, we will take first two nine two zero records as green and remaining records from two nine
two zero two three six five zero index as asked to do that.
We will use slicing of data frames so we will just see spam D.F..
Now we won all the records from first records.
So the index is CEDO for the first record we want, although we lose from zero to the screen size screen
sizes to nine two zero.
So we will have all the records.
We're indexes between zero two two nine two zero.
You can see these are the indexes just before the column names.
We are getting indexes.
When we look at our data frame.
So let's run this now for the test.
We will need all the records, we're indexes that are then to name to zero.
So here we are again, selecting over time B.F..
And we are selecting all the data.
We're the index is greater than two nine two zero.
So we had, I think, queen size here and then colon.
And cooler, and then we are not writing anything, leaving it blank mean till the end.
Similarly, we can also mention this last number here.
So Green underscore the size, then call than three six, four lane.
This will give the same.
So let's run this.
Let's debate what we have done.
We have selected all the data from Index zero to the screen size as green, and we have selected the
remaining data, which is from the screen size index to the last index as our work as well.
Now let's look at the shape of forward green and as dataset.
You can see we have two nine two zero records and train and we have remaining 730 records in test.
This is always split data and to test and train for time cities.
Now let's discuss another concept here that is walk forward validation.
So suppose this light gray is your training data.
What we usually do is we train them for more than, say, M1 on this training set, and then we will
use this model to predict the future values.
So we will use the same model to predict the value at time, even when doing time to do well over time.
Three and so on.
But since at time t two, we have all the information available for time, Devinn.
So if you want to predict the value at Time B3 and you have the additional values at time B1 and Time
T2, you can use these two new records to improve your model and then predict the value at time B three.
Similarly, if you want to predict the value at time B five and you already have data of all the values
and time before you want to use all the available information with you, you don't want to use your
same M1 model that you have created at time, even because in that case you are missing out on values
that are available at time B two to three and four.
So what we can do is if we want to train a more modern four time T two, we can take all the values
till time to even create a modern and use that model to predict the value at time.
T2 If we want to predict the value at time D3.
We will take all the values to retain T2.
So we will take all the values.
We'll create another model and predict the value at twenty three.
Similarly, if we want to predict any value at the time to five, we will take all the information that
is available to us the time before we'll create a model on that and then we will predict the value at
time.
P.
So for our test set also, we are not going to create a single model and predict the values for the
seven party records for the first record in our test set.
We are going to use this train set and create a model and predict for the first value, for the second
value of our test.
It will take all the values of our train set.
We will date the first when you afford a set, and then we will predict the value for our second record
of our test set.
So this way of validation is known as walk forward of elevation, and it usually give us more accuracy
than a single time series.
More than.
So we will learn how to use walk forward validation as well.
Along with creating a single day time model.
That's all for this video.
Thank you.