Add docs with detailed write-ups and result visualizations
This commit is contained in:
49
docs/Housing-Price-Regression.md
Normal file
49
docs/Housing-Price-Regression.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# 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`](../housing-price-regression/housing-ml-notebook.ipynb) — original work
|
||||
- [`housing_ml_notebook_polished.ipynb`](../housing-price-regression/housing_ml_notebook_polished.ipynb) — AI-assisted documentation pass
|
||||
Reference in New Issue
Block a user