WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.860 --> 00:00:11.880
Hi. In this video we will create a multi classification model.

1
00:00:12.070 --> 00:00:13.200
With live G B M.

2
00:00:16.200 --> 00:00:20.870
We'll use the same data set as for clustering, uh, the 21 types of attacks.

3
00:00:21.570 --> 00:00:26.230
Uh, this data set has 500 K observations and 42 columns.

4
00:00:26.850 --> 00:00:30.310
We have already prepared it, uh, so we can split, uh,

5
00:00:30.330 --> 00:00:34.070
the data into train and test set with, uh,

6
00:00:34.070 --> 00:00:35.830
30% to be the test data.

7
00:00:36.870 --> 00:00:40.010
We also specify here the random state parameter,

8
00:00:40.930 --> 00:00:45.000
which basically specifies the random seed number during sampling.

9
00:00:45.670 --> 00:00:49.200
When we call these methods, trying to split with the same number again,

10
00:00:49.730 --> 00:00:50.920
we'll get the same sample.

11
00:00:51.980 --> 00:00:56.200
We have also specified here the stratify parameter

12
00:00:56.930 --> 00:00:59.380
because we want cut.

13
00:01:01.220 --> 00:01:05.960
We have also specified the stratify parameter because we want that, uh,

14
00:01:06.070 --> 00:01:10.960
both trained and test set will cover all 21 types of attacks.

15
00:01:11.850 --> 00:01:14.070
If we would not, uh, cut,

16
00:01:15.290 --> 00:01:17.910
if we would not stratify our sample on the target,

17
00:01:18.450 --> 00:01:20.390
it may happen that in the train set,

18
00:01:20.610 --> 00:01:23.910
we will not have the same classes as in the test set.

19
00:01:28.530 --> 00:01:30.910
Now let's create our live G B A model.

20
00:01:31.250 --> 00:01:34.430
We will use a default parameter except these two.

21
00:01:35.610 --> 00:01:37.830
We have to specify our objective.

22
00:01:38.410 --> 00:01:40.910
We are trying to solve a multi classification problem,

23
00:01:41.490 --> 00:01:45.350
and we know that our data set is highly imbalanced,

24
00:01:45.880 --> 00:01:50.150
where most of the observations are smurf or Neptune attack

25
00:01:50.810 --> 00:01:52.910
and normal connections. Uh,

26
00:01:52.930 --> 00:01:56.710
so we have to specify balanced to class weight parameter.

27
00:01:57.730 --> 00:01:58.020
Uh,

28
00:01:58.020 --> 00:02:02.870
this way the I G B M knows we want that all target classes must

29
00:02:02.870 --> 00:02:07.470
be treated equally important. You could set, uh,

30
00:02:07.500 --> 00:02:12.190
here the weights for each attack. That way that the most critical attacks,

31
00:02:12.330 --> 00:02:12.550
uh,

32
00:02:12.550 --> 00:02:17.510
with the most damage would have much higher weight than other type of attacks or

33
00:02:17.510 --> 00:02:21.880
the normal connections. Uh, these, uh,

34
00:02:21.890 --> 00:02:26.280
three classes, which I mentioned make, uh, 96% of the dataset.

35
00:02:27.790 --> 00:02:31.090
In case of, uh, other algorithm, which, uh,

36
00:02:31.090 --> 00:02:35.410
does not support this parameter, you would've to manually balance the dataset,

37
00:02:35.470 --> 00:02:38.290
for example, using the imbalanced learn library.

38
00:02:41.910 --> 00:02:43.570
Now let's fit and evaluate the model.

39
00:02:48.180 --> 00:02:49.410
Don't worry about this output.

40
00:02:52.780 --> 00:02:56.920
We see a very nice performance of 99.9%,

41
00:02:57.580 --> 00:03:01.640
but we have to evaluate it closer using classification report and, uh,

42
00:03:01.700 --> 00:03:02.640
the confusion metrics.

43
00:03:06.900 --> 00:03:09.760
We see that in the most frequent classes,

44
00:03:10.020 --> 00:03:11.920
it has an excellent performance.

45
00:03:12.060 --> 00:03:16.990
And also on the less frequent classes in the rarest classes, it struggles a bit,

46
00:03:16.990 --> 00:03:21.670
uh, but it is not so bad as well. But also it is harder to evaluate, uh,

47
00:03:21.740 --> 00:03:23.150
because they are so rare.

48
00:03:26.970 --> 00:03:29.180
Here we can also export the confusion metrics.

49
00:03:29.540 --> 00:03:34.180
I made it this way because the confusion matrix display in stickler did not

50
00:03:34.500 --> 00:03:38.860
properly visualize the metrics with, uh, more target classes. And

51
00:03:41.440 --> 00:03:45.060
we see, for example here that, uh,

52
00:03:45.240 --> 00:03:50.060
the model misclassified, uh, both, uh, F T P right attacks,

53
00:03:50.910 --> 00:03:53.570
uh, with the P H F attacks

54
00:03:57.900 --> 00:03:59.550
regarding model persistence.

55
00:03:59.810 --> 00:04:04.350
We can use job leap or pickle Library to save and load the train model to this.

56
00:04:04.890 --> 00:04:05.723
And

57
00:04:08.620 --> 00:04:13.470
also we predict proba and predict we can get the predictions and predicted

58
00:04:13.470 --> 00:04:14.303
probabilities.

59
00:04:15.200 --> 00:04:19.740
The probabilities for all classes in one observations always sums to one.

60
00:04:26.720 --> 00:04:28.330
Okay, that was it for this module.

61
00:04:28.850 --> 00:04:31.770
I hope it was interesting and that we have learned something new.

62
00:04:32.460 --> 00:04:33.370
Let's summarize it.

63
00:04:34.890 --> 00:04:39.190
We went through a lot of things we have learned about the Cains clustering

64
00:04:39.190 --> 00:04:40.023
algorithm.

65
00:04:40.210 --> 00:04:44.510
We trained a model and evaluated the quality of clustering with geo metrics

66
00:04:45.130 --> 00:04:47.550
in order to find proper number of clusters.

67
00:04:49.050 --> 00:04:51.950
We have learned the basics about the XG boost algorithm,

68
00:04:52.610 --> 00:04:57.470
and we have created a binary model to predict if an email is a spam or

69
00:04:57.470 --> 00:05:01.770
not. We have learned the basics of a live G B M algorithm,

70
00:05:02.720 --> 00:05:07.060
and we created a multi classification model to classify connections to various

71
00:05:07.160 --> 00:05:07.993
attack types.

72
00:05:08.930 --> 00:05:13.590
We have learned also how to best evaluate the model using cross validation

73
00:05:13.910 --> 00:05:18.310
technique. We also learned about, uh, seeking learns,

74
00:05:18.710 --> 00:05:22.670
transformers, estimators, and how to organize them into a pipeline.

75
00:05:23.770 --> 00:05:28.630
And we also learned how to search for the best hyper parameters of the model and

76
00:05:28.950 --> 00:05:30.710
pipeline using grid search,

77
00:05:30.960 --> 00:05:34.870
randomized search and tune search with a more advanced optimizer.

78
00:05:36.470 --> 00:05:40.000
Next, we'll start our new module focused on Jupiter Hub.
