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

Function plot_residuals

src/visualizations.py:87–104  ·  view source on GitHub ↗

Plots residuals (errors) of a regression model. Args: y_true (array-like): True values. y_pred (array-like): Predicted values.

(y_true, y_pred)

Source from the content-addressed store, hash-verified

85
86
87def plot_residuals(y_true, y_pred):
88 """
89 Plots residuals (errors) of a regression model.
90
91 Args:
92 y_true (array-like): True values.
93 y_pred (array-like): Predicted values.
94 """
95 residuals = y_true - y_pred
96
97 plt.figure(figsize=(10, 6))
98 plt.scatter(y_pred, residuals, color="purple", alpha=0.5)
99 plt.axhline(y=0, color="black", linestyle="--")
100 plt.xlabel("Predicted Values")
101 plt.ylabel("Residuals")
102 plt.title("Residual Plot")
103 plt.grid(alpha=0.5)
104 plt.show()
105
106
107def plot_actual_vs_predicted(y_true, y_pred):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected