1.7 KiB
1.7 KiB
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
- EDA — explored feature distributions, geographic price spread, and correlation with the target.
median_incomewas the strongest predictor (r ≈ 0.69). - 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. - Feature engineering — derived ratio features (
rooms_per_house, etc.) that are more semantically meaningful per-household than the raw per-block counts. - Preprocessing pipeline — all transforms wrapped in sklearn
Pipeline/ColumnTransformerto guarantee no data leakage and identical transforms on train/test. - Model comparison — Linear Regression vs Decision Tree baselines, evaluated with 5-fold cross-validation (not just training accuracy).
- Hyperparameter tuning —
GridSearchCVover tree depth and an RBF-kernel feature transform. - 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