Hey everyone! Have you ever wanted to further explore where your model was being confused? Look and take a peek at which specific images were being confused for x vs y class? Or look at the distributions of your mislabeled classes for your tabular models? ClassConfusion will do exactly this!
For both images and tabular, we pass in our ClassificationInterpretation object, along with a list of classes, and we can specify if we want an ordered set of classes or just the two back to back. For instance with Pets, we can either pass in classlist = ['Ragdoll', 'Birman', 'Maine_Coon']
or classlist = [('Ragdoll', 'Birman'), ('British_Shorthair', 'Russian_Blue')]
. If we want exact orders, simply pass in is_ordered=True
When the tabs pop up, you will be greeted with those images in order of the most_confused, along with their relative filenames (this was mostly to help the Google Colaboratory people as we do not have access to FileDeleter.) The first class in pairs will be the ‘truth’, and the second the ‘prediction’
For tabular, we can do the same as the above but also pass in a set of variables to look at too if we want to see specific ones. In order to use it on regular Jupyter notebooks, call from fastai.widgets import ClassConfusion
. For Google Colaboratory users, my repo is available here
The documentation is available here
Here are some snippets of what each of the types look like: