YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
House Price Modeling β Regression & Classification (King County)
Presentation Video
Video (4β6 minutes): https://drive.google.com/file/d/1oWxT0g7jjDvenX_WFa0v7emERj_K2phe/view?usp=sharing
Project Overview
This project predicts residential house prices in King County, Washington using supervised machine learning. Two related tasks were addressed:
- Regression: Predicting the (log-transformed) continuous house price
- Classification: Predicting whether a house price is below or at/above the median
The workflow emphasizes exploratory analysis, feature engineering, model comparison, and evaluation, while carefully avoiding data leakage throughout the pipeline.
Dataset
The dataset contains information about residential properties sold in King County.
- Observations: 20,000+
- Features: Numerical and categorical attributes related to property size, location, condition, and amenities
- Regression target: House price (modeled as
log(price)for improved stability) - Classification target: Binary label (below / at-or-above median)
Exploratory Data Analysis (EDA)
EDA was used to understand distributions and major drivers of price.
Key findings:
- Strong relationship between price and size-related features (e.g., living area)
- Location-based variables significantly impact price
- Price distribution is highly right-skewed β motivates log transformations
Price distribution:
Feature Engineering
Several engineered features were created to improve model performance:
- House age (from
yr_built) - Renovation flag
- Living-to-lot ratio
- Total area (above + basement)
- Luxury score combining grade, view, and waterfront signal
- Log transforms for skewed numeric variables
Preventing data leakage
- Zipcode target encoding was computed using training data only, and then applied to test using a global-mean fallback for unseen zipcodes.
- For classification, the median threshold was computed on the training set only.
Regression Models
The following regression models were trained and compared:
- Linear Regression (baseline)
- Ridge Regression
- Lasso Regression
Selected model (Winner): Ridge Regression β chosen for strong predictive performance and stability from regularization.
Predicted vs. Actual (Ridge):
Saved artifact:
winning_regression_model.pkl
Classification Models
The regression target was converted into a binary classification problem using a median split (train-only median).
The following models were trained and compared:
- Logistic Regression
- Random Forest Classifier
- Gradient Boosting Classifier
Evaluation used:
- Precision / Recall / F1-score
- Confusion Matrix
Selected model (Winner): Random Forest Classifier β best overall performance with fewer critical errors.
Confusion Matrix (selected model):
Saved artifact:
winning_classification_model.pkl
Repository Contents
winning_regression_model.pklβ final regression modelwinning_classification_model.pklβ final classification model- Project notebook (
.ipynb) README.md


