Skip to content
Lambdian

R² (coefficient of determination)

The share of the target's variance a regression model explains: 1 is perfect, 0 is no better than predicting the mean.

R2=1−∑i(yi−y^i)2∑i(yi−yˉ)2R^2 = 1 - \frac{\sum_i (y_i - \hat y_i)^2}{\sum_i (y_i - \bar y)^2}

An R2R^2 of 0.8 means the model explains 80% of the variation around the mean. It can be negative on test data when a model is worse than simply predicting the average. Always report it on held-out data, and look at residual plots too: a decent R2R^2 can hide a systematic curve the model missed.

See it in action