Plots accuracy, precision, recall, and F1-score against different thresholds. Args: threshold_df (pd.DataFrame): DataFrame containing threshold evaluation metrics.
(threshold_df)
| 66 | |
| 67 | |
| 68 | def plot_threshold_metrics(threshold_df): |
| 69 | """ |
| 70 | Plots accuracy, precision, recall, and F1-score against different thresholds. |
| 71 | |
| 72 | Args: |
| 73 | threshold_df (pd.DataFrame): DataFrame containing threshold evaluation metrics. |
| 74 | """ |
| 75 | plt.figure(figsize=(10, 6)) |
| 76 | for metric in ["accuracy", "precision", "recall", "f1_score"]: |
| 77 | plt.plot(threshold_df["threshold"], threshold_df[metric], marker="o", label=metric) |
| 78 | |
| 79 | plt.xlabel("Threshold") |
| 80 | plt.ylabel("Score") |
| 81 | plt.title("Model Performance Across Different Thresholds") |
| 82 | plt.legend() |
| 83 | plt.grid(linestyle="--", alpha=0.7) |
| 84 | plt.show() |
| 85 | |
| 86 | |
| 87 | def plot_residuals(y_true, y_pred): |
nothing calls this directly
no outgoing calls
no test coverage detected