1 00:00:00,660 --> 00:00:06,030 In this video, we will learn how to implement walk forward validation for a demo model. 2 00:00:08,100 --> 00:00:10,410 So let's first aim for it. 3 00:00:10,620 --> 00:00:12,520 We are going to use the same dataset. 4 00:00:13,440 --> 00:00:14,860 That is simple dots. 5 00:00:14,900 --> 00:00:15,260 Yes. 6 00:00:16,440 --> 00:00:18,000 Let's look at the data 7 00:00:20,880 --> 00:00:22,000 here. 8 00:00:22,290 --> 00:00:25,040 You can see that we have the month value and the sales value. 9 00:00:26,250 --> 00:00:29,640 So this month, values are four 19 zero one. 10 00:00:30,630 --> 00:00:41,580 So if you see one nine zero is missing from this data and that twice, pandas will not be able to identify 11 00:00:41,580 --> 00:00:41,850 that. 12 00:00:41,880 --> 00:00:42,990 This is the date for me. 13 00:00:43,860 --> 00:00:47,570 So for this example, you can also use the time it. 14 00:00:48,120 --> 00:00:52,570 So first you have to define a password using this segment. 15 00:00:53,580 --> 00:00:54,300 In this case. 16 00:00:54,360 --> 00:01:01,620 And then you can also give this password as an argument while you are loading CSP in that way. 17 00:01:01,710 --> 00:01:03,360 You will have a date. 18 00:01:03,360 --> 00:01:07,630 Time for my trade data in your first column instead of this month value. 19 00:01:08,700 --> 00:01:12,240 But for now, be our only focus on the sales value. 20 00:01:12,360 --> 00:01:15,090 And we are running our model only on the sales value. 21 00:01:15,150 --> 00:01:17,560 That's why we are not going to change our. 22 00:01:21,560 --> 00:01:24,830 So let the wait over there trying to test and train. 23 00:01:26,360 --> 00:01:33,560 So we will take 70 percent of our data and do training and remaining 30 percent of the time to test. 24 00:01:34,280 --> 00:01:39,720 So first, I'm defining or train size and then I'm dividing my dataset. 25 00:01:39,830 --> 00:01:42,170 That is the year to test and train. 26 00:01:45,770 --> 00:01:55,850 Let's look at the shape of data so you can see that we have a long 25 records and green and their own 27 00:01:56,190 --> 00:02:00,340 290 records and our best for this. 28 00:02:00,860 --> 00:02:01,380 So, yeah. 29 00:02:01,580 --> 00:02:05,310 Bill, I don't believe in the courts and test and 25, the courts and train. 30 00:02:05,530 --> 00:02:07,340 So we have 36 records. 31 00:02:09,710 --> 00:02:16,550 No implementing walk forward for a remise almost similar to the more forward validation we implemented 32 00:02:16,550 --> 00:02:22,550 for year, more than we are willing to use the same, except first we are defining data. 33 00:02:23,570 --> 00:02:27,050 Then we will run the loop for all the values in test. 34 00:02:29,000 --> 00:02:31,610 We will create a model for each. 35 00:02:31,610 --> 00:02:39,020 Then in this fall loop will save the first value all forward via data into a list called Predict. 36 00:02:40,400 --> 00:02:48,560 And at the end of each one, we will include the test value and to dream data that we are going to use 37 00:02:48,590 --> 00:02:51,040 to dream of what model in the next one. 38 00:02:53,630 --> 00:02:56,180 So first we are initializing our data. 39 00:02:56,180 --> 00:02:56,600 We will? 40 00:02:56,600 --> 00:03:01,610 S train variable and we are also initializing or predict list. 41 00:03:02,990 --> 00:03:04,820 Then 40 in test. 42 00:03:06,020 --> 00:03:09,560 So this for loop will go on for eleven values of test. 43 00:03:10,520 --> 00:03:13,300 First we are defining or more than that is Atima. 44 00:03:13,610 --> 00:03:17,690 We are training this model on data and we are using BBC. 45 00:03:17,690 --> 00:03:21,010 You and you find common one, common Xeloda respectively. 46 00:03:22,160 --> 00:03:24,290 Then in the next step we are fitting or model. 47 00:03:25,470 --> 00:03:29,310 Then we are forecasting the next value using weight. 48 00:03:29,340 --> 00:03:32,060 We do model under Scott Fed dort forecast. 49 00:03:32,780 --> 00:03:42,320 And since Y is a combination of three arrays, we are just extracting the value of forecasts from this 50 00:03:42,320 --> 00:03:42,740 way. 51 00:03:43,650 --> 00:03:45,080 I concede almost zero. 52 00:03:46,550 --> 00:03:48,780 We are upending this VI forecast. 53 00:03:49,340 --> 00:03:55,460 And to predict function and then we are also spending our data in the next cycle. 54 00:03:55,520 --> 00:03:57,460 New data will going to bring my model. 55 00:03:58,130 --> 00:04:00,970 And it will predict the next value of fly. 56 00:04:02,810 --> 00:04:05,690 So let's run this. 57 00:04:08,490 --> 00:04:16,890 You can see that we have eleven values, so this is the prediction four times better P plus one is the 58 00:04:16,950 --> 00:04:20,940 prediction for time 30 plus two is the prediction for time. 59 00:04:20,940 --> 00:04:28,020 Predict a plus three using or third model is the prediction for time period D plus for using our fourth 60 00:04:28,020 --> 00:04:29,290 model and so on. 61 00:04:30,180 --> 00:04:36,690 So we have implemented walk forward evaluation on our data using my model. 62 00:04:37,290 --> 00:04:41,010 Now let's look at this list as well. 63 00:04:42,810 --> 00:04:44,490 This will contain the same data. 64 00:04:46,720 --> 00:04:51,170 Now to look at the MSCI value we will import. 65 00:04:51,970 --> 00:04:54,330 I mean, squared error from Eskinder. 66 00:04:55,350 --> 00:05:01,890 And then we will give the actual values or test that is test taught values and the predicted values 67 00:05:01,950 --> 00:05:04,050 that we have in our product list. 68 00:05:05,230 --> 00:05:08,240 So if you run this, this is the MASC value. 69 00:05:08,870 --> 00:05:12,300 You can compare this MASC value with other models as well. 70 00:05:14,650 --> 00:05:19,500 And so we implement Wolke forward validation on a premium order. 71 00:05:21,810 --> 00:05:23,370 That's all for this lecture. 72 00:05:23,490 --> 00:05:23,940 Thank you.