1
00:00:00,480 --> 00:00:06,780
Now, let's take a look at generating our classification report using PyTorch, so this might seem a

2
00:00:06,780 --> 00:00:12,090
bit trickier and a bit more difficult than it's done with Keros, and that's mainly because when we

3
00:00:12,090 --> 00:00:15,960
get our predictions out of it, it's basically in a PyTorch tensor.

4
00:00:16,350 --> 00:00:22,350
So we have to convert it back to an umpire so that we can use it with Skillings confusion matrix.

5
00:00:22,650 --> 00:00:25,640
So to do that, we have to create some blank tenses here.

6
00:00:25,650 --> 00:00:29,760
So we created by doing it touched on zeros so that zero here.

7
00:00:30,270 --> 00:00:31,800
And we just said the type.

8
00:00:32,580 --> 00:00:35,460
And we also said we could setting it, sending it to the CPU.

9
00:00:35,970 --> 00:00:38,580
That's because we want to convert it to an umpire afterward.

10
00:00:39,180 --> 00:00:40,860
So this is fine.

11
00:00:40,860 --> 00:00:41,850
This is the labels.

12
00:00:41,850 --> 00:00:44,700
And so this is a prediction list and this is to leave a list here.

13
00:00:45,270 --> 00:00:50,100
And the reason why we want boards is because we want to get the ground truth tables here and prediction

14
00:00:50,100 --> 00:00:50,700
labels here.

15
00:00:51,240 --> 00:00:53,310
So this should be standard.

16
00:00:53,610 --> 00:00:58,260
Now, if you if you should be familiar with this, we take our test loader, we loop through it, we

17
00:00:58,260 --> 00:01:01,670
get the inputs, we get the classes, send it to the device.

18
00:01:01,680 --> 00:01:04,230
I call this previously images and labels previously.

19
00:01:04,230 --> 00:01:10,890
So just remember that then passage to the network, get the outputs, get to Preds here and then this

20
00:01:10,890 --> 00:01:11,400
list here.

21
00:01:11,670 --> 00:01:15,470
What we do, we basically we use tau shortcut.

22
00:01:15,480 --> 00:01:16,850
That's a concatenated.

23
00:01:16,860 --> 00:01:19,800
That's how we append the results inside of this loop.

24
00:01:20,430 --> 00:01:27,000
And we just use Preds Dot View minus one is in brackets here to the CPU, and this is how we converted

25
00:01:27,000 --> 00:01:28,290
to that non-priority.

26
00:01:29,010 --> 00:01:30,990
And basically, we can extract it here.

27
00:01:31,020 --> 00:01:35,130
Well, it's not an emperor yet, but it's just in a format that can be converted to an umpire quite

28
00:01:35,130 --> 00:01:35,520
easily.

29
00:01:36,150 --> 00:01:39,210
So we just use towards Starkman Cat to a touch to a cat.

30
00:01:39,210 --> 00:01:42,690
Sorry to concatenate our results here.

31
00:01:43,320 --> 00:01:48,830
And then when we want to use it into the confusion matrix, we can just simply apply the display to

32
00:01:48,840 --> 00:01:49,830
extensive file here.

33
00:01:50,280 --> 00:01:54,820
Tottenham pay to convert it into an umpire to generate our results.

34
00:01:54,870 --> 00:02:02,310
So let's take a look at this and do we do we get a cool confusion matrix here that we did previously

35
00:02:02,310 --> 00:02:02,900
with Cass?

36
00:02:03,510 --> 00:02:03,930
No.

37
00:02:04,890 --> 00:02:08,340
Just in case you forgot, this is how you analyze the confusion matrix.

38
00:02:08,730 --> 00:02:10,440
So you can interpret the results better.

39
00:02:10,950 --> 00:02:15,870
And again, similarly, we have a fancy plot for a confusion matrix where we didn't go through this

40
00:02:15,870 --> 00:02:16,290
could.

41
00:02:16,290 --> 00:02:21,210
But I'll go through the results here so you can see we have target names, which is zero to nine.

42
00:02:21,690 --> 00:02:28,140
We have a confusion matrix that we got from the output previously and target names, and we just actually

43
00:02:28,140 --> 00:02:29,700
we didn't run the function above.

44
00:02:29,850 --> 00:02:37,650
So remember to run the function above here and now we can run this block of good loops to generate our

45
00:02:37,740 --> 00:02:41,820
nice, nicely plotted, colorful confusion matrix here.

46
00:02:42,960 --> 00:02:48,330
And also, we can look at output class accuracy using exactly the same thing, but we did previously

47
00:02:48,330 --> 00:02:48,880
with Keros.

48
00:02:49,370 --> 00:02:52,830
That's that's mainly because we're using the output of the confusion matrix here.

49
00:02:53,370 --> 00:02:56,580
And so we can run this and get the accuracy for each class.

50
00:02:56,580 --> 00:03:01,290
And you can see this model is performing quite well, much better than our Keros model that we trained

51
00:03:01,290 --> 00:03:01,680
before.

52
00:03:02,370 --> 00:03:07,950
And now we can take a look at over classification report, which is again quite simple as well.

53
00:03:08,370 --> 00:03:13,620
We just load it imported from ASCII with Matrix here, the classification report.

54
00:03:14,160 --> 00:03:17,760
We take the labels to ground truth labels converted to Nampai.

55
00:03:18,420 --> 00:03:24,270
Take the prediction list with the NumPy, and that's basically it, and we can run that code and get

56
00:03:24,270 --> 00:03:30,690
the results right here so we could get a precision or recall o f one o support, which is a total number

57
00:03:30,690 --> 00:03:36,870
of classes or overall accuracy, as well as a macro average and a weighted average as well, which isn't

58
00:03:36,870 --> 00:03:38,050
really that important to look at.

59
00:03:38,070 --> 00:03:39,340
I didn't mention this previously.

60
00:03:39,780 --> 00:03:41,970
However, it gets me to look at accuracy right here.

61
00:03:42,240 --> 00:03:42,570
OK.

62
00:03:43,320 --> 00:03:47,370
And this is a summary of how you interpret the recall.

63
00:03:47,460 --> 00:03:54,060
The precision, as well as some notes on what I recall with precision means and what low recall and

64
00:03:54,060 --> 00:03:55,650
high precision means as well.

65
00:03:56,250 --> 00:04:02,520
So that's it for this lesson, and I hope you enjoyed this analysis with pathos and Keros and the next

66
00:04:02,520 --> 00:04:06,690
lessons, we're going to take a look at overfitting and generalization.

67
00:04:07,080 --> 00:04:10,800
This should help you understand what we look for when we train neural networks.

68
00:04:11,010 --> 00:04:13,050
So thank you and I'll see you in the next lesson.

69
00:04:13,500 --> 00:04:13,770
But.
