Contents
Understanding R² Score
The R² Score, also known as the Coefficient of Determination, measures how much of the variation in the target variable is explained by the model.
Formula
R² = 1
represents perfect prediction.
Interpretation
R² Value | Interpretation |
1.0 | Perfect prediction |
0.9+ | Excellent model |
0.7 – 0.9 | Good model |
0.5 – 0.7 | Moderate performance |
Below 0.5 | Weak performance |
The closer the R² score is to 1, the better the model explains the variation in house prices.
Code
**from sklearn import metrics**
**r2_score = metrics.r2_score(**
**y_train,**
**y_train_pred**
**)**
**print(r2_score)**
Output
0.943650140819218
Interpretation
An R² score of 0.973 indicates that the model explains approximately 97.3% of the variation in house prices.
This suggests that the model has learned the underlying patterns very effectively.
House Price Prediction Using Machine Learning (XGBoost)
VA










