1 00:00:00,266 --> 00:00:02,666 So let's go to a new tab. 2 00:00:02,666 --> 00:00:03,233 All right. 3 00:00:03,233 --> 00:00:06,433 And then let's just type because I'm going to show you a trick actually. 4 00:00:06,666 --> 00:00:11,100 Let's just type scikit learn scikit learn just scikit learn. 5 00:00:11,100 --> 00:00:14,366 And then let's go to the first link and you will be 6 00:00:14,366 --> 00:00:18,466 on the welcoming page of scikit learn which by the way looks super nice. 7 00:00:18,933 --> 00:00:21,433 And then I'm going to show you something very interesting. 8 00:00:21,433 --> 00:00:25,100 I'm going to show you the whole API of the scikit learn library. 9 00:00:25,200 --> 00:00:28,900 You know, the API is the whole library containing all the modules 10 00:00:29,000 --> 00:00:31,833 and inside all the functions and the classes. 11 00:00:31,833 --> 00:00:32,166 All right. 12 00:00:32,166 --> 00:00:35,500 So these are all the modules starting from the base one. 13 00:00:35,500 --> 00:00:41,000 And the one I actually want to show you right now is the metrics module. 14 00:00:41,200 --> 00:00:45,000 The metrics module which we'll find by scrolling down a bit 15 00:00:45,400 --> 00:00:49,933 scrolling down a bit more until we find them, should find it very quickly. 16 00:00:49,966 --> 00:00:52,966 There we go. Scikit learn metrics. 17 00:00:53,300 --> 00:00:53,666 All right. 18 00:00:53,666 --> 00:00:56,666 So as you might guess, this is the module that contains 19 00:00:56,666 --> 00:01:00,166 all the metrics of machine learning models, 20 00:01:00,433 --> 00:01:04,633 which therefore includes classification models which we'll see in part three 21 00:01:04,800 --> 00:01:08,366 and what we are interested in now, the regression models 22 00:01:08,433 --> 00:01:11,433 and in the regression models here are the metrics. 23 00:01:11,666 --> 00:01:14,066 Let's have a look. Well you have many of them. 24 00:01:14,066 --> 00:01:18,466 You have the explained variance score the max error, the mean absolute error. 25 00:01:18,600 --> 00:01:20,966 The mean squared error. The mean squared look error. 26 00:01:20,966 --> 00:01:22,366 You know you have many of them. 27 00:01:22,366 --> 00:01:26,100 But the one we will use now after it is intuition. 28 00:01:26,100 --> 00:01:29,100 Lecture is of course the r squared. 29 00:01:29,200 --> 00:01:32,200 The r squared score which is of course the coefficient 30 00:01:32,233 --> 00:01:36,166 of determination regression score function okay. 31 00:01:36,200 --> 00:01:38,200 So there is not the adjusted r squared. 32 00:01:38,200 --> 00:01:40,366 But that's totally fine. The r squared is fine. 33 00:01:40,366 --> 00:01:44,566 You will perfectly be able to evaluate the performance and mostly compare 34 00:01:44,566 --> 00:01:48,100 the performances of your regression models to select the best one. 35 00:01:48,300 --> 00:01:52,466 So let's click this metric here and we will find, 36 00:01:52,566 --> 00:01:56,066 well the name of the function which we will use. 37 00:01:56,100 --> 00:01:59,233 There you go to measure the r squared coefficient 38 00:01:59,400 --> 00:02:03,000 for each of our different regression models here. 39 00:02:03,166 --> 00:02:04,766 And that's exactly what you have 40 00:02:04,766 --> 00:02:08,166 at the end is less L which I didn't want to reveal until now. 41 00:02:08,433 --> 00:02:13,366 That's indeed R2 score function, which allows us to evaluate 42 00:02:13,366 --> 00:02:15,833 the model performance of your regression model 43 00:02:15,833 --> 00:02:18,833 with the r squared coefficient of determination. 44 00:02:19,066 --> 00:02:19,533 All right. 45 00:02:19,533 --> 00:02:22,366 So you have the same in each regression models. 46 00:02:22,366 --> 00:02:26,333 You know R2 score right R2 score here as well. 47 00:02:26,333 --> 00:02:27,933 That's exactly the same code actually 48 00:02:27,933 --> 00:02:31,666 because you know I made this code templates 100% generic. 49 00:02:31,933 --> 00:02:33,133 So there you go. 50 00:02:33,133 --> 00:02:37,666 You have the R2 score function measuring the coefficient 51 00:02:37,966 --> 00:02:40,966 of determination meaning the r squared. 52 00:02:41,000 --> 00:02:41,533 And you know, it's 53 00:02:41,533 --> 00:02:45,433 still in the assumption that I had no idea on how to implement the r squared score. 54 00:02:45,433 --> 00:02:47,033 Well here. What did I do? 55 00:02:47,033 --> 00:02:50,333 I actually went to the examples and there you go. 56 00:02:50,333 --> 00:02:54,466 I just took this line of code, which clearly means that we're 57 00:02:54,466 --> 00:02:58,800 measuring the r squared score between, you know, the vector of real results. 58 00:02:58,800 --> 00:03:00,866 And your vector of predictions. 59 00:03:00,866 --> 00:03:02,300 So I just took this. 60 00:03:02,300 --> 00:03:06,300 And then of course I took this before in order to import, of course the R2 score 61 00:03:06,300 --> 00:03:09,900 function from the metrics module from scikit learn and so that's why, 62 00:03:09,900 --> 00:03:13,733 you know in each implementation that's exactly what you see here. 63 00:03:13,933 --> 00:03:18,533 I import first R2 score function from the metrics module by scikit learn. 64 00:03:18,733 --> 00:03:22,333 And then I call this R2 score function on the white test 65 00:03:22,333 --> 00:03:24,033 which contains the real results. 66 00:03:24,033 --> 00:03:27,366 You know, the real values of the dependent variable in the test set, 67 00:03:27,633 --> 00:03:32,233 and y pred contain the predictions of the same observations in the test set. 68 00:03:32,433 --> 00:03:33,266 All right. 69 00:03:33,266 --> 00:03:36,233 So that's only what you would have to do in order to figure out 70 00:03:36,233 --> 00:03:40,266 how to, you know, evaluate the model performance of regression models. 71 00:03:40,266 --> 00:03:40,800 Right. 72 00:03:40,800 --> 00:03:43,866 So that's why I really want you to have the reflex to look 73 00:03:43,866 --> 00:03:47,033 at the documentation and quickly find the information you need. 74 00:03:47,633 --> 00:03:48,066 All right. 75 00:03:48,066 --> 00:03:51,066 And now, my friends, time for the exciting step. 76 00:03:51,133 --> 00:03:53,833 I'm talking of course about the demo. 77 00:03:53,833 --> 00:03:57,233 So let's just take a quick little break and we'll start directly 78 00:03:57,233 --> 00:03:58,300 in the next tutorial.