The coefficient of determination, or R² score, measures how much variation in regression labels is predictable from features. It compares residual error with total label variation: R² = 1 − RSS/TSS. A perfect model scores 1, strong models approach 1, and sufficiently poor models can score below 0. section 1.3.1
Use R² to compare regression models while checking performance on unseen data:
- Split examples into training and test subsets, then train models with different settings such as tree depth. section 1.3.1
- Compute R² on both subsets; a large training score paired with weaker test performance signals overfitting. section 1.3.1
- Repeat random splits and average scores to reduce the influence of a lucky or unlucky split. section 1.3.1
Comparing tree depths
On Friedman-1 regression data, evaluate decision trees with depths from 1 through 10. A validation curve with scikit-learn's scoring='r2' reports mean training and test scores across five ShuffleSplit runs. section 1.3.1






