3 or more classes (like in dog breed)- what labels goes for each class, and how can we test an image


If there are 2 classes , I know it’s an 0 or 1, which I should expect.
But if there are more classes, what should the prediction be?

I tried notebook1 on 3 classes and it works, but I 'm not sure I understand the predictions.

I’ve heard of one hot encoding which is done on identifi\ying digit, but I think it’s not the way it’s done here.

Also, if I have a new image I want to test - id it possible to test it alone and see what class does it belong to?

I’m also interested in the question above.

I’ve tried lesson 1 code with 3 classes, so i have 3 folders. I have not really changed the code from lesson 1, it appears to run, although accuracy is not great. As asked above, how to we read the prediction as it seems to still score between 0 and 1. For 2 classes, closer to zero is first class, and closer to 1 is second class, but how to read this 0-1 score with 3 classes ?

In the following lessons those concepts are explained in more detail. But basically for multiclass classification the Softmax function (or actually the log of it) is used. Softmax gives like the probability of each class (the values are between 0 and 1 and they sum to 1). So in numpy you call argmax() to find the class with highest probability. You need to do np.exp(preds) to get the actual probabilities since the predictions are the logarithm of softmax.

1 Like