Menu

Calculating Test R square Score

Calculating Test R² Score

Code

**test_r2_score = metrics.r2_score(**

**y_test,**

**y_test_pred**

**)**

**print(test_r2_score)**

Output

0.8338000331788725

Interpretation

A test R² score close to 0.99 indicates that the model performs extremely well on unseen data.

This suggests:

  • Strong generalization ability
  • Minimal overfitting
  • High predictive accuracy

The model is not simply memorizing training examples but is successfully learning meaningful patterns.