Skip to content
Sangam Gupta
All work

House Price Prediction

Estimates a California district's median house value; the best of nine models I compared explains 83% of the variance.

Status
Open source
Stack
Python, scikit-learn, pandas, HistGradientBoosting
Links
GitHub
R² on held-out data
0.835
RMSE
$46.5k
models compared
9

Try the model

Pick a place and change the district's figures to see the estimate, and what drove it.

Loading the model…

Model card

Intended use
Estimate the median house value of a California census block group from income, housing and location figures. A teaching and portfolio model, not a valuation tool.
Data
scikit-learn's California housing data from the 1990 US census: 20,640 block groups with 8 features (median income, house age, average rooms and bedrooms, population, average occupancy, latitude, longitude). 80/20 train-test split with random_state 42.
Model
HistGradientBoostingRegressor with default settings (100 boosting iterations), chosen after comparing it with linear, regularised, single-tree and ensemble models.
How it was evaluated
  • R² 0.835, RMSE 0.465 and MAE 0.311 on the test set (in units of $100,000)
  • Next best: Extra Trees (R² 0.806) and Random Forest (R² 0.805); linear regression reached R² 0.576
Limitations
  • 1990 prices: the absolute numbers say nothing about today's market.
  • Target values are capped at $500,000 in the source data, so the model can't predict above that.
  • Block-group averages, not individual homes.
Read the full analysis notebook

Nine regression models compared on the California housing data (20,640 census block groups), from linear baselines to tree ensembles. The winner, a HistGradientBoostingRegressor, now runs in the browser on this page.

Ask about House Price Prediction

Answers come from this case study and its code on GitHub.