Graph
R2 Score

🧪R2 Score

NEW

The scikit-learn regression score measuring variance explained by a model relative to a constant baseline.

DESCRIPTION

R2 score in ML toolkits operationalizes the coefficient of determination for evaluating regression models. A score of 1.0 indicates perfect predictions; 0.0 equals the mean baseline; negative values indicate underperformance. It is sensitive to outliers and can be inflated by overfitting. Practitioners compare models using cross-validated R2 and complement it with MAE/RMSE.

ALTERNATIVE DEFINITIONS

scikit-learn

R^2 (coefficient of determination) regression score function.

Defines R2 as a concrete scoring function in the library.

Source

Wikipedia

In statistics, the coefficient of determination, denoted R2, is a measure of the proportion of variance in the dependent variable that is predictable from the independent variables.

Provides the statistical foundation for the score.

Source

R-squared Mean Absolute Error RMSE Baseline Model Cross-Validation Regression Metrics scikit-learn Residuals

COMPETING TERMS

Adjusted R-squared Explained Variance Score

RELATIONS

KNOWLEDGE AREAS

Data Science AI Mathematics Testing & Validation

TARGET AUDIENCE

Data Scientist MLOps Engineer AI Engineer BI Specialist Data Analyst

EXTERNAL SOURCES

TOP QUESTIONS

Why can the R2 Score be negative?

It becomes negative when the model predicts worse than a constant mean baseline for the target variable.

Category: Misunderstanding

How to use R2 Score during model selection?

Compare cross-validated R2 across candidates and inspect residuals; avoid picking models solely on in-sample R2.

Category: Best practices

What is the relationship between R2 Score and Explained Variance?

They are related but not identical; explained variance measures dispersion of errors, while R2 compares to a baseline.

Category: Misunderstanding

Should I optimize models directly for R2 Score?

Often you optimize for loss (e.g., MSE) and report R2. Direct optimization for R2 is uncommon.

Category: Opinion

How does scaling features impact R2 Score?

Scaling does not change R2 in linear regression, but it can affect optimization convergence and regularization behavior.

Category: Requirements

How to interpret R2 with heteroscedastic data?

Use diagnostics and robust metrics; R2 alone may mask unequal error variance.

Category: Risks

Is R2 suitable for non-linear models?

Yes as a general fit measure, but complement it with residual plots and domain-specific metrics.

Category: Opinion

What baseline does R2 Score use?

A constant predictor equal to the mean of the observed targets for the evaluation set.

Category: Example

How do outliers affect R2 Score?

Outliers can skew fit and inflate or deflate R2. Consider robust modeling or outlier treatment.

Category: Risks