# Confusion Matrix generates report not plot

**URL:** https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270
**Category:** W&B Help
**Tags:** wandb
**Created:** [October 18, 2022, 3:50am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270 "2022-10-18T03:50:14Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![kevinashaw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/kevinashaw/32/1016_2.png) [@kevinashaw](https://community.wandb.ai/u/kevinashaw)
#### Post date: [October 18, 2022, 3:50am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/1 "2022-10-18T03:50:14Z")

</div>

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](https://community.wandb.ai/t/wandb-plot-confusion-matrix-just-show-a-table/1744)) 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?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)
#### Post date: [October 18, 2022, 11:45am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/2 "2022-10-18T11:45:14Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![kevinashaw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.wandb.ai/kevinashaw/32/1016_2.png) [@kevinashaw](https://community.wandb.ai/u/kevinashaw)
#### Post date: [October 19, 2022, 1:09am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/3 "2022-10-19T01:09:00Z")

</div>

@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.

 ![Untitled 3](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/2X/a/a87d008da1038c99c53d5b2dc3c3ff9e4e7a0cf4.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)
#### Post date: [October 19, 2022, 9:01am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/4 "2022-10-19T09:01:19Z")

</div>

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()

```

![](https://weightsandbiases.zendesk.com/attachments/token/rysRbFROcW12KqEAu3yYtA03p/?name=image.png)  
Best,  
Luis

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)
#### Post date: [October 21, 2022, 8:55am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/5 "2022-10-21T08:55:44Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)
#### Post date: [October 25, 2022, 9:34am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/6 "2022-10-25T09:34:31Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex020/uploads/wandb/original/1X/366b649231631dbab896843020da0056074ac79d.png) [@system](https://community.wandb.ai/u/system)
#### Post date: [December 18, 2022, 1:09am UTC](https://community.wandb.ai/t/confusion-matrix-generates-report-not-plot/3270/7 "2022-12-18T01:09:39Z")

</div>

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