A machine learning project to predict median house values in California using the classic California Housing dataset. Achieved 82.38% accuracy with Random Forest Regressor.
This project uses the California Housing Prices dataset to build and evaluate a regression model for predicting median house prices based on features like location, rooms, population, and income.
Current Model Performance:
R² Score: 0.8238380642630709 (82.38% variance explained)
- Language: Python
- Notebook: Jupyter Notebook (house.ipynb)
- Libraries: pandas, numpy, scikit-learn, matplotlib/seaborn
- IDE: Visual Studio Code
- Dataset: Kaggle California Housing Prices
california-housing-prediction/
│
├── housing.csv # Dataset (20,640 samples, 10 features)
├── house.ipynb # Main analysis & ML pipeline
└── README.md # Project documentation
Source: California Housing Prices (Kaggle)
Features (10 total):
MedInc: Median income in block groupHouseAge: Median house age in blockAveRooms: Average number of rooms per householdAveBedrms: Average number of bedrooms per householdPopulation: Block populationAveOccup: Average number of household membersLatitude,Longitude: Block group locationocean_proximity: Proximity to ocean (categorical)median_house_value: Target (median house value in $100,000s)
Dataset Size: 20,640 samples × 10 features
- Clone/Download the repository
- Install dependencies:
pip install pandas numpy scikit-learn matplotlib seaborn jupyter
- Open
house.ipynbin VS Code or Jupyter - Run all cells to see the complete pipeline
- View results - R² score of 0.8238 on test set!
| Metric | Score |
|---|---|
| R² Score (Test Set) | 0.8238 |
| Status | ✅ Implemented up to forest.score(x_test_s, y_test) |
Model: Random Forest Regressor
- ✅ Data Loading - housing.csv
- ✅ EDA - Statistical analysis & visualizations
- ✅ Preprocessing - Handling categorical variables, scaling
- ✅ Train-Test Split
- ✅ Random Forest Model Training
- ✅ Model Evaluation - R² score: 0.8238
Random Forest R² Score: 0.8238380642630709
The model explains 82.38% of the variance in house prices!
- Hyperparameter tuning (GridSearchCV/RandomizedSearchCV)
- Cross-validation
- Feature importance analysis & visualization
- Compare with other models (XGBoost, LightGBM, Neural Networks)
- Model deployment (Flask/FastAPI)
- Interactive dashboard (Streamlit/Plotly Dash)
Open house.ipynb and run all cells sequentially. The notebook contains:
- Complete data preprocessing pipeline
- Exploratory data analysis with visualizations
- Model training and evaluation
- Performance metrics and interpretation
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
- California Housing Prices Dataset by @camnugent
- Scikit-learn documentation & examples
- YouTube Tutorial for initial inspiration
Built with ❤️ by Avani Parab | First-year CSE(AI&ML) Student