2.0 KiB
Housing Price Regression
End-to-end regression pipeline predicting median house value from California census-block data (20,640 rows).
The question driving the approach
Which features actually predict house value, and can a simple, interpretable pipeline get close to what a more complex model would achieve?
Exploratory analysis
Before modeling, checking which raw features correlate with the target:
median_income stood out as by far the strongest predictor (r ≈ 0.69) — every later decision, including the stratified train/test split, was built around that finding.
Model comparison via cross-validation
Rather than trusting a single train-set score, both baseline models were evaluated with 5-fold cross-validation to get an honest estimate of real-world error:
What the tuned model actually relies on
After GridSearchCV tuning, inspecting which engineered features the Decision Tree leaned on most:
The engineered ratio features (rooms-per-house, etc.) pulled real weight here — not just the raw census counts, which justified the extra feature engineering step.
Final result
Test set touched exactly once, after every modeling decision was locked in:
| Metric | Value |
|---|---|
| MAE | $40,600 |
| RMSE | $61,901 |
| R² | 0.72 |
| 95% CI on RMSE | [$59,141 — $64,542] |
The scatter shows the model tracks the trend well but underpredicts at the high end — expected, since expensive homes are rarer and harder to fit precisely with limited high-price training examples.
Notebooks
housing-ml-notebook.ipynb— original workhousing_ml_notebook_polished.ipynb— AI-assisted documentation pass



