Analyzing customer behavior and building a machine learning model to predict churn — helping telecom businesses retain customers before it's too late.
Customer churn is one of the most critical challenges in the telecom industry. This project digs into real customer data to uncover why customers leave and builds a predictive model to identify at-risk customers early, enabling data-driven retention strategies.
- Analyze customer data to understand churn patterns
- Identify key factors driving customer churn
- Build and evaluate ML models to classify churn vs. non-churn
- Deliver actionable business recommendations to reduce churn
| Property | Details |
|---|---|
| Source | Telco Customer Churn Dataset |
| Records | ~7,000 customers |
| Key Features | Tenure, monthly charges, contract type, internet service, payment method, and more |
- Handled missing values in
TotalCharges - Removed duplicate records
- Corrected data types for numerical columns
- Encoded categorical variables for model compatibility
Key patterns discovered in the data:
| Insight | Finding |
|---|---|
| 🕐 Early churn risk | ~50% of churn occurs within the first year |
| 💸 Pricing pressure | Customers with higher monthly charges churn more |
| 📄 Contract type | Month-to-month contracts show the highest churn rate |
| 🌐 Internet service | Fiber optic users show unexpectedly high churn |
| 🛡️ Support services | Customers without tech support or security services churn more |
- Logistic Regression — interpretable baseline model
- Random Forest — ensemble model for improved performance
- Feature scaling
- Class imbalance handling via
class_weight='balanced' - Threshold tuning to optimize recall for the churn class
| Metric | Result |
|---|---|
| Accuracy | ~79% |
| Recall (Churn) | Improved via class balancing and threshold tuning |
Recall was prioritized for the churn class — it's more costly to miss a churning customer than to flag a loyal one.
- First-year experience is critical — the majority of churn happens early in the customer lifecycle
- Pricing dissatisfaction is a significant churn trigger
- Absence of value-added services (tech support, online security) weakens retention
- Flexible/short-term contracts increase churn risk compared to annual or two-year plans
- Payment friction may be contributing to voluntary churn
- 🚀 Strengthen onboarding — invest in first-year customer engagement programs
- 💰 Offer targeted discounts — reward high-value or at-risk customers proactively
- 🛡️ Bundle support services — promote tech support and security add-ons
- 📅 Incentivize long-term contracts — discounts or perks for annual commitments
- 💳 Improve payment experience — simplify billing and diversify payment options
| Library | Purpose |
|---|---|
pandas / numpy |
Data manipulation and analysis |
seaborn / matplotlib |
Data visualization |
scikit-learn |
Model building, evaluation, and preprocessing |
# Clone the repository
git clone https://github.com/akshaypal912/telco-churn-prediction.git
cd telco-churn-prediction
# Install dependencies
pip install -r requirements.txt
# Launch notebooks
jupyter notebookThis project is open source and available under the MIT License.