IT 545 Python for Data Analytics · Walsh College · Winter 2025
House price prediction
Five property features, three regression models: this page refits her linear, ridge and lasso models on the Kaggle house sales data and lets you price a home yourself.
-test R² of linear regression on her exact 80/20 split
-typical error (MAE) on unseen homes
Live demo
Three regression models are refit in your browser on every change and scored on the held-out 20% of homes.
Test-set scores (- homes)
Price estimator
-
Results
Both charts follow the current split and alpha settings.
Predicted vs actual price, test homes
Effect of a one-standard-deviation increase
How it works
Loaded the Kaggle House Prices data with pandas, checked missing values and filled numeric gaps with column means.
Explored relationships with a correlation heatmap and picked five strong, easy-to-explain predictors: overall quality, above-ground living area, garage capacity, basement area and year built.
Split the homes 80/20 into training and test sets with random_state=42.
Trained scikit-learn Linear Regression, Ridge (alpha=1) and Lasso (alpha=0.1), and evaluated them with mean squared error and R².
Plotted predicted against actual prices to check fit. The notebook's printed results were not saved, so this page re-runs the same pipeline on the Kaggle training data: linear regression by normal equations, ridge and lasso by coordinate descent on standardized features.
Data
First 10 rows of the embedded extract. OverallQual is rated 1 to 10; areas are in square feet; GarageCars is garage capacity in cars.