WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.840 --> 00:00:12.540
Hi. In this video we will learn about the first hyper parameter tuning method.

1
00:00:12.800 --> 00:00:13.633
Uh, grid search,

2
00:00:18.080 --> 00:00:20.810
grid search is a very easy to understand method. Basically,

3
00:00:20.950 --> 00:00:22.770
you just put into a list, uh,

4
00:00:23.050 --> 00:00:25.450
multiple values for each parameter we want to test,

5
00:00:26.070 --> 00:00:29.170
and you evaluate your model for each combination of this parameter,

6
00:00:29.590 --> 00:00:34.270
and you choose, uh, the model, uh, where you get the best result. Uh,

7
00:00:34.270 --> 00:00:37.950
grid search and also other methods of hyper parameter tuning is used in

8
00:00:37.950 --> 00:00:42.740
combination with cross validation. For example,

9
00:00:43.150 --> 00:00:47.420
let's try, uh, the X GB classifier and let's test, uh,

10
00:00:47.420 --> 00:00:50.990
three parameters, maximum depth of the trees,

11
00:00:51.830 --> 00:00:55.230
a number of estimators and the learning grade.

12
00:00:57.770 --> 00:01:01.940
Then we use, uh, grid search, cross validation class from sticky learn,

13
00:01:02.390 --> 00:01:07.260
where we set the estimator, which, uh, parameters we want to optimize.

14
00:01:08.370 --> 00:01:10.670
Uh, then the parameter grid we want to test

15
00:01:12.940 --> 00:01:14.310
scoring metric to use.

16
00:01:15.370 --> 00:01:18.270
We can also specify number of course to use.

17
00:01:18.840 --> 00:01:23.410
Minus cut minus one stands for all CPUs.

18
00:01:25.690 --> 00:01:30.110
Number of faults in cross validation verbal C level.

19
00:01:30.490 --> 00:01:31.630
Uh, the higher the value,

20
00:01:31.850 --> 00:01:34.990
the more information about the model training will be printed.

21
00:01:37.520 --> 00:01:41.700
We also want to see the model performance on training data.

22
00:01:45.020 --> 00:01:50.000
And then we just call the feed method on the instantiated grid search CV object.

23
00:01:51.970 --> 00:01:54.190
We see here that we have, uh,

24
00:01:54.190 --> 00:01:59.030
96 combinations of these parameters. And with, uh,

25
00:01:59.140 --> 00:02:03.710
threefold cross validation, we basically, uh, train altogether,

26
00:02:04.090 --> 00:02:05.990
uh, 288 models.

27
00:02:10.000 --> 00:02:13.470
After the feed method, the hyper parameter search is, uh, complete.

28
00:02:13.610 --> 00:02:17.430
We can check it result exploring the, uh,

29
00:02:17.690 --> 00:02:21.240
CV results attribute. Uh,

30
00:02:21.260 --> 00:02:25.440
we see here a lot of detailed information about how much time the model training

31
00:02:25.590 --> 00:02:29.960
took, about the performance of the model. In each, uh,

32
00:02:29.960 --> 00:02:32.440
parameter combination on trained and test set.

33
00:02:33.140 --> 00:02:37.850
We also see the exact values of the parameters and so on.

34
00:02:42.010 --> 00:02:46.270
We can also check, uh, what was the best score. Uh,

35
00:02:46.270 --> 00:02:50.310
we can check also the best parameters, uh, and also we can get, uh,

36
00:02:50.490 --> 00:02:55.470
the best estimator objects, uh, which we can then evaluate on the test data.

37
00:02:55.730 --> 00:03:00.320
And we see it has accuracy of 95%

38
00:03:03.490 --> 00:03:07.830
in grid search. Uh, we can also use the pipeline, not only the main model.

39
00:03:08.980 --> 00:03:10.680
Uh, for example here, uh,

40
00:03:10.680 --> 00:03:14.920
we have a simple pipeline consisting of normalization with standard scaler

41
00:03:15.500 --> 00:03:16.333
and a model,

42
00:03:17.280 --> 00:03:21.700
our parameter grid may consist of the same parameters as before.

43
00:03:22.170 --> 00:03:26.420
Plus, we can explore what effect on the performance of the vol pipeline.

44
00:03:27.030 --> 00:03:31.500
We'll have, uh, different normalization methods like standard scaler,

45
00:03:31.720 --> 00:03:33.500
robust scaler, normalizer,

46
00:03:34.400 --> 00:03:37.220
and without using any normalization method at all.

47
00:03:38.910 --> 00:03:42.920
Instead of testing, uh, different scaling methods, uh, we could, for example,

48
00:03:42.990 --> 00:03:47.280
test only one normalization method, like the standard scaler and its parameters.

49
00:03:47.780 --> 00:03:50.520
Or we can test for multiple main models.

50
00:03:51.020 --> 00:03:54.360
We could add here to the parameter grid logistic regression,

51
00:03:54.600 --> 00:03:57.840
separate vector machines like G B M or other type of model.

52
00:04:03.200 --> 00:04:06.070
Let's check what is the best pipeline we see, uh,

53
00:04:06.140 --> 00:04:10.110
that with the standard scaler and with these parameters of the main model.

54
00:04:17.110 --> 00:04:20.810
In our next video, we will learn more about a randomized search.
