Telco Customer Churn PredictionOverview
Telco Customer Churn Prediction image 1
Telco Customer Churn Prediction image 2

01 · Overview

Overview

This is an end-to-end machine learning project that predicts whether a telecom customer will churn or stay. It works with the Telco Customer Churn dataset (7,043 rows, 20 features). The whole flow — cleaning data, training models, tuning hyperparameters, and saving the final model — is wrapped into one reusable pipeline.

02 · How I built this project

How I built this project

  1. Loaded and inspected the dataset with Pandas.
  2. Split the data into 80% train and 20% test, keeping the churn ratio the same in both.
  3. Built a preprocessing pipeline:
    • Numeric columns: median imputation + StandardScaler
    • Categorical columns: mode imputation + OneHotEncoder
    • Binary columns: passed through as-is
  4. Combined preprocessing with two models: Logistic Regression and Random Forest.
  5. Tuned both models with GridSearchCV (5-fold cross-validation).
  6. Compared the models on accuracy, precision, recall, F1, and ROC-AUC.
  7. Saved the best pipeline with Joblib so it can be reused with one line of code.

03 · Tech stack

Tech stack

  • Language: Python 3.11
  • Data handling: Pandas, NumPy
  • Machine learning: Scikit-learn (Pipeline, ColumnTransformer, GridSearchCV)
  • Models: Logistic Regression, Random Forest
  • Plots: Matplotlib, Seaborn
  • Model saving: Joblib

04 · Results

Results

ModelBest CV AUCTest AccuracyTest ROC-AUC
Logistic Regression0.55770.69840.5737
Random Forest0.55110.69910.5642
  • Logistic Regression won and was saved as the final model.
  • Top churn signals: tenure, MonthlyCharges, and Contract type.
  • Month-to-month customers churn the most.
  • The saved pipeline handles missing values on its own, so it works on raw data with no extra steps.

Code and more on GitHub

Repositories, experiments and smaller builds.

Open GitHub