$ cat telco-churn/README.md
Feb 2025 – Apr 2025 · CIS 579 Artificial Intelligence, University of Michigan-Dearborn · Dearborn, MI
Telecom churn prediction and retention advisor
Binary churn classification on the public Telco Customer Churn dataset (7,032 records), comparing Random Forest, a PyTorch ANN and XGBoost. A Streamlit app combines the models in an ensemble and feeds a local Gemma 3 4B to write retention guidance.
Role
This was a team project. My part was developing and testing the XGBoost model and the Gemma retention advisor.
Goal
Predict which customers will churn and surface retention guidance through a local LLM
Data
Public Telco Customer Churn dataset · 7,032 records · 80/20 train/test split
Stack
XGBoost · Random Forest · PyTorch (ANN) · scikit-learn · SMOTE · Streamlit · Ollama · Gemma 3 4B
82%
accuracy · XGBoost · 0.81 weighted F1 · held-out 20% test set
87%
recall on churners · recall-tuned ANN · 69% accuracy by design
A missed churner costs more than a false alarm
The unweighted ANN reached 74% accuracy by predicting "no churn" for every customer: majority-class collapse. That number looked fine on the surface but the model was useless. I re-optimized it for recall, because failing to identify a churner is more costly than a false positive, and that trade-off should be explicit.
01Compared Random Forest, a PyTorch ANN and XGBoost on an 80/20 train/test split.
02Tuned hyperparameters with GridSearchCV and handled class imbalance with SMOTE oversampling and balanced class weights.
03Feature importance was consistent across models: tenure, contract type and monthly charges dominated.
04Caught that the unweighted ANN was predicting "no churn" for every record. Re-optimized for recall to fix this.
Model comparison on the held-out 20% test set
| Model | Result |
| XGBoost | 82% accuracy, 0.81 weighted F1 (best) |
| Random Forest | 75% accuracy |
| ANN, unweighted | 74% accuracy, all predictions "no churn" |
| ANN, recall-tuned | 87% recall on churners, 69% accuracy |
Local LLM writes retention guidance from model output
The Streamlit app combines the three models in a soft-voting ensemble. A local Gemma 3 4B, served through Ollama, receives the latest model numbers, the churn risk score and customer fields in its prompt, and writes retention guidance. I switched from QwQ to Gemma 3 4B for latency.
- The soft-voting ensemble (81% accuracy, 0.78 macro-F1, 0.9 recall on the churn class) was scored on all 7,032 rows, training rows included, so these are not clean test results.
- This uses a public dataset, not live customer data.
XGBoostRandom ForestPyTorch (ANN)SMOTEGridSearchCVscikit-learnevaluation designmajority-class diagnosisrecall optimizationStreamlitOllamaGemma 3 4B