1 00:00:01,410 --> 00:00:06,420 Now let's learn how to create a logistic regression model in Python. 2 00:00:07,500 --> 00:00:11,340 So in Python, there are two ways to create logistic regression model. 3 00:00:11,580 --> 00:00:13,760 First, using Escalon libraries. 4 00:00:14,190 --> 00:00:17,870 And second method is using state smarter library. 5 00:00:19,590 --> 00:00:25,550 There are a lot of documentation and implementation techniques available for a skill. 6 00:00:26,160 --> 00:00:28,740 That's why it is more preferred by professionals. 7 00:00:29,450 --> 00:00:32,880 Whereas a site model is the new library. 8 00:00:32,970 --> 00:00:38,340 And there are hardly any documentation and there are some bugs as well. 9 00:00:39,120 --> 00:00:45,660 But search model provides all the statistical information that is needed from all logistic regression 10 00:00:45,660 --> 00:00:45,960 model. 11 00:00:46,770 --> 00:00:50,340 So we will create this model using both of these two libraries. 12 00:00:54,210 --> 00:00:59,140 But before that, we need to create our X and Y variables. 13 00:01:01,990 --> 00:01:05,410 This time, we are only selecting one independent variable. 14 00:01:06,810 --> 00:01:12,600 That is price and our vye dependent variable is the Soviet variable. 15 00:01:14,020 --> 00:01:15,640 So first. 16 00:01:17,360 --> 00:01:24,080 We will clear our equitable will, right x equity to be if. 17 00:01:28,500 --> 00:01:39,210 And then to square record, we will right price in Eskil on your ex or independent variable should be 18 00:01:39,210 --> 00:01:40,470 a two dimensional. 19 00:01:40,920 --> 00:01:43,530 That's why we are using two squared records. 20 00:01:47,400 --> 00:01:49,970 And the word via variable is sold. 21 00:01:50,400 --> 00:01:51,840 So we'll write like way to. 22 00:02:00,750 --> 00:02:04,130 Sorry and single this quarter. 23 00:02:04,550 --> 00:02:05,540 We will rate soared. 24 00:02:08,470 --> 00:02:09,490 Now, let's. 25 00:02:10,720 --> 00:02:16,090 Check the sample of these two data frames, right, x dopehead. 26 00:02:26,030 --> 00:02:33,050 We have only one variable, which is players in the league, we will check, assemble or fly. 27 00:02:39,490 --> 00:02:48,490 So first, we will create our model using a scale, then we have to import logistic regression from 28 00:02:48,490 --> 00:02:49,090 a Skillern. 29 00:02:49,510 --> 00:02:52,090 So we will write from Escalon totally Nantel Mardon. 30 00:03:00,980 --> 00:03:02,700 In both logistic regression. 31 00:03:09,730 --> 00:03:12,820 You don't have to remember all this Gord's. 32 00:03:15,180 --> 00:03:21,930 You can visit Eskil Skillern documentation or you can copy this skorts from this notebook, which is 33 00:03:21,990 --> 00:03:24,120 a test in the resource section of this video. 34 00:03:26,200 --> 00:03:30,010 For Escalon, we followed three steps. 35 00:03:30,400 --> 00:03:32,710 First, we create our classification object. 36 00:03:33,400 --> 00:03:37,300 Then we find that object using our X and Y variable. 37 00:03:37,990 --> 00:03:41,770 And the third step is to predict our Y variable. 38 00:03:41,980 --> 00:03:44,380 Using that drained classification model. 39 00:03:46,840 --> 00:03:50,140 So first we will create our object. 40 00:03:50,570 --> 00:03:58,900 CLV underscore a lattice CLV is for classification and allow this sense for logistic regression. 41 00:03:59,560 --> 00:04:02,710 And we are using logistic regression with single variable. 42 00:04:02,770 --> 00:04:04,930 That's why we are putting in this word. 43 00:04:04,930 --> 00:04:08,810 C11 underscore a is a variable name. 44 00:04:10,300 --> 00:04:14,200 And we won this object to take logistic regression. 45 00:04:30,300 --> 00:04:34,070 Now we will fit our X and Y with even Buffett. 46 00:04:34,170 --> 00:04:44,130 We just have the right outfit, so we'll write CLV, underscore LARUS, not fit, and then record will 47 00:04:44,280 --> 00:04:51,060 first mention our dependent variable, which is X and then our dependent variable, which is why. 48 00:04:56,980 --> 00:05:03,870 We'll run this, we have grain, though, what a model to check the coefficient and intercept of a model 49 00:05:04,000 --> 00:05:06,280 that is B does little and B Devon. 50 00:05:07,750 --> 00:05:11,230 I hope you remember we does it when we govern from a word to reflect reelected. 51 00:05:12,550 --> 00:05:16,450 We'll see value of B does it when we do when we can. 52 00:05:17,200 --> 00:05:17,440 Right. 53 00:05:18,440 --> 00:05:20,060 CLV underscore Allardice. 54 00:05:24,950 --> 00:05:33,380 Not if underscore or if it stands for coefficient, and this is the attribute of over modern. 55 00:05:35,120 --> 00:05:37,170 We on this, we are getting this value. 56 00:05:37,240 --> 00:05:44,910 This is a value of between to see the value of B to zero, relates VLF. 57 00:05:45,040 --> 00:05:49,950 On that score, a lot is not intercept underscore. 58 00:05:54,350 --> 00:06:02,440 Again, this school, if and intercepts are the attributes of forward logistic regression model. 59 00:06:05,370 --> 00:06:07,210 There's the value of zero. 60 00:06:10,830 --> 00:06:19,250 So using this bit does it when we touch one, you can create a logistic equation that we discuss in 61 00:06:19,260 --> 00:06:22,200 our theory lecture and you can use this. 62 00:06:22,760 --> 00:06:27,280 What does it when we don't need to predict the value of Y from here when news of X? 63 00:06:28,620 --> 00:06:29,910 This is the first method. 64 00:06:30,880 --> 00:06:32,680 Of creating logistic regression model. 65 00:06:33,010 --> 00:06:38,710 Now let's move on to the second method, which is using a service model to create logistic regression. 66 00:06:40,690 --> 00:06:51,730 Now, one drawback of using a set model is that by default, set model do not use a consent form, which 67 00:06:51,730 --> 00:06:55,540 means that you are does zero will be zero by default. 68 00:06:57,120 --> 00:07:04,410 So to add concern, Tom, and do a lot more than we first need to do, concern them in a word, dependent 69 00:07:04,410 --> 00:07:05,100 variables. 70 00:07:07,160 --> 00:07:11,450 To do that, we will first import, said Smardon Lord Apia. 71 00:07:19,140 --> 00:07:20,160 As Esson. 72 00:07:25,220 --> 00:07:25,780 We'll run it. 73 00:07:32,850 --> 00:07:38,380 No, we'll create another door frame for our dependent variable, which is X under Scott Korsnes. 74 00:07:39,140 --> 00:07:39,620 This. 75 00:07:40,580 --> 00:07:43,850 Contain one single, call them as a constant. 76 00:07:47,130 --> 00:07:47,500 All right. 77 00:07:47,530 --> 00:07:51,910 Xander Scott wants equally to ascendent at constant. 78 00:08:04,560 --> 00:08:06,030 Again, you don't have to. 79 00:08:06,940 --> 00:08:14,590 Remember all this codes, you can copy this code and follow this code for your future projects. 80 00:08:16,760 --> 00:08:23,930 Let's again, we will see a sample of four X concent will right x kohn's da tagged. 81 00:08:33,650 --> 00:08:37,940 You can see there is one consent I did in two or X. 82 00:08:41,460 --> 00:08:47,220 Now to import the logistic regression classifier from a Setswana right? 83 00:08:47,640 --> 00:08:48,240 Import. 84 00:08:51,790 --> 00:08:55,930 Then sets modern, discreet, not discreet, modern. 85 00:09:04,640 --> 00:09:08,130 And we will import this as s.m. 86 00:09:10,950 --> 00:09:11,830 We'll run this. 87 00:09:14,410 --> 00:09:23,260 Now we need to screen our X and Y evitable and do a model, so we'll write logic lodged as our variable 88 00:09:23,260 --> 00:09:23,560 name. 89 00:09:26,190 --> 00:09:27,680 s.M, not logic. 90 00:09:35,870 --> 00:09:38,470 Here first, we need to mention our white variable. 91 00:09:38,960 --> 00:09:45,060 We will write why and then our X is X underscore Korsnes. 92 00:09:46,790 --> 00:09:50,390 Remember, we are adding a constant thumb and door X variable. 93 00:09:53,660 --> 00:09:55,420 And then we need to fit. 94 00:10:00,320 --> 00:10:03,230 Fit on this auto model, is that Audi? 95 00:10:05,580 --> 00:10:07,260 To see the somebody off a little more than. 96 00:10:09,070 --> 00:10:10,970 We'll wait logic, but somebody. 97 00:10:26,620 --> 00:10:31,480 Here you can see all the information about the logistic regression model. 98 00:10:32,290 --> 00:10:34,620 We are only getting this using a search model. 99 00:10:34,900 --> 00:10:37,480 We were not getting this using a Skillern. 100 00:10:40,950 --> 00:10:47,180 Here you can see at the bottom, we have Budos forces for consent. 101 00:10:47,310 --> 00:10:48,930 And second one is for Kreiss. 102 00:10:51,100 --> 00:10:59,500 Then in the first column, we go, if this are the coefficient, the coefficient of consent is also 103 00:10:59,500 --> 00:11:05,170 known as does zero and this the coefficient of price will be a lot to be done. 104 00:11:06,850 --> 00:11:11,010 We have a standard at our values corresponding to this coefficient. 105 00:11:11,950 --> 00:11:14,650 And then we have the Z value for this confusion. 106 00:11:18,570 --> 00:11:21,790 In the fourth column, we have the P-value. 107 00:11:24,160 --> 00:11:29,650 We will discuss about the standard error ZEWAIL You and the P-value. 108 00:11:29,950 --> 00:11:31,420 And our next theory lecture. 109 00:11:36,390 --> 00:11:41,790 On the top of this fable, you can see or deliver dependent variable. 110 00:11:42,130 --> 00:11:43,160 What is the model? 111 00:11:43,560 --> 00:11:51,060 And my third, remember, my third is maximum likelihood estimate that that's what it is. 112 00:11:51,200 --> 00:11:51,460 M. 113 00:11:51,530 --> 00:11:51,740 L. 114 00:11:51,930 --> 00:11:52,290 E. 115 00:11:53,610 --> 00:11:55,620 Then we have no observations. 116 00:11:55,740 --> 00:12:00,270 The residuals and other details of a logistic regression model. 117 00:12:02,320 --> 00:12:05,320 So remember, we are getting this information online. 118 00:12:05,410 --> 00:12:06,280 It start Smardon. 119 00:12:08,380 --> 00:12:12,660 And start small, we can see all this information about our model. 120 00:12:13,360 --> 00:12:20,440 But professionals use a Skillern for most of their work because of the high quality of documentation 121 00:12:20,830 --> 00:12:24,100 and the additional features that are present in Escalon.