1 00:00:00,990 --> 00:00:05,850 In this lecture, we will learn how to include seasonality. 2 00:00:05,990 --> 00:00:07,130 No, Eddie, my model. 3 00:00:08,390 --> 00:00:11,800 Or how do you study my model in Python? 4 00:00:13,440 --> 00:00:15,920 Satima essense for seasonal Atima. 5 00:00:16,830 --> 00:00:23,600 And this model also incorporate seasonality while fitting or training or model. 6 00:00:25,240 --> 00:00:31,440 Now, one of the limitation of Eyadema is that it can only handle Ukraine in your data. 7 00:00:33,450 --> 00:00:39,750 If your data have seasonality, you first served to the IT and then use that in my model on their DePrince 8 00:00:39,750 --> 00:00:40,140 data. 9 00:00:41,880 --> 00:00:50,740 To overcome this limitation, we have Satima model where we include both grand and seasonality while 10 00:00:50,760 --> 00:00:51,320 modeling. 11 00:00:54,360 --> 00:00:58,560 So in Rhema you just have to provide beebee you variables. 12 00:00:59,190 --> 00:01:04,680 What in Satima you have to provide seven different parameters. 13 00:01:05,010 --> 00:01:12,870 First you have to broyd lowercase beebee Q for data and then a better case. 14 00:01:12,870 --> 00:01:21,570 BBC you and M for the seasonal data lowercase B essense for a number of domes. 15 00:01:22,380 --> 00:01:28,020 We want to consider for auto regression be censored number of times. 16 00:01:28,170 --> 00:01:33,480 We want to do depressing cuz sense for number of lag times. 17 00:01:33,510 --> 00:01:36,750 We want to consider for moving average. 18 00:01:37,880 --> 00:01:45,630 Now all these mortgages we need you is four grand that we haven't discussed in a remodel so. 19 00:01:49,840 --> 00:01:57,920 No, next, we have four other parameters, capital p sense for seasonal auto regressive order. 20 00:01:58,180 --> 00:02:05,140 So this is the number of times you want to consider for auto regression, for seasonality. 21 00:02:05,890 --> 00:02:15,340 So if you are giving capital P equal to one, this means that the model will also consider one seasonality 22 00:02:15,430 --> 00:02:15,810 lag. 23 00:02:17,140 --> 00:02:26,020 So if you're seasonality is of value time period or you have a yearly seasonality, it will consider 24 00:02:26,020 --> 00:02:28,600 the last year value for auto regression. 25 00:02:29,320 --> 00:02:35,320 Similarly, B is the number of defensing you want to be seasonal as your data. 26 00:02:37,780 --> 00:02:46,060 Q Is the number of seasonal times you want to include in your moving average and M is the number of 27 00:02:46,060 --> 00:02:49,120 times steps for a single seasonal period. 28 00:02:49,330 --> 00:02:57,970 So if you have a monthly data and and yearly seasonality, you have to give AM equates to an. 29 00:03:00,780 --> 00:03:06,750 If you have a daily data and you have a weekly seasonality, you have to give Amik way to seven. 30 00:03:11,330 --> 00:03:14,840 The implementation is almost similar to Eyadema. 31 00:03:16,310 --> 00:03:25,880 So instead of Eyadema, this time you have to import Satima X from his set Smardon and we will be using 32 00:03:26,450 --> 00:03:28,990 U.S. airline monthly aircraft data. 33 00:03:29,060 --> 00:03:32,990 Since this data have both grindin seasonality on. 34 00:03:32,990 --> 00:03:35,300 Let's look at the head of this data. 35 00:03:36,200 --> 00:03:37,960 The first column we have is for one. 36 00:03:38,060 --> 00:03:40,770 The second volume V is for the minus. 37 00:03:41,910 --> 00:03:44,030 Let's look at the less. 38 00:03:44,030 --> 00:03:44,270 Well. 39 00:03:47,330 --> 00:03:52,930 So we have data for on 17 years from 1963 to 1970. 40 00:03:58,190 --> 00:04:05,370 Let's change the index as well so that we can decompose this data to look at the trend and seasonality, 41 00:04:06,190 --> 00:04:11,480 we'll be using the seasonally decompose function from insects for the library. 42 00:04:14,960 --> 00:04:18,410 This will decompose our data frame and pull forward parts. 43 00:04:19,220 --> 00:04:20,660 First one is the observe data. 44 00:04:20,690 --> 00:04:23,060 You can see that on the raw data itself. 45 00:04:23,090 --> 00:04:25,170 You can see some kind seasonality. 46 00:04:28,280 --> 00:04:35,390 Then we have the trend line tech, which is showing us how the trend is changing with time. 47 00:04:36,170 --> 00:04:44,810 You can see that we can say that this is a linear crane and we only need one defensing to decode our 48 00:04:44,810 --> 00:04:45,170 data. 49 00:04:46,010 --> 00:04:47,960 Then we have the seasonality graph. 50 00:04:48,950 --> 00:04:54,200 You can see that the seasonality varies from point eight to one point two. 51 00:04:54,480 --> 00:05:01,310 That's mean if we are using multiplicative model, there is a change of 20 percent due to seasonality. 52 00:05:01,490 --> 00:05:02,450 And that's huge. 53 00:05:02,600 --> 00:05:06,020 So we can say that our data have high seasonality. 54 00:05:07,670 --> 00:05:12,380 And the next thing you can notice is that the seasonality is a little seasonality. 55 00:05:12,650 --> 00:05:14,090 So this is 1964. 56 00:05:14,120 --> 00:05:15,290 This is 1963. 57 00:05:15,320 --> 00:05:16,560 This is 1965. 58 00:05:17,250 --> 00:05:21,380 But you can see that the cycle is repeating year after year. 59 00:05:22,520 --> 00:05:25,190 And then we have that as a real graph for our data. 60 00:05:28,310 --> 00:05:35,640 So from this graph, we can say that our lower case, D. That is the defensing we need to be trained. 61 00:05:35,640 --> 00:05:44,150 The data should be one and M should be well, since we have a monthly data and then yearly seasonality. 62 00:05:48,540 --> 00:05:50,850 So this is the parameters we are going to use. 63 00:05:52,020 --> 00:05:58,200 So, no, this is the parameters that we are going to use while creating the model object. 64 00:05:58,350 --> 00:05:59,900 We have to give two parameter. 65 00:06:00,180 --> 00:06:01,500 First one is the order. 66 00:06:01,590 --> 00:06:03,360 And the second one is the seasonal order. 67 00:06:03,840 --> 00:06:06,350 Order is the same as what we give them a rhema. 68 00:06:06,690 --> 00:06:09,930 That is lowercase B, B and Cuba loose. 69 00:06:12,150 --> 00:06:18,300 And seasonal order is the additional parameter that we have to give in Satima where we have to give 70 00:06:18,360 --> 00:06:18,840 capital. 71 00:06:18,840 --> 00:06:19,890 B, capital. 72 00:06:19,900 --> 00:06:20,750 B, capital. 73 00:06:20,810 --> 00:06:21,500 Q Aleuts. 74 00:06:21,870 --> 00:06:23,220 And then the M value. 75 00:06:25,950 --> 00:06:27,990 So we are willing to train set. 76 00:06:27,990 --> 00:06:36,840 He makes more than on minus data with B as five, B as one and lowercase Q as three. 77 00:06:37,560 --> 00:06:44,310 Whereas A part is B, B, Q and M as one comma, one comma, one comma 20 respectively. 78 00:06:46,290 --> 00:06:54,200 So let's create this model object and let's for this data we have over our data. 79 00:06:54,270 --> 00:07:01,950 We can also check out the rest rules of this model so that we can say that modulo extricated all the 80 00:07:01,950 --> 00:07:04,230 information that they they in the data. 81 00:07:06,300 --> 00:07:07,140 So let's plot. 82 00:07:07,610 --> 00:07:08,220 That's real. 83 00:07:08,550 --> 00:07:16,170 You can see that the restaurants are centred around zero and that is no Grendon seasonality in the resolution. 84 00:07:18,420 --> 00:07:20,610 This that bulls are like a white noise. 85 00:07:20,640 --> 00:07:21,960 And we can say that. 86 00:07:22,260 --> 00:07:26,040 I would more than ever extracted all the information from this dataset. 87 00:07:28,840 --> 00:07:29,150 No. 88 00:07:29,330 --> 00:07:32,820 Here also, just like Remar, we can use Daudt forecast. 89 00:07:33,170 --> 00:07:37,050 My turn to get forecasts value of the next budget. 90 00:07:37,800 --> 00:07:41,780 So let's clear the variable output. 91 00:07:42,180 --> 00:07:45,040 And we are saving the forecast value of the next puttered. 92 00:07:45,120 --> 00:07:46,430 And that's all very well. 93 00:07:48,570 --> 00:07:49,490 Let's look at those. 94 00:07:49,880 --> 00:07:52,170 Well, you can see that we are getting there. 95 00:07:53,850 --> 00:07:59,580 So if you see, here's the deal. 96 00:08:00,030 --> 00:08:04,280 We have data in 1970, December. 97 00:08:05,430 --> 00:08:10,710 And now we are getting the forecast for January 1971. 98 00:08:10,800 --> 00:08:14,030 And the forecast value is eleven thousand four hundred and seventy five. 99 00:08:15,450 --> 00:08:19,190 You can also pass parameters and this forecast matter. 100 00:08:19,950 --> 00:08:25,500 So if I just write well, it will give me the forecasts of 30 days. 101 00:08:27,510 --> 00:08:30,480 You can see we have the forecast for next from this. 102 00:08:31,750 --> 00:08:37,560 Now, just like Remar, we have Dort Kraddick function as well and don't predict Fanshen. 103 00:08:37,590 --> 00:08:40,290 We have to provide a start date and end date. 104 00:08:40,800 --> 00:08:46,200 And if we don't broyd any date, it will give prediction values for all the values that are available 105 00:08:46,980 --> 00:08:47,760 in your data. 106 00:08:48,900 --> 00:08:52,860 So I am sorting this information in my head very well. 107 00:08:53,880 --> 00:09:01,960 So now we have predicted values from this model, from e're 1963 to e're 1970. 108 00:09:02,100 --> 00:09:03,500 And this variable Y ahead. 109 00:09:03,870 --> 00:09:06,420 And we have the predicted value for next year. 110 00:09:06,690 --> 00:09:11,640 And this variable that is more than underscore for Dort forecast. 111 00:09:12,780 --> 00:09:15,640 So if you just look at why had. 112 00:09:20,080 --> 00:09:28,000 You can see that we have the forecast said value for first five records here using a lot more than that. 113 00:09:28,590 --> 00:09:33,510 Now, we can also plot this forecast set value against the actual values. 114 00:09:33,950 --> 00:09:41,690 So we are winning put Lord D.F. Mind, Simon, and we are plotting way ahead on the same plot using 115 00:09:41,690 --> 00:09:42,220 that killer. 116 00:09:43,370 --> 00:09:45,610 So let's look at the plot. 117 00:09:46,580 --> 00:09:50,450 Well, you can see this blue line are the oldest known values. 118 00:09:50,540 --> 00:09:53,830 And this red line is the predicted value using the word model. 119 00:09:54,920 --> 00:09:57,830 The blue line and the red line almost mowing. 120 00:09:58,190 --> 00:09:58,680 And then. 121 00:09:59,540 --> 00:10:03,530 And that is not much variation in two values. 122 00:10:06,380 --> 00:10:09,580 So that Sölvi Element, Satima and Biton. 123 00:10:10,370 --> 00:10:12,590 And we predict values using ceremony more. 124 00:10:15,470 --> 00:10:18,560 We can also use walk forward validation in Satima. 125 00:10:19,610 --> 00:10:24,590 We already have executed walk forward validation for each other. 126 00:10:24,830 --> 00:10:30,590 And remember that you can use the same code for setting my model as well. 127 00:10:30,980 --> 00:10:34,700 Just do some necessary changes in the model creation. 128 00:10:37,220 --> 00:10:39,470 So that's all for this lecture. 129 00:10:39,830 --> 00:10:40,280 Thank you.