Customer churn is a critical business problem for telecom companies, as retaining existing customers is more cost-effective than acquiring new ones. This project focuses on predicting whether a customer will churn using historical telecom customer data.
Two models were built and compared:
- Logistic Regression (baseline ML model)
- Neural Network using PyTorch
The goal is to evaluate model performance and understand key factors influencing churn.
Predict whether a customer will churn (Yes/No) based on demographic details, account information, and service usage patterns.
customer-churn-pytorch/
│
├── data/
│ ├── raw_data.csv
│ ├── processed_data.csv
│
├── notebooks/
│ ├── 01_eda.ipynb
│ ├── 02_preprocessing.ipynb
│
├── src/
│ ├── linear_regression.py
│ ├── NeuralNetwork.py
│
├── results/
│ ├── confusion_matrix.png
│ ├── metrics.txt
│
├── requirements.txt
├── README.md
└── main.py
- Analyzed churn distribution and class imbalance
- Identified numerical vs categorical features
- Observed higher churn in month-to-month contracts and short-tenure customers
- Checked missing values and data consistency
- Converted target variable (Churn) to binary (0/1)
- Handled missing values
- One-hot encoded categorical variables
- Scaled numerical features using StandardScaler
- Addressed class imbalance using class weights
- Baseline classification model
- Used class weighting to handle imbalance
- Fully connected feedforward neural network
- Binary classification using BCEWithLogitsLoss
Metrics used:
- Accuracy
- Precision
- Recall
- F1-score
- Confusion Matrix
| Model | Accuracy |
|---|---|
| Logistic Regression | ~75% |
| PyTorch Neural Network | ~77% |
- Clone the repository
git clone https://github.com/your-username/Customer-Churn-Prediction.git
cd Customer-Churn-Prediction- Install dependencies
pip install -r requirements.txt-
Run notebooks for EDA and preprocessing
-
Run models
python main.py- Python
- Pandas, NumPy
- Scikit-learn
- PyTorch
- Matplotlib, Seaborn
- End-to-end ML workflow
- Handling class imbalance
- Comparing ML and Deep Learning models
- Structuring ML projects for GitHub
Mouli Shankar
Aspiring Data Scientist | Machine Learning | Analytics