πŸ‘‹ Work With Me

I help startups and teams build production-ready apps with Django, Flask, and FastAPI.

Let’s Talk β†’

I'm always excited to take on new projects and collaborate with innovative minds.

Address

No 7 Street E, Federal Low-cost Housing Estate, Kuje, Abuja 903101, Federal Capital Territory

Social Links

Project

Customer Churn Prediction Model

Customer churn is a major challenge for telecom businesses. Using machine learning, I built a classification model that predicts whether a customer is likely to leave (churn) based on their service usage, tenure, and demographics.

Client

Customer Churn Prediction Model

Goal:
Predict customer churn for a telecom company using Machine Learning.

Tech Stack:

  • Python
  • Pandas & NumPy (data wrangling)
  • Scikit-learn (modeling & evaluation)
  • Matplotlib & Seaborn (visualization)

πŸ” Project Overview

Customer churn is a major challenge for telecom businesses. Using machine learning, I built a classification model that predicts whether a customer is likely to leave (churn) based on their service usage, tenure, and demographics.

  • Dataset: 5,000+ customer records
  • Approach: Data cleaning β†’ EDA β†’ Feature Engineering β†’ Model Training β†’ Evaluation
  • Result: Achieved 85% accuracy with a tuned Random Forest classifier.

πŸ“‚ Workflow

Β 
flowchart TD
A[Data Collection] --> B[Data Cleaning]
B --> C[Exploratory Data Analysis]
C --> D[Feature Engineering]
D --> E[Model Training]
E --> F[Model Evaluation]
F --> G[Deployment/Insights]

πŸ› οΈ Steps

1. Data Cleaning

  • Handled missing values in TotalCharges.
  • Encoded categorical variables (e.g., Gender, Contract type).
  • Standardized numerical features.
Β 
import pandas as pd

# Load dataset
df = pd.read_csv("telecom_churn.csv")

# Handle missing values
df['TotalCharges'] = pd.to_numeric(df['TotalCharges'], errors='coerce')
df['TotalCharges'].fillna(df['TotalCharges'].median(), inplace=True)

# Encode categorical features
df = pd.get_dummies(df, drop_first=True)

2. Exploratory Data Analysis (EDA)

  • Churn rate was ~26% overall.
  • Higher churn among customers with month-to-month contracts.
  • Longer tenure customers were less likely to churn.
Β 
import seaborn as sns
import matplotlib.pyplot as plt

sns.countplot(x="Churn", data=df)
plt.title("Churn Distribution")
plt.show()

πŸ“Š Insight: Customers on shorter contracts + multiple support calls were more likely to leave.


3. Model Training & Tuning

Β 
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report, confusion_matrix

# Split data
X = df.drop("Churn", axis=1)
y = df["Churn"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Train model
rf = RandomForestClassifier(random_state=42)
rf.fit(X_train, y_train)

# Evaluate
y_pred = rf.predict(X_test)
print(classification_report(y_test, y_pred))

Best Result:

  • Accuracy: 85%
  • Precision: 82%
  • Recall: 80%

4. Outcome

βœ… Business Value:

  • Helps identify at-risk customers before they leave.
  • Enables targeted retention campaigns β†’ reduces churn, increases revenue.

πŸš€ Links


✨ This project highlights my skills in data cleaning, exploratory analysis, and building ML models that solve real-world business problems.

Share

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies. Cookie Policy