Plots actual vs predicted values for regression. Args: y_true (array-like): True values. y_pred (array-like): Predicted values.
(y_true, y_pred)
| 105 | |
| 106 | |
| 107 | def plot_actual_vs_predicted(y_true, y_pred): |
| 108 | """ |
| 109 | Plots actual vs predicted values for regression. |
| 110 | |
| 111 | Args: |
| 112 | y_true (array-like): True values. |
| 113 | y_pred (array-like): Predicted values. |
| 114 | """ |
| 115 | plt.figure(figsize=(8, 8)) |
| 116 | plt.scatter(y_true, y_pred, color="darkblue", alpha=0.6) |
| 117 | plt.plot([min(y_true), max(y_true)], [min(y_true), max(y_true)], linestyle="--", color="red") |
| 118 | plt.xlabel("Actual Values") |
| 119 | plt.ylabel("Predicted Values") |
| 120 | plt.title("Actual vs Predicted Values") |
| 121 | plt.grid(alpha=0.5) |
| 122 | plt.show() |
| 123 | |
| 124 | |
| 125 | def plot_class_distribution(y): |
nothing calls this directly
no outgoing calls
no test coverage detected