Skip to content

QuantumRizo/Telco_Churn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telco Customer Churn Prediction

📌 Project Objective

The goal of this project is to predict the likelihood of a Telco customer churning using Machine Learning techniques with Python and TensorFlow. This allows the company to implement retention strategies and reduce customer loss.


🗂 Project Structure


Telco_Churn/
├─ data/
│ ├─ raw/ # Original dataset downloaded from Kaggle
│ ├─ processed/ # Cleaned and transformed data
├─ notebooks/
│ └─ EDA.ipynb # Initial exploratory data analysis
├─ src/
│ ├─ preprocessing.py # Data cleaning and preprocessing functions
│ ├─ model.py # Model definition and training
│ ├─ evaluate.py # Model evaluation and metrics
│ └─ visualize.py # Visualization functions (Precision-Recall curve)
├─ outputs/
│ ├─ figures/ # Generated plots
│ └─ models/ # Saved trained models (.keras)
├─ requirements.txt # Project dependencies
├─ README.md # Project documentation
└─ run.py # Main script to execute the full pipeline

🛠 Tools and Libraries

  • Python 3.x
  • pandas, numpy
  • scikit-learn
  • TensorFlow
  • matplotlib

📈 Pipeline Overview

  1. Data Loading & Preprocessing

    • Load raw dataset and clean missing values.
    • Convert categorical variables using one-hot encoding.
    • Scale numerical features with StandardScaler.
  2. Model Training

    • Neural network built with TensorFlow/Keras.
    • Dense layers with ReLU activation and Dropout for regularization.
    • Binary classification using sigmoid output.
  3. Evaluation

    • Compute Precision, Recall, F1-score and ROC-AUC.
    • Calculate the best threshold to maximize F1-score.
  4. Visualization

    • Precision-Recall curve is saved in outputs/figures/.
    • Threshold that maximizes F1 is highlighted on the plot.
  5. Outputs

    • Trained model saved in outputs/models/.
    • Predictions can be exported for further analysis or Power BI dashboards.

📊 Metrics Example

After training, example results:

  • Accuracy: 0.76
  • ROC-AUC: 0.82
  • Best F1 Threshold: 0.54
  • Class 1 (Churners): Precision 0.53, Recall 0.74, F1 0.62

Precision-Recall Curve

Note: Metrics are computed on a hold-out test set. The threshold is optimized for business use-case to capture most churners while controlling false positives.


🚀 How to Run

  1. Clone the repository:
git clone https://github.com/quantumRizo/Telco_Churn.git

About

The goal of this project is to predict the likelihood of a Telco customer churning using Machine Learning techniques with Python and TensorFlow. This allows the company to implement retention strategies and reduce customer loss.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages