confusion_matrix#
- class braintools.visualize.confusion_matrix(y_true, y_pred, labels=None, normalize=None, cmap='Blues', ax=None, figsize=(8, 8), show_values=True, title='Confusion Matrix', **kwargs)#
Plot confusion matrix for classification results.
- Parameters:
y_true (
ndarray) – True and predicted class labels.y_pred (
ndarray) – True and predicted class labels.normalize (
str|None) – Normalization method: ‘true’, ‘pred’, ‘all’.cmap (
str) – Colormap for the matrix.ax (
Axes|None) – Axes to plot on.figsize (
Tuple[float,float]) – Figure size if creating new figure.show_values (
bool) – Whether to show values in cells.title (
str) – Plot title.**kwargs – Additional arguments passed to imshow.
- Returns:
ax – The axes object containing the plot.
- Return type:
Axes