#tfa.metrics.MultiLabelConfusionMatrix gives nonsensical values

1 messages · Page 1 of 1 (latest)

kindred heron
#

I'm in a beginner-level neural network class and have an image classification assignment with multiple (3) classes. I wrote a program based on image classification tutorial from tensorflow's website and tried to add MultiLabelConfusionMatrix metric in order to obtain more detailed info on accuracy of each of the 3 classes. But the values I obtained from writing fit history to file seem nonsensical. For starters, the fields that are supposed to correspond to true positives have higher values than the number of images in each of the classes. Am I misinterpreting these values, or is my program just outright wrong?

halcyon relic
#

Hey hopefully this will provide some guidance. Firstly, the MultiLabelConfusionMatrix metric in TensorFlow can be used for both multi-class and multi-label problems. However, in the case of a multi-class problem (like the one described in the question), it is not the ideal metric to use, as it is designed to handle multi-label classification, where each sample can belong to multiple classes simultaneously. This is why the true positive values might be higher than the number of samples in each class.

For a multi-class problem, it is more appropriate to use a Confusion Matrix, which can give a clearer understanding of the performance of the model for each class. You can use scikit-learn's confusion_matrix function to obtain the confusion matrix for your problem.

#

I am also new to ML so my apologies if that sends you in the wrong direction. I just thought that would be the case for the number given the documentation on Tensorflow hub