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)
| 50 | |
| 51 | |
| 52 | def 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 | |
| 68 | def plot_threshold_metrics(threshold_df): |
no outgoing calls