1 00:00:00,360 --> 00:00:07,290 In this lecture, we are going to learn about how to create a remote model in Python and how to select 2 00:00:07,350 --> 00:00:10,920 B, B and Q values for A more modern. 3 00:00:13,510 --> 00:00:18,190 So for this problem, we are going to use shampoo, not CSB dataset. 4 00:00:19,360 --> 00:00:23,080 You can download this dataset from the resources section of this video. 5 00:00:23,650 --> 00:00:29,650 So let's import this and let's take the first five videos of ordinator say. 6 00:00:32,760 --> 00:00:40,080 So we have month column and we have sales column and we want to create our model on the sales column 7 00:00:40,080 --> 00:00:40,830 of this data. 8 00:00:42,380 --> 00:00:43,210 Now, let's. 9 00:00:45,610 --> 00:00:47,160 Glad to see sales data. 10 00:00:51,060 --> 00:00:53,100 You can see this is the sales data. 11 00:00:54,000 --> 00:00:56,970 We have data offered on prettify records. 12 00:01:00,500 --> 00:01:10,160 Now, here, if you look at it, you can see that there is no seasonality at such and there is some 13 00:01:10,160 --> 00:01:11,730 sort of quarterdeck crane. 14 00:01:12,350 --> 00:01:14,790 At first the increase is very slow. 15 00:01:15,500 --> 00:01:20,870 But as we go on, the the increase is increasing with the time. 16 00:01:21,650 --> 00:01:26,210 So this is some sort of order decreeing that we are seeing in the sales data. 17 00:01:28,070 --> 00:01:32,840 And therefore, since this is according to Crane, we need to defensing. 18 00:01:34,160 --> 00:01:35,610 To make it stationary. 19 00:01:37,440 --> 00:01:48,210 That's why our B should be Q so in Atima, we have three parameters, B, B and Q B sense for a number 20 00:01:48,210 --> 00:01:48,820 of items. 21 00:01:48,960 --> 00:01:56,940 We want to consider for authorization, B sense for a number of defensing and Q sense for a number of 22 00:01:56,940 --> 00:02:00,060 items we want to consider for moving average part. 23 00:02:03,600 --> 00:02:11,760 Since our data has quadratic Krang, we will be using Bique what to do in case of linear trend. 24 00:02:11,910 --> 00:02:13,470 We should use the equal to one. 25 00:02:15,750 --> 00:02:20,280 Now let's look at how to select B and Q parameters. 26 00:02:23,670 --> 00:02:27,500 So to select you, you should Blondeau Autocorrelation Klodt. 27 00:02:29,940 --> 00:02:34,120 We have already discussed this graph and times it is with Malaysian Park. 28 00:02:34,890 --> 00:02:37,890 So we are just going to take. 29 00:02:43,990 --> 00:02:47,310 This is the auto relation part for the sales data that we have. 30 00:02:49,250 --> 00:02:51,800 We have the correlation well-used with the lag very well. 31 00:02:51,890 --> 00:02:55,230 So this is the correlation value with leg one. 32 00:02:55,280 --> 00:02:58,460 This is the correlation value with leg two and so on. 33 00:02:59,660 --> 00:03:02,630 We have this data for around today, five leg values. 34 00:03:06,210 --> 00:03:09,900 We have confidence interval mount as a strict length. 35 00:03:12,450 --> 00:03:16,700 In this graph, you should look at the value of weight. 36 00:03:17,170 --> 00:03:19,750 The line is crossing the confidence interval. 37 00:03:20,680 --> 00:03:26,410 So if you can see the line is crossing confidence interval line around here. 38 00:03:27,760 --> 00:03:30,820 So the value just before this point is five. 39 00:03:31,480 --> 00:03:35,620 So we should consider five as the value for you. 40 00:03:37,660 --> 00:03:45,310 So for any time, cities, if you want to run a remote more than first, block the line, check and 41 00:03:45,310 --> 00:03:46,510 identify the train. 42 00:03:49,030 --> 00:03:51,420 Then not autocorrelation lord. 43 00:03:53,380 --> 00:04:00,240 And look at where the autocorrelation plot is crossing the confidence interval line. 44 00:04:02,990 --> 00:04:07,190 And then also flawed, the partial autocorrelation draft to find out. 45 00:04:07,260 --> 00:04:11,680 Be here, the line is crossing after black file. 46 00:04:11,850 --> 00:04:14,690 That's why we should select you to fight. 47 00:04:15,950 --> 00:04:18,890 No, let's applaud autocorrelation Lord. 48 00:04:19,550 --> 00:04:22,730 Autocorrelation Lord is available in a sex model. 49 00:04:23,690 --> 00:04:30,930 So first let's imported and then Lord take again. 50 00:04:31,010 --> 00:04:34,120 These are the autocorrelation values with the leg variable. 51 00:04:35,630 --> 00:04:38,780 We have considered for thin legs for this graph. 52 00:04:39,350 --> 00:04:41,900 And we're loading the parcel. 53 00:04:42,040 --> 00:04:49,160 Although coordination dropped on the sales data, the blue band here is again the confidence interval. 54 00:04:50,810 --> 00:04:55,790 Now you can see that this partial autocorrelation is crossing the confidence interval. 55 00:04:55,910 --> 00:04:57,900 Add value three two. 56 00:04:57,980 --> 00:05:03,760 Therefore, we should consider two as be for our remodel. 57 00:05:06,320 --> 00:05:09,110 The first barrier is it's for the very well itself. 58 00:05:09,170 --> 00:05:13,100 So that's why we are getting partial out of religion value of one. 59 00:05:13,250 --> 00:05:14,460 This is for legman. 60 00:05:14,510 --> 00:05:15,580 This is for like two. 61 00:05:15,620 --> 00:05:16,840 And this is phylactery. 62 00:05:18,770 --> 00:05:22,130 The graph is crossing confidence interval between two and three. 63 00:05:22,280 --> 00:05:23,800 That's why we should consider two. 64 00:05:27,940 --> 00:05:36,800 Now, since we have the value of B, Q and B, we should train over at a memorial on these parameters. 65 00:05:37,420 --> 00:05:40,770 So first we are importing an e-mail from sex model. 66 00:05:41,750 --> 00:05:43,530 So it's imported. 67 00:05:44,710 --> 00:05:46,990 Then on the other steps are almost similar. 68 00:05:47,110 --> 00:05:48,970 We first define our model object. 69 00:05:49,570 --> 00:05:52,420 Our model is a rhema on sales data. 70 00:05:53,110 --> 00:05:57,520 And we have to give believe to values using this parameter. 71 00:05:57,730 --> 00:06:00,280 So we are using order equal to. 72 00:06:00,430 --> 00:06:02,860 And then we can pass a double first. 73 00:06:02,890 --> 00:06:05,500 We have to give B, then B, then Q. 74 00:06:06,700 --> 00:06:09,970 That's why we are passing a couple of come to my life. 75 00:06:11,470 --> 00:06:12,550 Let's run this. 76 00:06:12,990 --> 00:06:14,720 Now let's fit our model than. 77 00:06:20,740 --> 00:06:24,580 So the effort and the model ignored ignore this morning, saw this. 78 00:06:24,690 --> 00:06:25,330 Messages. 79 00:06:27,550 --> 00:06:31,970 Now to look at all local fishing and their values. 80 00:06:32,440 --> 00:06:35,430 You can use modern fact dot somebody's mental. 81 00:06:36,160 --> 00:06:42,040 So if you run this, you will get all the information that you need. 82 00:06:42,730 --> 00:06:45,550 So here we have the modern name. 83 00:06:45,700 --> 00:06:47,350 The number of observations. 84 00:06:48,400 --> 00:06:51,430 And then here you can see the consent value. 85 00:06:52,150 --> 00:06:53,950 The variables that we are considering. 86 00:06:54,370 --> 00:06:59,080 So we are considering five leg variables for auto regression. 87 00:06:59,710 --> 00:07:09,190 That's why we have five variables named as one and two and three and four and five with prefix as air. 88 00:07:09,390 --> 00:07:10,990 Other stand for auto regulation. 89 00:07:12,850 --> 00:07:18,370 Then our cue is to that is we are considering two variables for moving average. 90 00:07:19,360 --> 00:07:25,960 That's why we have two wearables, L1, L2 with refix Emma Emma sense for moving average. 91 00:07:27,160 --> 00:07:31,540 You can also see the coefficient values for all these variables. 92 00:07:31,600 --> 00:07:35,890 You can also see the P values for these variables. 93 00:07:36,190 --> 00:07:41,410 The smaller the Bulu, the more important that variable is. 94 00:07:41,830 --> 00:07:51,760 So the most important variable in our model is L1 and a little four auto regulation and L2 for moving 95 00:07:51,760 --> 00:07:52,180 average. 96 00:07:55,270 --> 00:08:00,160 So using the P value, you can also define importance of variables. 97 00:08:05,500 --> 00:08:12,470 Now, we will also look at the resolution where news of more than you can get that has real value from 98 00:08:12,470 --> 00:08:13,150 door dressing. 99 00:08:13,250 --> 00:08:13,630 My take. 100 00:08:14,030 --> 00:08:18,970 So I'm just equating Rassa realistic way to model fake thought. 101 00:08:19,560 --> 00:08:22,910 President elect Flodden, this desolate. 102 00:08:26,070 --> 00:08:31,590 Now, we have discussed that the red civil should be in the form of white noise. 103 00:08:32,040 --> 00:08:38,150 There should be no visible pattern in your resolution if there is any pattern in your resolution. 104 00:08:38,190 --> 00:08:42,810 That means that you can improve your model and there is some information in your model that you are 105 00:08:42,810 --> 00:08:43,290 missing. 106 00:08:45,450 --> 00:08:50,800 So you can see that there is no trend or seasonality that is going on in our lives. 107 00:08:50,920 --> 00:08:53,940 Well, and this is acting like a white noise. 108 00:08:54,690 --> 00:08:57,570 We can also look at the mean value of the restaurant. 109 00:08:59,130 --> 00:09:07,860 You can see that the mean value of resolution is eleven and the minimum, 25, 50 percent and 75 percentile. 110 00:09:08,340 --> 00:09:10,870 And Maxwell, you are following the bell curve. 111 00:09:11,730 --> 00:09:16,950 So the sort of a 10 restaurant statistics are looking good. 112 00:09:16,980 --> 00:09:21,210 And you should also look at the restaurant value after running at him more than. 113 00:09:25,180 --> 00:09:27,970 Now, these are some of the video agents offering my more than. 114 00:09:30,400 --> 00:09:35,900 We just feels this one, Atima, where we're defined to be and be. 115 00:09:40,660 --> 00:09:48,200 Now, if you want to run auto regression, you can use a rhema where the variables for Amet is zero. 116 00:09:48,730 --> 00:09:55,840 And if you want to just use moving average, you can define number of auto technician terms to be use 117 00:09:55,840 --> 00:09:57,190 and model as zero. 118 00:09:59,410 --> 00:10:08,290 So if you just give P and the values and Q is zero, then you are running auto regression model. 119 00:10:09,520 --> 00:10:17,650 And if you're PS zero and you are giving one lady and Q A loose, then you are running. 120 00:10:17,890 --> 00:10:18,520 And my model. 121 00:10:21,980 --> 00:10:29,620 So there is no need of finding out the rest of the year and running auto regression on that to execute 122 00:10:29,630 --> 00:10:33,550 moving average more than you can just use a remote model as well. 123 00:10:33,820 --> 00:10:35,400 Do random moving average model. 124 00:10:37,700 --> 00:10:39,110 So an animal model. 125 00:10:39,260 --> 00:10:40,670 All three models are covered. 126 00:10:40,700 --> 00:10:45,970 You can always use a remote more than with BD and you will use. 127 00:10:46,370 --> 00:10:53,500 You can use auto regression with you equate to zero and you can also use moving average with be quick 128 00:10:53,540 --> 00:10:53,990 Lozito. 129 00:10:58,120 --> 00:11:02,300 Now, he might have to mentor spoof forecast of future Trelew. 130 00:11:02,730 --> 00:11:04,620 First is the forecast method. 131 00:11:05,490 --> 00:11:11,280 If you just rate model for DORT forecasts, it will automatically give you the forecast for next Piter. 132 00:11:12,720 --> 00:11:16,320 So water and in the forecast, you can see. 133 00:11:17,350 --> 00:11:19,990 Does an array of three different durry? 134 00:11:20,730 --> 00:11:22,760 First, you have the forecasted value. 135 00:11:23,550 --> 00:11:25,770 Then you have the standard deviation. 136 00:11:26,370 --> 00:11:31,080 And then you have the 95 percent confidence interval for that value. 137 00:11:31,890 --> 00:11:37,470 So if you just want to select the forecasted value, you can write. 138 00:11:40,790 --> 00:11:42,110 Since you won the first. 139 00:11:43,220 --> 00:11:46,780 And this one because in the first set, you wanted this value. 140 00:11:46,880 --> 00:11:52,530 So if you run this, you will get the forecasted value, which is equal to this value. 141 00:11:53,240 --> 00:11:57,140 So 636 is the forecast set value for the next bidder. 142 00:11:57,920 --> 00:12:01,050 If you want to get these values for my people, put it. 143 00:12:01,130 --> 00:12:10,010 So suppose if I want to get values for next five period, I can just straight forecast and I can provide 144 00:12:10,160 --> 00:12:12,710 an integer value for the time bidders. 145 00:12:12,830 --> 00:12:14,470 I want the forecast for. 146 00:12:14,720 --> 00:12:20,630 So if I had a straight model under Sawford, Dorte forecast an argument is five. 147 00:12:22,040 --> 00:12:25,940 I will get the value for next five time periods. 148 00:12:26,420 --> 00:12:31,400 So in the first array we have the forecasted value in the second that a. 149 00:12:31,430 --> 00:12:31,630 B. 150 00:12:31,820 --> 00:12:33,920 The standard deviation. 151 00:12:34,190 --> 00:12:40,460 And in the last study I have the confidence interval for those forecasted values. 152 00:12:42,860 --> 00:12:50,430 Again, if I just want any particular value, I can use a square bracket to select that particular value. 153 00:12:52,790 --> 00:12:56,000 You can also use these values to plot the graph. 154 00:12:56,030 --> 00:13:00,410 So I just read this. 155 00:13:00,440 --> 00:13:05,300 I will get the first today and then I can plot this day on a later. 156 00:13:06,590 --> 00:13:09,780 So that's all for Atima in the next lecture. 157 00:13:09,800 --> 00:13:15,070 We will look at how to use walk forward validation for animal models.