Confusion Matrix generates report not plot

I’ve recently attempted to build a Confusion Matrix using the wandb.plot.confusion_matrix() command.
Much to my surprise, I get a Table object, not a plot.
Imagine my surprise when I discovered a comment (here) saying “Logging the Table also is expected behaviour”.
Really? If I wanted a Table, i would call wand.table.confusion_matrix(), not the plot command.
I really do want a plot and and do NOT want to “interactively explore” it. I want to see it along with the twenty other plots that I generate with this run. Clicking each and every CM to view it kinda defeats the purpose.
I would like to recommend that this choice be rethought, or at least put in the table namespace.
Is there a way to generate a real CM plot?

Hi Kevin, thanks for writing in! I’ve investigated this issue and as you mentioned it seems that when you log the wandb.plot.confusion_matrix() it is logged as a tablet but, once the run is finished, the plot is created in the “Custom Charts” section. Could you please check if this is also the behaviour on your end? Thanks!

@system Thank you for the response.
I can confirm that the CM tables does NOT show up in a plot. Only the table is shown.
See attached.

Hi Kevin,

Thanks for your answer! I’ve explored this and by running the following code I can see both the table (Tables section) and the plot (Custom Charts section) once the run is finished. Could you try running it and see if you get the plots and the tables? Also, it would be really useful if you could send me a code snippet and a link to the Workspace where you are logging this.

import wandbimport numpy as npwandb.init(project='Confusion_Matrix')cm = wandb.plot.confusion_matrix( probs=None, y_true=np.random.randint(3, size=5), preds=np.random.randint(3, size=5), class_names=['cat', 'dog', 'human'], title=f'Confusion Matrix')wandb.log({f'Confusion Matrix': cm})wandb.finish()


Best,
Luis

Hi Kevin,

We wanted to follow up with you regarding your support request as we have not heard back from you. Please let us know if we can be of further assistance or if your issue has been resolved.

Best,
Luis

Hi Kevin,

Since we have not heard back, I will go ahead and close this ticket for now. If you are having any issues again with this, feel free to message us here and we will be happy to re-open the ticket and keep investigating. Thank you!

Best,
Luis

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.