-
-
Notifications
You must be signed in to change notification settings - Fork 17.2k
Description
🚀 Feature
The current code to generate the confusion matrix produces something like this:
If the confusion matrix is normalized so that counts become proportions, the proportions are not reflective of standard metrics like the class specific recall.
For example, if we focus on the "boma" class and the proportion of TP, ideally we would want to show an interpretable proportion like recall: TP for boma/ TP for boma+ FN for boma.
Instead, the proportion currently reflects TP for boma / (TP for boma + FN for boma - FN_background for boma+ FP_background for boma), which is difficult to interpret.
I think this is a simple fix, switch the bottom row and label with the rightmost column and label. This way the "True" and "Predicted" axis labels act as axis for all the cells in the confusion matrix, including for False positive background and False Negative background.
For example, this confusion matrix shows more clearly that 4% of the "boma" class are correctly detected out of all groundtruth.
This is the count matrix that swaps the FP and FN background vectors to show what we did to produce the proportion matrix above.
Motivation
This will make normalized confusion matrices more interpretable. I'm not sure how folks interpret the current implementation of the confusion matrix if it is normalized, and I would appreciate guidance on this if there is some reasoning behind the current implementation. However I think the change makes interpretation easier.
Pitch
Take the False Positive background row and swap it with the False Negative background column. Do this so that the "Predicted" axis reflects the category that is predicted for every single row and so that the "True" axis reflects what is groundtruth for every single column.
Alternatives
Don't normalize the matrix and just use counts. But even in this case, I think swapping the row and column data and label positions makes sense and is easier to interpret, since the axis act as axis for all rows and columns in the matrix.
Additional context
I spent some discussion time with @alkalait to confirm that the current implementation is not very interpretable if the matrix is normalized, and that swapping the row and column to make the axis valid for all rows and columns would be an improvement. Hopefully my explanation of the above isn't too confusing and I'm happy to clarify.
Thanks for considering this issue and for open sourcing this awesome project!