neuralbench.callbacks.plot_confusion_matrix¶
- neuralbench.callbacks.plot_confusion_matrix(cm: ndarray, labels: list[str] | None, cmap: str = 'viridis', xticks_rotation: float | str = 45) Figure[source][source]¶
Plot confusion matrix/matrices with a shared colorbar.
- Parameters:
cm (array-like) – Confusion matrix. Can be: - 2D array of shape (n_classes, n_classes) for multiclass case - 3D array of shape (n_labels, 2, 2) for multilabel case
labels (list of str, optional) – Labels for the classes/categories. If None, uses numeric indices.
cmap (str, default='viridis') – Colormap to use for the heatmap.
- Returns:
fig – The figure object.
- Return type: