1 00:00:00,150 --> 00:00:00,600 Hello. 2 00:00:00,870 --> 00:00:01,650 And this will you. 3 00:00:01,940 --> 00:00:10,500 We will create a very simple single Perceptron model to classify flower species depending on their Bitel 4 00:00:10,800 --> 00:00:11,880 length and pattern. 5 00:00:15,030 --> 00:00:19,650 We will be using a Skillern to create this single Perceptron model. 6 00:00:20,730 --> 00:00:28,080 In the latter part of this course, we will use Get US and 10 SAP flow to create multi-level Perceptron 7 00:00:28,080 --> 00:00:34,770 models, as Skillern is a very popular machine learning liablity for Python. 8 00:00:36,510 --> 00:00:46,650 It is the go to library to create regression classification decision trees or as we are models, we 9 00:00:46,650 --> 00:00:50,160 have separate lectures on all this machine learning models. 10 00:00:50,640 --> 00:00:57,000 So if you are interested in learning any one of these, you can go ahead and check out what courses 11 00:00:57,090 --> 00:01:01,350 on regression classification be Sentry's and SVM. 12 00:01:03,620 --> 00:01:06,260 So let's start first. 13 00:01:06,470 --> 00:01:08,750 We will import numbers and find us. 14 00:01:10,010 --> 00:01:12,530 Now, if you have installed Anakonda. 15 00:01:14,190 --> 00:01:17,550 There is no need to install a skillern separately. 16 00:01:18,300 --> 00:01:19,860 You just have to import Eskinder. 17 00:01:20,970 --> 00:01:29,400 But in case you are facing any error in importing a Skillern, you can install it using BEP or Condah 18 00:01:29,400 --> 00:01:29,910 installed. 19 00:01:30,600 --> 00:01:32,550 So just run this. 20 00:01:32,550 --> 00:01:36,270 Come on, Pip, install a Skillern in your command prompt. 21 00:01:37,680 --> 00:01:46,080 You can open your command prompt by pressing windows odd and write CMB and that one come on and hit 22 00:01:46,080 --> 00:01:49,110 enter there in the command prompt. 23 00:01:49,260 --> 00:01:53,790 You can write this code and execute it to install Escalon. 24 00:01:55,110 --> 00:01:57,620 What else you can directly lead on this code? 25 00:01:58,090 --> 00:02:03,030 And despite the notebook and this will also install Escalon for you. 26 00:02:04,440 --> 00:02:06,540 So if you have installed a Skillern. 27 00:02:07,770 --> 00:02:09,990 First, we will load iris data. 28 00:02:11,880 --> 00:02:14,220 There are various CSP files out there. 29 00:02:14,400 --> 00:02:17,640 You can also import those see as we file to load this data. 30 00:02:19,230 --> 00:02:25,140 But as Skillern have some predefined datasets and we will load our ideas data from there. 31 00:02:26,730 --> 00:02:29,650 So just right from Eskil under datasets. 32 00:02:29,820 --> 00:02:30,830 Import load. 33 00:02:31,110 --> 00:02:32,250 Underscore itis. 34 00:02:32,880 --> 00:02:37,220 And then we are saving the world IRI's data into this variable iris. 35 00:02:38,930 --> 00:02:40,200 So just run this. 36 00:02:42,240 --> 00:02:49,040 Now, let's take a look at the data, you can see there are four columns. 37 00:02:51,230 --> 00:02:59,780 To call, said Sepur Land SepĂșlveda by the land and Paton's with, as I have said earlier this year, 38 00:02:59,790 --> 00:03:01,950 data of different types of flowers. 39 00:03:02,760 --> 00:03:06,140 There are three different types of flowers, Sentosa. 40 00:03:06,920 --> 00:03:08,860 What's the color virginica? 41 00:03:09,420 --> 00:03:13,600 And for each of this flower, we have their Sepur length SepĂșlveda. 42 00:03:13,890 --> 00:03:15,120 But the length and petals. 43 00:03:16,860 --> 00:03:25,680 So here we have this four variables and that category is stored in Iris Dort Target. 44 00:03:26,970 --> 00:03:34,740 So in our example, we want to create a Perceptron model which would identify whether the flower what 45 00:03:34,740 --> 00:03:42,210 is Sentosa or not using by Dalvik and by the length as the independent variables. 46 00:03:44,400 --> 00:03:47,310 If you want, you can take all the four variables. 47 00:03:47,840 --> 00:03:54,480 But for example, we are just taking these two variables to predict where the flower is Towser or not. 48 00:03:56,130 --> 00:04:01,650 So we want our independent variable to be this petal length and petal look. 49 00:04:02,550 --> 00:04:07,300 We will store this information in another variable which we are calling X. 50 00:04:08,460 --> 00:04:11,250 We are defining X as itis DOT data. 51 00:04:11,640 --> 00:04:15,270 And here we just want the third and fourth column. 52 00:04:15,360 --> 00:04:17,510 That's why we have returned to comment three. 53 00:04:18,450 --> 00:04:21,060 If you remember, the indexing starts with zero. 54 00:04:21,540 --> 00:04:24,930 So the last two columns are two and three. 55 00:04:25,560 --> 00:04:26,640 Just run this. 56 00:04:27,780 --> 00:04:29,970 So over X variable is now ready. 57 00:04:31,040 --> 00:04:34,070 Now let's just look at the target variable. 58 00:04:36,240 --> 00:04:44,820 Here you can see we have different categories, zero one and two zero percent for Sentosa. 59 00:04:45,390 --> 00:04:50,070 One sentence for what Ziggler and two stands for Virginica. 60 00:04:51,760 --> 00:04:57,270 Now, if you have some machine learning knowledge, you may know that to create classification more 61 00:04:57,270 --> 00:05:00,780 than what y variable should be in the form of zero and one. 62 00:05:02,190 --> 00:05:11,910 So ideally we want one and all these records where the flower is set, Oza and zero and all this records 63 00:05:12,270 --> 00:05:15,420 where the flower is vertical or virginica. 64 00:05:16,760 --> 00:05:23,000 So let's just convert this target, we able using some basic operations first. 65 00:05:25,130 --> 00:05:29,660 Let's convert this target variable in the form of true and false. 66 00:05:30,450 --> 00:05:34,430 We want to where the flowery sentosa. 67 00:05:34,820 --> 00:05:37,400 That is the value of target is zero. 68 00:05:38,090 --> 00:05:42,770 And we want false where the flower is Virginica or Cicala. 69 00:05:43,400 --> 00:05:47,690 That is the numerical value is one or two. 70 00:05:49,850 --> 00:05:52,300 So let's just blend this. 71 00:05:52,310 --> 00:05:52,730 Come on. 72 00:05:53,060 --> 00:05:57,640 We are just checking whether the target is equal to zero or not. 73 00:05:58,280 --> 00:06:00,610 If the target is zero, we will get group. 74 00:06:00,800 --> 00:06:03,950 And if the target is not equal to zero, we will get false. 75 00:06:04,040 --> 00:06:05,000 Let's run this. 76 00:06:08,180 --> 00:06:09,980 Now let's look at our very well. 77 00:06:11,650 --> 00:06:18,250 You can see we have converted zeros, two crew and one or two boot false. 78 00:06:20,810 --> 00:06:25,820 Now, in the next step, we want to convert this windfalls falls to one zero. 79 00:06:26,330 --> 00:06:28,610 We want one in place of all. 80 00:06:28,910 --> 00:06:32,760 And we want zero in place of false. 81 00:06:34,670 --> 00:06:39,730 So we will just use as type method and we will convert it to. 82 00:06:39,990 --> 00:06:45,670 And so just on and on look at our way variable. 83 00:06:47,000 --> 00:06:54,560 So as you can see now, our way variable is an array with one and zero. 84 00:06:55,070 --> 00:06:58,900 One means that Dorsa and zero means not sentosa. 85 00:07:02,390 --> 00:07:07,250 Now let's look at our X variable before creating a Perceptron model. 86 00:07:09,350 --> 00:07:16,340 You can see our X variable is a two dimensional array with by the length and patella with. 87 00:07:20,360 --> 00:07:22,880 No one would extend Liberty Bell, said Brady. 88 00:07:23,960 --> 00:07:30,260 We just have to create our Perceptron model and dream that model using this X and Y variables. 89 00:07:33,230 --> 00:07:40,110 We can create a single Perceptron more than using a Skillern, but to create MLP on my level, but it's 90 00:07:40,110 --> 00:07:42,690 separate more than we have to use Cadeaux Intensive. 91 00:07:44,150 --> 00:07:48,260 We will be looking at l.P in the later part of this Goetze. 92 00:07:49,560 --> 00:07:54,920 But now we will create this sub growth model using Escalon only. 93 00:07:58,270 --> 00:08:02,950 Now first we need to import Perceptron from Eskil and Autoline anymore. 94 00:08:02,990 --> 00:08:06,330 Then let's just import it. 95 00:08:06,990 --> 00:08:10,950 And you can also look at the documentation using this link. 96 00:08:11,850 --> 00:08:16,380 This Dubai term notebook is also shared in the resources section of this video. 97 00:08:16,890 --> 00:08:20,940 So you can download it and learn it if you want to practice. 98 00:08:23,100 --> 00:08:27,090 So this is the official document of Perceptron in Skillern. 99 00:08:28,360 --> 00:08:34,380 You can look at all the parameters which we can give, the first one is the penalty. 100 00:08:35,500 --> 00:08:42,400 If you remember, in linear regression, there are regularization terms, L1, a clue also known as 101 00:08:42,460 --> 00:08:43,550 LASO and Rich. 102 00:08:45,490 --> 00:08:50,390 You can also give us a thought that is the variable we use for regularization. 103 00:08:51,970 --> 00:08:54,880 Then there are different other hyper parameters. 104 00:08:54,970 --> 00:08:59,230 We will just stick to basic before hyper parameters. 105 00:08:59,860 --> 00:09:01,870 But you can look at it if you want. 106 00:09:02,350 --> 00:09:09,130 These are just some very basic parameters that we get with most of the machine learning algorithms. 107 00:09:11,240 --> 00:09:19,640 Now, as with any other on machine learning, more than we first have to create an object of that algorithm, 108 00:09:20,150 --> 00:09:29,300 then we have to fit over X and Y variables and to that object and then we can use that object to predict 109 00:09:29,330 --> 00:09:30,910 the future values of way. 110 00:09:32,240 --> 00:09:37,430 So first, let's create an object that is Perceptron classifier. 111 00:09:37,970 --> 00:09:47,510 We are naming Autobody Willis, but underscored see L.F. and then we are using Perceptron that we have 112 00:09:47,510 --> 00:09:51,450 just imported and we are giving only one hyper parameter. 113 00:09:51,560 --> 00:09:54,020 That is a random mistake to equate to 42. 114 00:09:54,770 --> 00:09:59,330 This is basically to reproduce the same result whenever we run this model. 115 00:09:59,840 --> 00:10:04,550 So if you give random set, you will always going to get the same result. 116 00:10:06,320 --> 00:10:09,050 Giving this hyper parameter is not mandatory. 117 00:10:09,080 --> 00:10:11,840 You can skip that also if you want. 118 00:10:12,620 --> 00:10:19,610 And in the next lane, we are putting our X and Y variables into this object. 119 00:10:20,030 --> 00:10:21,380 So let's find this. 120 00:10:23,480 --> 00:10:24,800 So what model is screened? 121 00:10:25,400 --> 00:10:27,500 You can get the values of before you type in. 122 00:10:27,540 --> 00:10:29,300 But I might add here if you want. 123 00:10:32,030 --> 00:10:35,090 Now, let's clear the value using overclassify, our object. 124 00:10:35,820 --> 00:10:37,940 We can just use DOT, predict my. 125 00:10:38,430 --> 00:10:45,870 So this is the word object and we are using DOT predict and we are giving our independent and variable, 126 00:10:46,020 --> 00:10:49,020 which is X as an input. 127 00:10:51,060 --> 00:10:52,170 Let's do that. 128 00:10:55,620 --> 00:10:58,350 You can see this are the predicted values. 129 00:10:58,740 --> 00:11:02,970 We can compare this predicted values with the actual values. 130 00:11:04,200 --> 00:11:06,390 There is no need to manually do that. 131 00:11:07,020 --> 00:11:08,580 That isn't another function. 132 00:11:08,760 --> 00:11:18,270 That is accuracy scored available in Escalon, which will give us the accuracy of what prediction accuracy 133 00:11:18,270 --> 00:11:25,830 score vary between zero and one zero means zero percent accuracy, which means all the predictions are 134 00:11:25,830 --> 00:11:26,130 wrong. 135 00:11:26,820 --> 00:11:31,340 And one means hundred percent accuracy, which meant all the predictions are right. 136 00:11:32,970 --> 00:11:39,750 So let's just first import accuracy score from a scalar, not my cricks. 137 00:11:40,350 --> 00:11:42,960 And then we are going to use accuracy score. 138 00:11:43,920 --> 00:11:46,020 And here there are two arguments. 139 00:11:46,050 --> 00:11:48,330 First, we have to provide the actual values. 140 00:11:48,570 --> 00:11:52,020 And in the next argument, we have put away the predicted values. 141 00:11:52,770 --> 00:11:55,590 So what actual values are restored in just five variable? 142 00:11:56,220 --> 00:11:57,570 And the predicted values? 143 00:11:57,750 --> 00:12:00,120 We have restored in VI underscore pride. 144 00:12:00,780 --> 00:12:05,550 So let's get the accuracy score of forward predictions. 145 00:12:06,840 --> 00:12:11,820 So the accuracy here is one that is hundred percent accuracy or what? 146 00:12:11,820 --> 00:12:18,720 Perceptron was able to identify the speci of the float with 100 percent accuracy. 147 00:12:20,490 --> 00:12:22,290 Now, this is a very simple model. 148 00:12:22,350 --> 00:12:28,320 Usually we don't use Perceptron for any regression or classification tasks. 149 00:12:29,590 --> 00:12:34,530 We usually go for machine learning techniques where the data is not falling. 150 00:12:34,700 --> 00:12:38,680 And in context, Petten and we use really well for an LP. 151 00:12:38,960 --> 00:12:39,340 We're. 152 00:12:40,440 --> 00:12:42,810 The details following a very complex pattern. 153 00:12:43,740 --> 00:12:49,030 Usually you will never find yourself using Perceptron and business settings. 154 00:12:49,470 --> 00:12:51,360 But this is just an introduction. 155 00:12:51,690 --> 00:12:58,100 And we want you to give just some basic idea about running Perceptron models using Escolar. 156 00:12:59,910 --> 00:13:03,900 Now, after training your mother, you will get these two attributes. 157 00:13:04,200 --> 00:13:05,250 That is the coefficient. 158 00:13:05,360 --> 00:13:06,510 And then Sept. 159 00:13:08,270 --> 00:13:13,820 Basically over Perceptron is dividing this space using linear regression line. 160 00:13:14,360 --> 00:13:16,130 So this is the coefficient. 161 00:13:17,030 --> 00:13:20,270 And this is the intercept of that line. 162 00:13:21,440 --> 00:13:31,130 So your equation of that line will be four minus one point four times by the length minus two point 163 00:13:31,130 --> 00:13:31,790 two times. 164 00:13:31,810 --> 00:13:32,500 But Elphick. 165 00:13:34,750 --> 00:13:43,990 So if you want to create that line, you can use coefficient and intercept values to do that, and you 166 00:13:43,990 --> 00:13:49,510 can also see the impact of our different variables on the Y variable. 167 00:13:50,410 --> 00:13:55,360 So this coefficient is giving you the impact of each of those variables. 168 00:13:55,570 --> 00:13:59,350 This is the impact of the land and this the impact of pattern. 169 00:14:01,210 --> 00:14:02,650 That's all for this lecture. 170 00:14:03,970 --> 00:14:09,880 Next, we will look at tensor flow and get us to create our MLP model. 171 00:14:10,210 --> 00:14:10,600 Thank you.