> "The squared error version of RAE. RSE and R² are two sides of the same coin: R² = 1 - RSE."
Relative Squared Error (RSE) measures the total squared error of predictions relative to the total squared error of a simple baseline predictor that always predicts the mean. RSE is directly related to the coefficient of determination (R²).
## Architecture & Physics
RSE computes a ratio of summed squared errors. The numerator is the residual sum of squares (RSS). The denominator is the total sum of squares (TSS). The relationship R² = 1 - RSE provides a direct conversion between the two metrics.
When all actual values in the window are identical, TSS becomes zero (all values equal the mean). The implementation returns 1.0 in this case.
### Outlier Sensitivity
Because errors are squared, a single large error can dominate the RSE calculation. For outlier-robust alternatives, consider RAE (which uses absolute errors).
### Negative R² is Possible
When RSE > 1, the implied R² is negative. This indicates predictions are worse than simply predicting the mean: a sign of a fundamentally flawed model.