1 00:00:01,630 --> 00:00:03,760 Hello, everyone, and last lecture. 2 00:00:03,880 --> 00:00:07,570 We created a simple linear regression model in Python. 3 00:00:08,080 --> 00:00:12,760 We use a site, Model API and a Skillern to create that model. 4 00:00:13,660 --> 00:00:17,190 Now let's start building them or deepen the integration model. 5 00:00:17,430 --> 00:00:18,100 And by then. 6 00:00:19,600 --> 00:00:26,990 First, we will build our model using Start Smardon, and then we will again be using Eskinder. 7 00:00:30,020 --> 00:00:33,810 I have already imported my estate's model and Escalon liabilities. 8 00:00:34,640 --> 00:00:36,140 So if you are planning this. 9 00:00:37,070 --> 00:00:39,650 Don't forget to import the required libraries. 10 00:00:41,110 --> 00:00:48,160 Now, similar to last thing, we need to first create X and Y variables for over more than. 11 00:00:49,670 --> 00:00:51,920 So let's first clear dollar, swift even. 12 00:00:53,440 --> 00:00:59,530 Last time, we only use rule number as our x ray, but this time we need all the variables except the 13 00:00:59,530 --> 00:01:00,230 price variable. 14 00:01:00,520 --> 00:01:07,110 Since Bizer table is our dependent variable, we need all the variables except price variable from a 15 00:01:07,110 --> 00:01:10,510 lot B if as our X would even write X. 16 00:01:11,460 --> 00:01:13,000 Underscore my date. 17 00:01:13,720 --> 00:01:16,930 This is our variable name for dependent variables. 18 00:01:17,610 --> 00:01:21,180 We will write B if not go. 19 00:01:23,410 --> 00:01:26,710 And then record will right price. 20 00:01:29,730 --> 00:01:32,940 And after a coma, we'll write Exis Equal the one. 21 00:01:36,490 --> 00:01:39,180 Let me explain you discovery first. 22 00:01:39,370 --> 00:01:42,090 We are creating a variable X underscore morality. 23 00:01:43,240 --> 00:01:50,170 Then we want all the variables of our beef data frame in this variable except the price variable. 24 00:01:50,770 --> 00:01:51,900 So we are using graph. 25 00:01:51,940 --> 00:01:54,520 Come on, we'll grab the guys column name. 26 00:01:55,880 --> 00:02:00,950 And since we are dropping a call them, we need to mention access equally to one. 27 00:02:02,030 --> 00:02:07,820 If we were dropping any rules, so, for example, if I wanted to drop my first school. 28 00:02:09,370 --> 00:02:13,750 I would use Grop and then in record I will write one. 29 00:02:14,610 --> 00:02:16,780 And in excess I would mention zero. 30 00:02:17,430 --> 00:02:23,410 X is zero is for dropping rose and X is equal to one is for dropping columns. 31 00:02:26,460 --> 00:02:27,890 So and this is statement. 32 00:02:28,560 --> 00:02:34,430 We are just dropping price and saving out all the variables and Door X multivariable. 33 00:02:38,250 --> 00:02:40,740 If we take a head of this X, my D. 34 00:02:42,010 --> 00:02:42,630 DUFFING. 35 00:02:49,190 --> 00:02:52,040 This is a sample of what it's my duty to frame. 36 00:02:52,760 --> 00:02:56,070 And you can see price sweaty when they scrub and desert. 37 00:02:57,590 --> 00:03:00,410 We only have our independent variable in this is a. 38 00:03:04,470 --> 00:03:07,980 Now, let's clear Tuller dependent variable name. 39 00:03:08,370 --> 00:03:09,870 Why are indiscriminately. 40 00:03:14,510 --> 00:03:19,110 And since our prize is over, the Bindoon video, but will right be off? 41 00:03:20,060 --> 00:03:22,130 And in this good record with mentioned price. 42 00:03:25,050 --> 00:03:27,330 We can also take a sample of this. 43 00:03:37,420 --> 00:03:42,520 You can see now we have created a what dependent and independent variables. 44 00:03:44,580 --> 00:03:53,180 If you remember and Isaak's Smardon, we have to act concerned, deliver data by default, what be done. 45 00:03:53,400 --> 00:03:55,530 Which is consent is zero. 46 00:03:56,000 --> 00:03:56,820 And they said smart. 47 00:03:57,750 --> 00:04:01,860 Let's add a constant to the word dependent variable x underscore Moradi. 48 00:04:03,570 --> 00:04:05,150 We'll create another debate. 49 00:04:05,310 --> 00:04:08,160 But X underscore my date under this good Korn's. 50 00:04:15,360 --> 00:04:18,570 All right, write Essene dot edcon spent. 51 00:04:23,180 --> 00:04:27,110 And then record will mention our x ray was, which is x mightly. 52 00:04:33,470 --> 00:04:37,010 If we take a sample of this, X might be Korn's. 53 00:04:43,560 --> 00:04:47,510 You can see, Ali, at our first columbus' crime rate. 54 00:04:48,030 --> 00:04:52,370 Now, our first column is this concept and this is taking Relu one. 55 00:04:53,070 --> 00:04:55,950 So this is a kind of proxy for what would be dunnart. 56 00:04:59,550 --> 00:05:00,960 Now to for Total Waman. 57 00:05:02,510 --> 00:05:07,460 Will create an alarm object, will write alarm, and that's called Moradi. 58 00:05:08,930 --> 00:05:10,610 Again, this is our variable name. 59 00:05:11,270 --> 00:05:17,750 You can say a word, object name, and we want to fit ordinary Lisa Square. 60 00:05:17,920 --> 00:05:25,510 So we'll write Esson Dot or as or unless a sense for ordinary Lisa Square, it is a method to make a 61 00:05:25,600 --> 00:05:26,210 patient model. 62 00:05:27,420 --> 00:05:29,300 We'll mention why underscore might be. 63 00:05:32,360 --> 00:05:36,530 And our X is X underscore may be underscored Conn's. 64 00:05:39,000 --> 00:05:41,310 There's the one in which we edit consent. 65 00:05:43,640 --> 00:05:44,790 Then we like big. 66 00:05:48,380 --> 00:05:49,160 Good on this. 67 00:05:51,270 --> 00:05:57,320 We have today a lot more that in this Elmendorf's got a mighty good view, this Smardon, right? 68 00:05:57,780 --> 00:06:00,060 I mean, let's go to my day then. 69 00:06:00,200 --> 00:06:00,430 Right. 70 00:06:00,500 --> 00:06:01,320 Got somebody. 71 00:06:08,400 --> 00:06:10,680 This is the result of a lot more than. 72 00:06:12,660 --> 00:06:16,720 You can see the artist square value or model is zero points. 73 00:06:16,770 --> 00:06:17,460 I went to one. 74 00:06:18,620 --> 00:06:22,370 And it just said artists good value is zero points, I wouldn't want to. 75 00:06:24,380 --> 00:06:25,230 Which is pretty good. 76 00:06:27,580 --> 00:06:33,400 Then about probability of F statistics is very low. 77 00:06:33,940 --> 00:06:38,000 It's in the range of eight to the bottom minus 125. 78 00:06:39,280 --> 00:06:47,110 So we can say with confidence that our independent variables have some impact on our dependent variable. 79 00:06:50,540 --> 00:07:01,370 The total number of observation network data are 506 and degrees of freedom is 490, since the formula 80 00:07:01,370 --> 00:07:04,220 for calculating the degrees of freedom is an. 81 00:07:05,170 --> 00:07:08,570 Minus B, minus one zero. 82 00:07:08,740 --> 00:07:11,390 And this five zero six would be. 83 00:07:11,710 --> 00:07:16,630 That is number of variables is 15 since we have been independent variables. 84 00:07:17,740 --> 00:07:23,850 And then minus one, that is five hundred and six, minus 16, which will give us four 90. 85 00:07:23,930 --> 00:07:26,020 So what degree of freedom is for 90? 86 00:07:28,150 --> 00:07:31,630 Now, let's look at individual independent variables. 87 00:07:33,790 --> 00:07:39,910 You can see all of what independent variables are listed on the left. 88 00:07:41,410 --> 00:07:43,830 The next column is, of course, fishing. 89 00:07:44,770 --> 00:07:50,500 These are the values of be done or be done with two, three and so on. 90 00:07:51,200 --> 00:07:52,360 Bita fifteen. 91 00:07:55,430 --> 00:07:57,200 Next is the standard edit. 92 00:07:58,670 --> 00:07:59,830 After that, we have a D. 93 00:07:59,990 --> 00:08:03,590 Statistics associated with this variables. 94 00:08:05,280 --> 00:08:07,440 Then we have a P-value of these variables. 95 00:08:08,160 --> 00:08:08,910 So remember. 96 00:08:09,970 --> 00:08:15,210 The lower the up you add, Lou, the more significant the variable is in determining way. 97 00:08:19,800 --> 00:08:21,970 So if you see the lowest. 98 00:08:22,180 --> 00:08:25,320 Will lose out in the case of inequality. 99 00:08:26,400 --> 00:08:27,020 Room them. 100 00:08:28,680 --> 00:08:31,140 The jet, which is 30 turps ratio. 101 00:08:32,250 --> 00:08:35,910 Or, Rob, it is the proportion of our population. 102 00:08:37,280 --> 00:08:38,720 And evidence distance. 103 00:08:41,860 --> 00:08:44,950 You can say that these are the most significant variables. 104 00:08:45,160 --> 00:08:45,970 What a what more than. 105 00:08:47,200 --> 00:08:52,090 These are the variables which have the highest impact on the worldwide variable. 106 00:08:53,400 --> 00:08:55,680 So how to interpret this data? 107 00:08:56,790 --> 00:09:00,150 First, you should look at the sign of this patient and. 108 00:09:01,350 --> 00:09:08,370 If the sign is positive, that means if you're increasing your independent variable, your dependent 109 00:09:08,370 --> 00:09:10,350 variable will increase with it. 110 00:09:10,950 --> 00:09:12,000 So, for example. 111 00:09:13,830 --> 00:09:21,120 I'm on the looking at the significant variable, for example, this room, non variable, the coefficient, 112 00:09:21,120 --> 00:09:21,930 dispositive, positive. 113 00:09:23,300 --> 00:09:25,200 And the value of coefficient is for. 114 00:09:26,540 --> 00:09:34,580 So in a way, I'm seeing that if I am increasing are growing numb by one, my price is going to increase 115 00:09:34,580 --> 00:09:35,690 by 40 units. 116 00:09:36,960 --> 00:09:45,480 So in a way, you can say that if all other variables are consent for two houses, if one of the house 117 00:09:45,900 --> 00:09:51,970 has more room numbers than the other house, then the price is going to be 40. 118 00:09:51,990 --> 00:09:53,190 Onex more. 119 00:09:56,040 --> 00:09:58,470 Now, let's look at the air quality here. 120 00:09:58,500 --> 00:09:59,670 My sign is negative. 121 00:10:00,750 --> 00:10:06,840 So in a way, I'm saying that if we are increasing the value of air quality, the price is going to 122 00:10:06,840 --> 00:10:07,500 decrease. 123 00:10:10,810 --> 00:10:15,280 Now, the p value for airport variable is also very less. 124 00:10:15,400 --> 00:10:17,530 That is zero point zero one three. 125 00:10:19,970 --> 00:10:22,400 And here the coefficient is one point one. 126 00:10:23,600 --> 00:10:30,740 So in a way, we're seeing that if the airport is present in any city, the prize is going to be increased 127 00:10:30,740 --> 00:10:31,670 by one unit. 128 00:10:32,870 --> 00:10:39,710 We are also somewhat confident that this variable have a significant effect on our dependent variable. 129 00:10:41,870 --> 00:10:50,570 So important takeaways from this research is identify the variables which have P value less than zero 130 00:10:50,570 --> 00:10:51,560 point zero five. 131 00:10:52,280 --> 00:11:00,230 And try to observe their coefficient and their signs to make business sense out of your data. 132 00:11:02,730 --> 00:11:03,630 This is the desert. 133 00:11:03,720 --> 00:11:08,310 From where you will Assad be driving your business intelligence? 134 00:11:09,400 --> 00:11:15,310 So in this case, you can say that you had house price is dependent on this five or six variables, 135 00:11:15,430 --> 00:11:24,280 which is room air quality and so on, and you can also tell that all this variables are impacting your 136 00:11:24,280 --> 00:11:24,880 price. 137 00:11:27,090 --> 00:11:32,040 Now, we will also create this similar model using a Escalon library. 138 00:11:34,610 --> 00:11:37,820 Our X and Y variables are ready with us. 139 00:11:38,030 --> 00:11:40,190 So it will just create another object. 140 00:11:41,400 --> 00:11:44,240 L m three l m three. 141 00:11:44,300 --> 00:11:50,480 Is the word object equal to linear regression? 142 00:11:58,860 --> 00:12:03,760 Alem three is our variable and linear regression is a function of Escalon Library. 143 00:12:03,940 --> 00:12:05,740 We have already imported Escalon. 144 00:12:07,330 --> 00:12:10,200 Now, to fit this model we let them through don't fit. 145 00:12:11,770 --> 00:12:14,880 Now our X was X underscore my D.. 146 00:12:15,640 --> 00:12:21,820 We don't need another variable with the consent sign in case of Escalon. 147 00:12:21,910 --> 00:12:23,830 So we'll just write a Eskander score. 148 00:12:25,430 --> 00:12:29,730 Might be another way variable this way, underscore maybe. 149 00:12:40,560 --> 00:12:44,050 We have for today, at least there, more done with a. 150 00:12:45,340 --> 00:12:52,170 Now, to get the coefficient, we will just, I think, Alem three. 151 00:12:54,750 --> 00:12:57,750 Don't intercept the school. 152 00:13:04,600 --> 00:13:06,850 Coma three. 153 00:13:08,130 --> 00:13:17,840 Well, if endoscope intercept underscored attributes represent we dunnart and quiff underscore a tribute 154 00:13:17,840 --> 00:13:21,390 group resing we dulan with our group with the three other. 155 00:13:23,480 --> 00:13:26,880 You can see first we have the value of intercept. 156 00:13:27,350 --> 00:13:30,270 And then we have the value of be done with that, too. 157 00:13:31,040 --> 00:13:33,740 You can also compare this result with the. 158 00:13:34,860 --> 00:13:37,980 Result we got from Start Smardon. 159 00:13:42,980 --> 00:13:43,760 You can see. 160 00:13:44,810 --> 00:13:48,680 It's not possible to get at somebody of a Linnean more than in a Skillern. 161 00:13:49,700 --> 00:13:57,020 But Escalon is much more useful and on other aspects by fitting the model and while predicting the values 162 00:13:57,170 --> 00:14:00,380 and running other advanced linear regression models. 163 00:14:02,050 --> 00:14:06,230 That's why we are also teaching you how to run this Eskinder. 164 00:14:09,020 --> 00:14:12,860 That is how we run a building integration, Martin and Biton.