Hello everyone, and welcome to this session on evaluation and Testing.
So so far we've built and trained our model and we have, um, reasonable performance.
Let's go ahead and evaluate this model.
So here we have model evaluate.
And then we could pass in um our test data.
So test data set we run that.
The result we get now is about 93% for the test data set.
So that's the accuracy for our test data set.
Now let's dive into prediction.
So we've trained our model.
We've evaluated it.
Let's suppose that we have some data drawn from our um test set.
And we want to be able to say whether it's parasitized or uninfected.
Now before moving on we'll define this parasite or not method, parasite or not or not.
And then it takes an x.
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
um, p that's parasitized and else we want to return the string.
Um, you.
So that's it.
So it's either parasitized or uninfected.
Now let's run that and then we have model.
Or we could actually say.
Net model.
Let's define this as.
Net model.
Well since we already had model let's just leave it that way.
But you could define it as later model to separate it from all other models we'll be working with in
this course.
So we have this model and the model we use make use of model predict does the predict method.
And it takes in a test data.
So we have test data set.
We could take um a single one.
And then we get the output now once note that here we have a batch of 32 elements.
So if you output this you would have an output of of 32 elements.
So after this we could pick out a single one out of this.
Well let's just get the output first.
As you could see, we have the 32 different outputs.
Now we could pick out just the, the very first one so we could run that.
And you see we have our output.
Now we want to get it as parasitized or not.
So parasitize parasite um or not.
Parasite or not.
And we get that.
So let's print this out.
Print that and there we go.
So let's run this again and see what we get.
You see we have p meaning that it's parasitized.
Now the next step will be to visualize our predictions.
That's to see what the model was supposed to predict and what the model actually predicted.
So let's go for image label.
We'll just do nine predictions or yeah nine images.
So for that in test um data set, let's take a single batch.
Now for I in range.
Um nine.
What we're going to do is we're going to have this subplot.
So we have our subplot and it's three by three and then we increment I.
Then from here we have plot image show.
We have the image um, image I actually because we have a batch.
So it's image I.
And then once we have that image we are going to have a title which is going to be made of what the
model was supposed to predict and what the model predicted.
So we have this title which is made of, um, well, yeah, we have parasitized or not.
So we just say parasitized.
Well, the function name is parasite or not okay.
So it's parasite or not.
And then it takes in the output the label.
So we have here label send that to numpy.
NumPy.
There we go.
And then we pick I because this is that specific um index.
And then now we have like that is after getting this label.
So here is a label.
The next thing we want to have is the what the model predicts.
So we have this here then now we have plus then we could have this slash.
Well plus there we go.
And then we have again um parasite or not which takes in the model or the output of the model.
So model predict we have model predict.
And this model predict takes in the image.
So here we have image I and then we.
And that's it.
So there we go.
We have a text image.
And then we have well let's do this way instead.
When this takes in the image we have I and then we have zero.
There we go.
So that should be fine.
Then finally we have let's take this this way we have plot axis and set that to off.
And there we go.
We could now run this and see what we obtain.
You could see from here that, um, we have most of the predictions right out of the the nine predictions.
We only have one wrong.
That's this one.
So essentially here, um, the model was supposed to predict, uh, this as parasitized, but it predicts
this as uninfected.