This project implements a house price prediction system using machine learning models. It is an end-to-end machine learning project integrated with Flask for web deployment.
The goal of this project is to predict the price of houses in Bangalore based on various features such as:
- Location
- Total square feet area
- Number of bathrooms
- Number of bedrooms (BHK)
The project provides a web-based interface for users to input house details and get price predictions instantly.
- Predicts house prices based on user input.
- Web-based interface for easy interaction.
- Multiple machine learning models tested to select the best one.
- Uses Ridge Regression as the final model after evaluation.
- End-to-end ML project integrated with Flask.
house_price_prediction/
│
├── app.py # Flask application
├── dataset/ # Dataset used for training
├── model/ # Saved model and preprocessing objects
├── templates/ # HTML templates for the web interface
├── Dockerfile # Docker configuration
└── README.md # Project documentation
Several machine learning models were trained and evaluated using 5-Fold Cross-Validation.
| Model | Mean Cross-Validation R² Score |
|---|---|
| Linear Regression | 0.8413 |
| Lasso Regression | 0.8333 |
| Ridge Regression | 0.8413 |
| Decision Tree Regressor | 0.7397 |
| Random Forest Regressor | 0.7869 |
| XGBoost Regressor | 0.8328 |
- Best Model Before Tuning: Ridge Regression
- Final Selected Model: Ridge Regression
Performance on Test Set:
- R² Score: 0.8016
- Mean Absolute Error (MAE): 19.6350
- Root Mean Squared Error (RMSE): 39.9124
Why Ridge Regression?
- Performs comparably to Linear Regression while adding regularization to prevent overfitting.
- Achieved the highest cross-validation score alongside Linear Regression.
- Provides stable and reliable predictions on the test set.
- Clone the repository:
git clone https://github.com/kindo-tk/house_price_prediction.git- Navigate to the project directory:
cd house_price_prediction-
Create and activate a virtual environment:
Windows:
python -m venv .venv .venv\Scripts\activate
macOS/Linux:
python3 -m venv .venv source .venv/bin/activate -
Install the required packages:
pip install -r requirements.txt- Run the Flask application:
python app.py- Open your browser and go to:
http://localhost:5000
If you prefer using Docker, you can pull the pre-built image from Docker Hub and run it instantly:
-
Pull the Docker Image:
docker pull kindotk/house_price_prediction
-
Run the Container:
docker run -p 5000:5000 kindotk/house_price_prediction
-
Access the Application:
Open your browser and navigate to
http://localhost:5000.
-
Enter the required house details:
- Location
- Total square feet area
- Number of bathrooms
- Number of bedrooms (BHK)
-
Click Predict Price to see the estimated house price.
- Python
- Flask
- HTML/CSS
- Bootstrap
- scikit-learn
- XGBoost
- Babel (for Indian currency formatting)
This project is licensed under the MIT License. See LICENSE for details.
For any inquiries or feedback, please contact:

