Academic / CourseworkMachine Learning~2 min read
Boston House Price Prediction
End-to-end regression pipeline comparing linear and tree models with Flask inference.
RoleML Developer
TimelineAug 2025
DomainMachine Learning
Core StackPython, Scikit-learn, Flask
What I Built#
I developed this project for a university machine learning course to practice taking a regression problem all the way from data analysis to a working web interface.
The application predicts residential property prices from 13 census attributes (like number of rooms, property tax rate, highway accessibility, and pupil-teacher ratios). I trained the models in Python using Scikit-Learn and deployed the inference endpoint using a lightweight Flask web application.

Click to view fullscreen
How It Works#
architecture-diagram.txt
Scroll
Web Browser Form
│
▼
┌──────────────────────────────┐
│ Flask Web Server │ (Parses input numbers into a NumPy array)
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ Serialized Scikit Pipeline │ (joblib.load('regmodel.pkl'))
│ ├── StandardScaler │ (Applies pre-fit scaling)
│ └── Regression Estimator │ (Linear / Ridge / Random Forest)
└──────────────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ HTML Template Prediction │ (Renders estimated price back to user)
└──────────────────────────────┘- 01Data Exploration & Cleaning: I analyzed the 13 census features using Pandas, identifying right-skewed variables (like crime rate and highway accessibility) and checking feature correlations against median home prices.
- 02Model Training & Comparison: I trained and evaluated multiple algorithms:
- Linear Regression as a baseline.
- Ridge Regression with L2 regularization to penalize large coefficients on correlated features.
- Random Forest Regressor to capture non-linear relationships.
- 03Pipeline Packaging: To ensure web requests don't fail due to missing or mismatched feature scaling, I bundled the
StandardScalerand model weights together into a single.pklfile usingjoblib. - 04Flask Interface: A simple HTML form accepts user inputs and passes them to a Flask route (
/predict_apiand/predict), which returns the estimated property value.

Click to view fullscreen
What I Learned#
- Bundle preprocessing with your model: Saving the scaler alongside the model into a single pipeline file eliminates bugs where raw, unscaled numbers get passed to the estimator during web inference.
- Visualizing correlations saves time: Plotting correlation heatmaps early on helped me quickly see which features (like number of rooms and lower status population percentage) had the strongest impact on home prices.
Complete Technology Stack
PythonScikit-learnFlaskPandasNumPy