(confusion_mat, class_names, title='Confusion Matrix')
| 591 | logging.info(debug_str) |
| 592 | |
| 593 | def plot_confusion_matrix(confusion_mat, class_names, title='Confusion Matrix'): |
| 594 | data = [] |
| 595 | n_classes = confusion_mat.shape[0] |
| 596 | |
| 597 | for i in range(n_classes): |
| 598 | for j in range(n_classes): |
| 599 | data.append([class_names[i], class_names[j], confusion_mat[i, j]]) |
| 600 | |
| 601 | fields = { |
| 602 | "Actual": "Actual", |
| 603 | "Predicted": "Predicted", |
| 604 | "nPredictions": "nPredictions", |
| 605 | } |
| 606 | return wandb.plot_table("wandb/confusion_matrix/v1", |
| 607 | wandb.Table(columns=["Actual", "Predicted", "nPredictions"], data=data), |
| 608 | fields, |
| 609 | {"title": title},) |
nothing calls this directly
no outgoing calls
no test coverage detected