Skip to content

About

California house price prediction — Random Forest Regressor on 20K homes (R² ~0.80, MAE ~K) with Flask web UI and 8 neighbourhood inputs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

House Price Predictor

A machine learning web app that predicts California house prices based on neighbourhood and property details.

Built as Project 3 of a 4-project Machine Learning series using the Zero to Mastery ML course as a learning foundation.


What It Does

  • Takes 8 neighbourhood/house inputs
  • Uses a trained Random Forest Regressor to predict the house value
  • Displays the estimated price in USD
  • Includes example values to try out

Model Performance

Metric Score
Algorithm Random Forest Regressor
Dataset California Housing (20,640 houses)
Training samples 16,512
Testing samples 4,128
R² Score ~0.80+
Mean Absolute Error ~$33,000

Tech Stack

Tool Purpose
Python Programming language
Scikit-Learn ML model + built-in dataset
NumPy Data handling
Flask Web server
HTML & CSS Frontend UI
Joblib Saving/loading the model

How to Run

1. Install dependencies

pip install flask scikit-learn numpy joblib

2. Train the model

python3 train_model.py

3. Start the web app

python3 app.py

4. Open in browser

http://127.0.0.1:5000

Project Files

house-price-predictor/
├── train_model.py       # Loads dataset, trains and saves the model
├── app.py               # Flask web server
├── model.joblib         # Saved trained model (generated after training)
├── templates/
│   └── index.html       # Web page with input form and result
└── static/
    └── style.css        # Styling

Input Features

Feature Description
MedInc Median income in block group (in $10,000s)
HouseAge Median house age in block group (years)
AveRooms Average number of rooms per household
AveBedrms Average number of bedrooms per household
Population Total population in the block group
AveOccup Average number of people per household
Latitude Geographic latitude of the block group
Longitude Geographic longitude of the block group

Example Values to Try

Affordable Area:

  • Income: 2.0, Age: 40, Rooms: 4, Beds: 2, Pop: 800, Occupants: 3, Lat: 36, Lon: -120

Expensive Area (San Francisco):

  • Income: 8.0, Age: 10, Rooms: 7, Beds: 3, Pop: 500, Occupants: 2, Lat: 37.77, Lon: -122.4

Data Source

California Housing Dataset built into Scikit-Learn (sklearn.datasets.fetch_california_housing). Originally from the 1990 California census.


Part of ML Projects Series

Project Description Status
Project 1 Heart Disease Predictor Done
Project 2 Car Price Predictor Done
Project 3 House Price Predictor Done
Project 4 Custom Dataset Predictor Coming soon

About

California house price prediction — Random Forest Regressor on 20K homes (R² ~0.80, MAE ~K) with Flask web UI and 8 neighbourhood inputs

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages