1
00:00:00,020 --> 00:00:03,800
Hello everyone, and welcome to this session on evaluation and Testing.

2
00:00:03,830 --> 00:00:09,770
So so far we've built and trained our model and we have, um, reasonable performance.

3
00:00:09,770 --> 00:00:12,170
Let's go ahead and evaluate this model.

4
00:00:12,170 --> 00:00:14,180
So here we have model evaluate.

5
00:00:14,180 --> 00:00:17,960
And then we could pass in um our test data.

6
00:00:17,960 --> 00:00:20,990
So test data set we run that.

7
00:00:22,130 --> 00:00:26,960
The result we get now is about 93% for the test data set.

8
00:00:26,960 --> 00:00:30,410
So that's the accuracy for our test data set.

9
00:00:30,410 --> 00:00:32,090
Now let's dive into prediction.

10
00:00:32,090 --> 00:00:34,160
So we've trained our model.

11
00:00:34,160 --> 00:00:35,090
We've evaluated it.

12
00:00:35,090 --> 00:00:39,680
Let's suppose that we have some data drawn from our um test set.

13
00:00:39,680 --> 00:00:44,210
And we want to be able to say whether it's parasitized or uninfected.

14
00:00:44,210 --> 00:00:51,530
Now before moving on we'll define this parasite or not method, parasite or not or not.

15
00:00:51,530 --> 00:00:53,360
And then it takes an x.

16
00:00:53,360 --> 00:01:05,030
And if x if x is um less than 0.5, if x is less than 0.5, then what we want to do is return the string

17
00:01:05,030 --> 00:01:11,780
um, p that's parasitized and else we want to return the string.

18
00:01:11,900 --> 00:01:12,740
Um, you.

19
00:01:12,740 --> 00:01:13,520
So that's it.

20
00:01:13,520 --> 00:01:16,700
So it's either parasitized or uninfected.

21
00:01:16,700 --> 00:01:21,290
Now let's run that and then we have model.

22
00:01:21,410 --> 00:01:22,490
Or we could actually say.

23
00:01:22,640 --> 00:01:23,540
Net model.

24
00:01:23,540 --> 00:01:24,500
Let's define this as.

25
00:01:24,620 --> 00:01:25,730
Net model.

26
00:01:25,730 --> 00:01:29,300
Well since we already had model let's just leave it that way.

27
00:01:29,300 --> 00:01:34,610
But you could define it as later model to separate it from all other models we'll be working with in

28
00:01:34,610 --> 00:01:35,690
this course.

29
00:01:35,690 --> 00:01:41,960
So we have this model and the model we use make use of model predict does the predict method.

30
00:01:41,960 --> 00:01:44,510
And it takes in a test data.

31
00:01:44,510 --> 00:01:46,550
So we have test data set.

32
00:01:46,550 --> 00:01:49,160
We could take um a single one.

33
00:01:49,160 --> 00:01:55,760
And then we get the output now once note that here we have a batch of 32 elements.

34
00:01:55,760 --> 00:02:01,970
So if you output this you would have an output of of 32 elements.

35
00:02:01,970 --> 00:02:06,200
So after this we could pick out a single one out of this.

36
00:02:06,200 --> 00:02:08,150
Well let's just get the output first.

37
00:02:09,200 --> 00:02:11,840
As you could see, we have the 32 different outputs.

38
00:02:11,870 --> 00:02:17,060
Now we could pick out just the, the very first one so we could run that.

39
00:02:17,060 --> 00:02:20,270
And you see we have our output.

40
00:02:20,300 --> 00:02:24,350
Now we want to get it as parasitized or not.

41
00:02:24,350 --> 00:02:29,960
So parasitize parasite um or not.

42
00:02:29,960 --> 00:02:31,190
Parasite or not.

43
00:02:31,190 --> 00:02:32,780
And we get that.

44
00:02:32,780 --> 00:02:34,670
So let's print this out.

45
00:02:35,570 --> 00:02:39,020
Print that and there we go.

46
00:02:39,020 --> 00:02:42,200
So let's run this again and see what we get.

47
00:02:42,590 --> 00:02:46,280
You see we have p meaning that it's parasitized.

