In confusion matrix it is showing that there is no Class 2 data and so there is no prediction.
My question is how it can be possible because when i look on my data i found the images of class 2 and even when i do : learn2.show_results(rows=3, figsize=(12,15))
then also
We can see the ground truth and prediction images where you will find that all the class of image are present i.e. Class 1 , Class 2, Class 3.
But in confusing matrix it is not showing actual image of Class 3 in the matrix.
I don’t know why it is happening?
And note that data.c is also giving 3 as output.
As I can see in the attached image, your classifier is multi-label, right?
If so, I think you can’t use the plot_confusion_matrix() function of the ClassificationInterpretation. You may have to define another function for multi-label.
I can tell you some websites that may be useful to you, but you may have to create your own function:
In fastai2 there is a class called Interpretation() which is useful for interpreting multi-label classifiers. Even though it doesn’t have the confusion_matrix() function, it does have others that may help you, like plot_top_losses().
Sklearn has a metric called multilabel_confusion_matrix() you can check it out too.
And if my model is doing multilabel classification instead of multiclass then do you know how can we train our model in fastai in such a way that it performs only multiclass not multilabel.
@Saioa Thank you for your kind help!
I detected some problems and change some initial codes when I was trying to read my data from CSV file and now it is working and the confusion matrix is also showing the results.
Thanks.