Regression
Coefficient of determination (R²)
Implemented
regression.r2Definition
Proportion of variance in the target explained by the predictions, relative to predicting the mean.
Formula
R² = 1 − Σᵢ (yᵢ − ŷᵢ)² / Σᵢ (yᵢ − ȳ)²
Range: (−∞, 1]
Inputs and outputs
- y_true: array of real targets
- y_pred: array of real predictions
- sample_weight: optional
Returns: float
Assumptions
No assumptions beyond valid, aligned inputs of the documented types.
Limitations
- Undefined for constant targets; reported explicitly rather than returned as a number.
Python API
import evalsuite as es
es.r2(y_true_r, y_pred_r)References
Primary references for this entry have not been added yet.