Files
ML-portfolio/projects/notebooks/housing-price-regression/README.md

35 lines
1.7 KiB
Markdown

# California Housing Price Prediction
End-to-end supervised regression pipeline predicting median house value from census-block-level data.
## Overview
Full pipeline from raw data to a tuned, evaluated model: EDA, stratified train/test splitting, feature engineering, a leak-free sklearn preprocessing pipeline, baseline model comparison, cross-validation, hyperparameter tuning, and a final held-out evaluation with a confidence interval.
## Approach
1. **EDA** — explored feature distributions, geographic price spread, and correlation with the target. `median_income` was the strongest predictor (r ≈ 0.69).
2. **Stratified split** — training/test split stratified on binned `median_income`, so both sets represent all income bands proportionally instead of relying on a lucky random draw.
3. **Feature engineering** — derived ratio features (`rooms_per_house`, etc.) that are more semantically meaningful per-household than the raw per-block counts.
4. **Preprocessing pipeline** — all transforms wrapped in sklearn `Pipeline`/`ColumnTransformer` to guarantee no data leakage and identical transforms on train/test.
5. **Model comparison** — Linear Regression vs Decision Tree baselines, evaluated with 5-fold cross-validation (not just training accuracy).
6. **Hyperparameter tuning** — `GridSearchCV` over tree depth and an RBF-kernel feature transform.
7. **Final evaluation** — test set touched exactly once, after all modeling decisions were locked in.
## Results
| Metric | Value |
|---|---|
| MAE | $40,600 |
| RMSE | $61,901 |
| R² | 0.72 |
| 95% CI on RMSE | [$59,141 — $64,542] |
## Tech stack
Python, pandas, scikit-learn, matplotlib, seaborn
## Notebook
[`notebook.ipynb`](notebook.ipynb)