48
00:02:46,580 --> 00:02:50,300
Now the next step will be to visualize our predictions.

49
00:02:50,300 --> 00:02:56,570
That's to see what the model was supposed to predict and what the model actually predicted.

50
00:02:56,570 --> 00:02:59,900
So let's go for image label.

51
00:02:59,900 --> 00:03:03,410
We'll just do nine predictions or yeah nine images.

52
00:03:03,410 --> 00:03:09,920
So for that in test um data set, let's take a single batch.

53
00:03:10,340 --> 00:03:13,430
Now for I in range.

54
00:03:13,430 --> 00:03:15,290
Um nine.

55
00:03:15,890 --> 00:03:19,460
What we're going to do is we're going to have this subplot.

56
00:03:19,760 --> 00:03:26,480
So we have our subplot and it's three by three and then we increment I.

57
00:03:27,620 --> 00:03:31,040
Then from here we have plot image show.

58
00:03:31,070 --> 00:03:37,880
We have the image um, image I actually because we have a batch.

59
00:03:37,880 --> 00:03:39,290
So it's image I.

60
00:03:39,290 --> 00:03:46,880
And then once we have that image we are going to have a title which is going to be made of what the

61
00:03:46,880 --> 00:03:49,550
model was supposed to predict and what the model predicted.

62
00:03:49,550 --> 00:03:55,730
So we have this title which is made of, um, well, yeah, we have parasitized or not.

63
00:03:55,730 --> 00:03:58,220
So we just say parasitized.

64
00:03:58,520 --> 00:04:01,610
Well, the function name is parasite or not okay.

65
00:04:01,610 --> 00:04:04,400
So it's parasite or not.

66
00:04:04,400 --> 00:04:09,800
And then it takes in the output the label.

67
00:04:09,800 --> 00:04:13,760
So we have here label send that to numpy.

68
00:04:14,150 --> 00:04:15,410
NumPy.

69
00:04:15,440 --> 00:04:16,580
There we go.

70
00:04:16,580 --> 00:04:22,070
And then we pick I because this is that specific um index.

71
00:04:22,070 --> 00:04:27,080
And then now we have like that is after getting this label.

72
00:04:27,080 --> 00:04:28,850
So here is a label.

73
00:04:28,850 --> 00:04:32,240
The next thing we want to have is the what the model predicts.

74
00:04:32,240 --> 00:04:42,500
So we have this here then now we have plus then we could have this slash.

75
00:04:42,860 --> 00:04:45,260
Well plus there we go.

76
00:04:45,260 --> 00:04:55,370
And then we have again um parasite or not which takes in the model or the output of the model.

77
00:04:55,370 --> 00:04:58,190
So model predict we have model predict.

78
00:04:58,400 --> 00:05:00,920
And this model predict takes in the image.

79
00:05:00,920 --> 00:05:05,150
So here we have image I and then we.

80
00:05:05,150 --> 00:05:05,690
And that's it.

81
00:05:05,690 --> 00:05:06,800
So there we go.

82
00:05:06,800 --> 00:05:08,690
We have a text image.

83
00:05:08,690 --> 00:05:12,200
And then we have well let's do this way instead.

84
00:05:12,680 --> 00:05:16,370
When this takes in the image we have I and then we have zero.

85
00:05:16,370 --> 00:05:17,150
There we go.

86
00:05:17,150 --> 00:05:19,370
So that should be fine.

87
00:05:19,640 --> 00:05:30,500
Then finally we have let's take this this way we have plot axis and set that to off.

88
00:05:30,770 --> 00:05:31,820
And there we go.

89
00:05:31,820 --> 00:05:34,910
We could now run this and see what we obtain.

90
00:05:35,840 --> 00:05:41,630
You could see from here that, um, we have most of the predictions right out of the the nine predictions.

91
00:05:41,630 --> 00:05:43,310
We only have one wrong.

92
00:05:43,340 --> 00:05:44,090
That's this one.

93
00:05:44,090 --> 00:05:50,720
So essentially here, um, the model was supposed to predict, uh, this as parasitized, but it predicts

94
00:05:50,720 --> 00:05:52,010
this as uninfected.
