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.
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
- Python 3.x
- pandas, numpy
- scikit-learn
- TensorFlow
- matplotlib
-
Data Loading & Preprocessing
- Load raw dataset and clean missing values.
- Convert categorical variables using one-hot encoding.
- Scale numerical features with StandardScaler.
-
Model Training
- Neural network built with TensorFlow/Keras.
- Dense layers with ReLU activation and Dropout for regularization.
- Binary classification using sigmoid output.
-
Evaluation
- Compute Precision, Recall, F1-score and ROC-AUC.
- Calculate the best threshold to maximize F1-score.
-
Visualization
- Precision-Recall curve is saved in
outputs/figures/. - Threshold that maximizes F1 is highlighted on the plot.
- Precision-Recall curve is saved in
-
Outputs
- Trained model saved in
outputs/models/. - Predictions can be exported for further analysis or Power BI dashboards.
- Trained model saved in
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
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.
- Clone the repository:
git clone https://github.com/quantumRizo/Telco_Churn.git