A Flask application that predicts customer churn based on user input. The application is built using Python and machine learning models to make predictions about customer churn probability. The app accepts customer details via a web form and returns a prediction along with the probability of churn.
- Project Overview
- Languages and Frameworks
- Features
- Requirements
- Setup and Installation
- Run the Application
- Run with Docker
- Future Directions
This project uses a machine learning model to predict whether a customer is likely to churn based on several customer features such as tenure
, monthly charges
, phone service
, etc. The model is integrated with a Flask web application to provide an interactive interface where users can input customer information and receive a churn prediction.
- Programming Language: Python
- Framework: Flask (Backend)
- Machine Learning: Scikit-learn
- Containerization: Docker
- Libraries:
- Pandas
- NumPy
- Joblib (for model persistence)
- Scikit-learn (for the machine learning model)
- Web-based interface to enter customer details.
- Predict customer churn using a pre-trained machine learning model.
- Display prediction result with probability.
- Containerized using Docker for easy deployment.
Make sure you have the following installed:
- Python 3.9 or later
- Flask
- Docker (if you plan to run the app inside a container)
git clone https://github.com/your-username/churn-prediction-app.git
cd churn-prediction-app
To avoid dependency conflicts, it's recommended to use a virtual environment.
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
Install the necessary Python packages listed in requirements.txt
:
pip install -r requirements.txt
After setting up the environment and installing dependencies, you can run the Flask app:
export FLASK_APP=app.py
export FLASK_ENV=development
flask run
To build the Docker image for the Flask app, run:
docker build -t churn-prediction-app .
Run the container mapping the local machine’s port 5000
to the container’s port 5000
:
docker run -p 5000:5000 churn-prediction-app
- Enhance the UI/UX to make it more visually appealing and intuitive.
- Add the ability to retrain the model with updated data directly through the web interface.
- Provide users with an option to upload bulk customer data for batch churn predictions.
- Allow users to export prediction results in formats like CSV or JSON.
- Add authentication and user management for enhanced security.