MCPcopy Create free account
hub / github.com/Riley702/enhanced_benchmark_tool / plot_confusion_matrix

Function plot_confusion_matrix

src/visualizations.py:52–65  ·  view source on GitHub ↗

Plots a confusion matrix. Args: y_true (array-like): True labels. y_pred (array-like): Predicted labels. labels (list, optional): Class labels for the confusion matrix.

(y_true, y_pred, labels=None)

Source from the content-addressed store, hash-verified

50
51
52def plot_confusion_matrix(y_true, y_pred, labels=None):
53 """
54 Plots a confusion matrix.
55
56 Args:
57 y_true (array-like): True labels.
58 y_pred (array-like): Predicted labels.
59 labels (list, optional): Class labels for the confusion matrix.
60 """
61 plt.figure(figsize=(6, 5))
62 ConfusionMatrixDisplay.from_predictions(y_true, y_pred, display_labels=labels, cmap="Blues", xticks_rotation=45)
63 plt.title("Confusion Matrix")
64 plt.grid(False)
65 plt.show()
66
67
68def plot_threshold_metrics(threshold_df):

Callers 1

Calls

no outgoing calls

Tested by 1