Skip to content

Repository files navigation

Customer Churn Classification System

An end-to-end machine learning application that predicts whether a telecom customer is likely to churn based on customer, service, contract, and billing information.

The project combines data analysis, preprocessing, classification, model evaluation, input validation, and a Flask web application to turn a machine learning model into an interactive prediction system.


Problem

Customer churn is a major challenge for subscription-based businesses.

The objective of this project is to identify customers who are likely to leave a telecom service so that businesses can better understand churn risk and potentially take preventive action.

The system follows this workflow:

Customer Information
        ↓
Input Validation
        ↓
Preprocessing
        ↓
Trained Classification Model
        ↓
Churn Probability
        ↓
Prediction Result

What I Built

This project includes:

  • Exploratory Data Analysis
  • Data preprocessing
  • Logistic Regression classification
  • Model evaluation using multiple metrics
  • Customer input validation
  • Reusable prediction logic
  • Flask-based web application
  • HTML/CSS user interface
  • Saved trained model for inference
  • Deployment configuration

The project separates experimentation, data, model artifacts, prediction logic, and application code rather than keeping everything inside a single notebook.


Model Performance

The current model achieves the following results:

Metric Score
Accuracy 81.83%
ROC-AUC 86.19%
Precision 68.00%
Recall 59.25%
F1 Score 63.32%

Why multiple metrics?

Accuracy alone does not provide enough information for a churn prediction problem.

Therefore, the model is evaluated using:

  • Accuracy — overall proportion of correct predictions
  • Precision — proportion of predicted churners who actually churn
  • Recall — proportion of actual churners identified by the model
  • F1 Score — balance between precision and recall
  • ROC-AUC — ability of the model to distinguish between churn and non-churn customers across classification thresholds

The current results indicate useful predictive performance while leaving room for improvement, particularly in recall.


Dataset

The project uses the Telco Customer Churn dataset.

The target variable is:

Churn
├── Yes
└── No

The dataset contains customer information related to areas such as:

  • Demographics
  • Tenure
  • Phone services
  • Internet services
  • Contract type
  • Billing
  • Payment method
  • Additional subscribed services

Project Structure

Customer_Churn_Classification_System/
│
├── .gitignore
├── app.py
├── README.md
├── requirements.txt
├── vercel.json
│
├── assests/
│   └── screenshots/
│
├── data/
│   ├── preprocessed/
│   └── raw/
│       └── Telco Customer Churn.csv
│
├── model/
│   └── customer_churn_model.pkl
│
├── notebooks/
│   └── EDA.ipynb
│
├── static/
│   └── css/
│       └── style.css
│
├── templates/
│   ├── index.html
│   └── result.html
│
└── utils/
    └── prediction.py

Directory responsibilities

Component Purpose
app.py Flask application entry point
utils/ Reusable prediction logic
notebooks/ Exploratory data analysis and experimentation
data/raw/ Original dataset
data/preprocessed/ Processed data
model/ Saved trained model
templates/ HTML pages
static/ CSS and frontend assets
assests/ Project screenshots/assets
requirements.txt Python dependencies
vercel.json Deployment configuration

Application Flow

The application accepts customer information through a web interface.

User Input
    ↓
Flask Application
    ↓
Input Validation
    ↓
Prediction Logic
    ↓
Saved ML Model
    ↓
Churn Prediction
    ↓
Result Page

The prediction logic is kept separately in:

utils/prediction.py

This keeps the model inference logic separate from the Flask application's routing and presentation layer.


Validation

Before making a prediction, the application validates user-provided information to reduce invalid or inconsistent inputs.

This includes checking values and expected input categories before passing the data to the model.

The purpose is simple:

Invalid input should not silently become a model prediction.


Tech Stack

Programming

  • Python

Data & Machine Learning

  • Pandas
  • NumPy
  • Scikit-learn
  • Jupyter Notebook

Web Application

  • Flask
  • HTML
  • CSS

Deployment

  • Vercel

Version Control

  • Git
  • GitHub

Running Locally

1. Clone the repository

git clone https://github.com/GowthamV-CoderX/Customer_Churn_Classification_System.git
cd Customer_Churn_Classification_System

2. Create a virtual environment

python -m venv .venv

3. Activate the environment

Windows

.venv\Scripts\activate

macOS / Linux

source .venv/bin/activate

4. Install dependencies

pip install -r requirements.txt

5. Run the application

python app.py

Open the application at:

http://127.0.0.1:5000

Limitations

This project is currently a machine learning portfolio/application project rather than a fully productionized ML system.

Areas that can be improved include:

  • Automated testing
  • Systematic model comparison
  • Cross-validation
  • Threshold optimization
  • Improved recall
  • Model explainability
  • Database integration
  • API separation
  • Dockerization
  • CI/CD
  • Application monitoring
  • Model/data drift monitoring

These limitations are useful next steps for evolving the project toward stronger ML engineering practices.


Future Improvements

Potential improvements include:

  1. Compare multiple classification algorithms systematically.
  2. Optimize the prediction threshold based on business objectives.
  3. Improve recall while maintaining acceptable precision.
  4. Add automated tests for validation and prediction logic.
  5. Separate the prediction service into a dedicated API.
  6. Containerize the application with Docker.
  7. Add CI/CD for automated testing and deployment.
  8. Add model explainability.
  9. Introduce monitoring for application and model behavior.
  10. Evaluate model performance on new incoming data.

Key Learning Outcomes

Through this project, I developed practical experience with:

  • Classification problems
  • Exploratory data analysis
  • Data preprocessing
  • Logistic Regression
  • Classification metrics
  • Model inference
  • Input validation
  • Reusable Python modules
  • Flask application development
  • Connecting a machine learning model to a web application
  • Structuring an ML project beyond a single notebook
  • Deploying a machine learning application

Author

Gowtham Vudumu

B.Tech CSE (AI & ML)

Focused on building stronger capabilities in:

Machine Learning → Software Engineering → AI Engineering → Real-World Problem Solving


License

This project is developed for educational and portfolio purposes.

About

End-to-end telecom customer churn prediction system built with Python, Scikit-learn and Flask.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages