Learn.predict output

Hello, I’m having some issue interpreting the output of learn.predict.
According to the documentation learn.predict of a text classifier returns the predicted class, label and probabilities for item.

My question is the following:
Is the label the actual label of the item in the dataset or the label of the prediction?

The reason I’m asking is that it appears to be the label of the prediction and not the actual label of the item in the dataset (see below example using a classification on IMDB dataset). Is that correct?

fastaiLabelPredict.pdf (56.2 KB)

Uhm, no one ever notice this?
:slight_smile: Let me know. Grateful for your help.

It’s the label of the prediction. learn.predict() assumes there is no original label (like our test sets all default to a label of zero). Does this help?

Yup! This clarifies everything.
Thanks @muellerzr. Much appreciated :slight_smile:

I don’t think that’s correct.
the out put of the learn.predict for binary or multi label classification will be as follows

  • Category: the model prediction
  • tensor(n): which is basically the same as above.
  • Probabilities: a softmax of the output scores.

If you have a data_class, type
print(data_class.classes) # will give you a list of all your labels
print(data_class.c) # will give you the number of labels in your data
print(data_class.classes[n]) # will give you the prediction as well. Make sure to convert the tensor to numpy
argmax(probabilities_tensor) should give you ‘n’

1 Like

Yes. By original label I should’ve said no ground-truth label. Thank you :slight_smile: