Regression Metrics: MAE, RMSE and R²

easy
Unit 2 · Metrics0/3 to milestone

Implement regression_report(y_true, y_pred) returning a dict with:

  • mae: mean absolute error
  • rmse: root mean squared error
  • r2: coefficient of determination, 1−SSresSStot1 - \frac{SS_{res}}{SS_{tot}}

If y_true is constant, SS_tot is 0: return r2 = 1.0 for a perfect prediction and 0.0 otherwise.

#metrics#regression2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Regression Metrics: MAE, RMSE and R² · TechGradify