This project is an end-to-end machine learning web application that predicts the prices of houses in Boston, Massachusetts. The application uses a linear regression model that was trained on the Boston Housing dataset to predict house prices based on various features such as the number of rooms, crime rate, and pupil-teacher ratio. The model is based on Linear Regression, and the predictions are made using Flask API.
This project focuses on predicting the prices of houses in the Boston area based on various factors such as the number of rooms, area, location, and other factors. The trained machine learning model can be deployed using the Flask API provided in this repository.
To run and deploy this project, you will need the following software and tools:
Create a new environment using conda:
conda create -p venv python==3.9 -y
The following files are included in this project:
File | Description |
---|---|
app.py |
This file contains the Flask API code that loads the trained model and serves the predictions. |
Dockerfile |
This file contains the configuration for building the Docker container for deployment. |
Linear_Regression.ipynb |
This Jupyter notebook contains the code for training the machine learning model and generating the two pickle files (scaling.pkl and regmodel.pkl ). |
LICENSE |
This file contains the license information for the project. |
Procfile |
This file contains the command to run the Flask app on Heroku. |
regmodel.pkl |
This file contains the trained machine learning model saved in a pickle format. |
requirements.txt |
This file contains the list of Python packages required to run the Flask app. |
scaling.pkl |
This file contains the fitted StandardScaler object saved in a pickle format. |
templates |
This directory contains the HTML templates for the Flask app. |
venv |
This directory contains the Python virtual environment. |
The following Python packages are required to run the Flask app:
- Flask
- scikit-learn
- pandas
- numpy
- matplotlib
- gunicorn
- sklearn
To run the application, activate the virtual environment using the following command:
source venv/bin/activate
Install the required packages using the following command:
pip install -r requirements.txt
Then, start the Flask app using the following command:
python app.py
The app should now be running on http://localhost:5000/
.
To deploy the application on Heroku, follow these steps:
- Create a new Heroku app using the Heroku CLI or the Heroku Dashboard.
- Set up a new Git repository for the project using the following
- The application can be run locally by running the
app.py
file. - The application can be accessed by navigating to
http://localhost:5000
in a web browser.
This project is licensed under the MIT License. See the LICENSE
file for details.