Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Scikit learn Scikit learn Regression Metrics

From Leeroopedia


Knowledge Sources
Domains Model Evaluation, Regression
Last Updated 2026-02-08 15:00 GMT

Overview

Regression metrics quantify the discrepancy between predicted continuous values and actual observed values, providing a numerical assessment of model accuracy.

Description

Regression metrics measure how well a model's continuous predictions match the true target values. Different metrics emphasize different aspects of prediction error: some penalize large errors more heavily, some are scale-independent, and some measure the proportion of variance explained. Choosing the right metric ensures that model evaluation aligns with the practical consequences of prediction errors. Regression metrics are fundamental to model selection, hyperparameter tuning, and reporting in any regression task.

Usage

Use Mean Squared Error (MSE) or Root Mean Squared Error (RMSE) when large errors are particularly undesirable, as squaring amplifies their contribution. Use Mean Absolute Error (MAE) when all errors should be weighted equally regardless of magnitude, or when robustness to outliers is desired. Use R-squared (coefficient of determination) to express the proportion of variance explained by the model, facilitating comparison across different scales. Use Mean Absolute Percentage Error (MAPE) when a scale-independent, relative error measure is needed. Use explained variance when the model may have a non-zero mean bias.

Theoretical Basis

Mean Squared Error (MSE):

MSE=1ni=1n(yiy^i)2

Root Mean Squared Error (RMSE):

RMSE=MSE=1ni=1n(yiy^i)2

Mean Absolute Error (MAE):

MAE=1ni=1n|yiy^i|

R-squared (Coefficient of Determination):

R2=1i=1n(yiy^i)2i=1n(yiy¯)2=1SSresSStot

R2=1 indicates perfect prediction, R2=0 indicates performance equal to predicting the mean, and R2<0 indicates worse-than-mean predictions.

Explained Variance Score:

EV=1Var(yy^)Var(y)

This differs from R2 in that it does not account for systematic bias in predictions.

Mean Absolute Percentage Error (MAPE):

MAPE=100ni=1n|yiy^iyi|

Max Error:

MaxError=maxi|yiy^i|

This captures the worst-case prediction error, useful for safety-critical applications.

Median Absolute Error (MedAE):

MedAE=median(|y1y^1|,,|yny^n|)

This is robust to outliers, as the median is unaffected by extreme values.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment