Machine learning

House Price Prediction

A supervised linear-regression model trained on 1,600 homes to predict sale price from six features. This page runs the real trained model, the exact learned weights, right in your browser. Drag any feature and the prediction updates live. Test-set accuracy: R² = 0.94 on the 400 homes it never saw.

C++ scikit-learn pandas NumPy Matplotlib

How it works

01

Ordinary least squares

Features are standardized, then the coefficients are solved in closed form with the normal equation. No gradient descent needed at this size. This page predicts with those exact weights.

02

Held-out evaluation

The model trains on 1,600 homes and is scored on 400 it never saw. Every metric above (, RMSE, MAE) comes from that held-out set.

03

Comparable importance

Raw coefficients are in different units (dollars per square foot vs. dollars per bathroom), so the influence bars rescale each one by its feature's spread before comparing them.

Try the model

Predicted price $0 price = intercept + Σ (weight × feature)

Model performance

R² score
variance explained
RMSE
typical error
MAE
avg. abs. error
Train / Test
80 / 20 split

These score the trained model against the 400 held-out homes, so they stay fixed as you move the sliders. They describe the model itself, not the home you configured.

What the model learned

Actual vs. predicted

Each dot is a test home the model never saw during training. The grey diagonal is a perfect prediction, so the tighter the cloud hugs it, the better the fit. Here it explains 94% of the variance in price. The coloured line tracks the home you configured above: it has no actual sale price to plot against, so it sits on the predicted axis and moves as you drag.

How it works: features are standardized, then a linear regression is fit two ways, gradient descent (SGDRegressor) and the closed-form normal equation (LinearRegression), then evaluated on a held-out 20% test set. This demo uses the trained weights directly, so every prediction above is the genuine model output, not an approximation. The dataset is synthetic, 2,000 generated houses; no real sales data is involved. To see how long one of those predictions takes on your own machine, run the inference benchmark. See the source and write-up.