Customer Churn Scoring API
Single-record JSON scoring: churn probability, binary label (F1-tuned threshold from training export), and a coarse risk band. Request/response schema: /docs. Interactive form below calls same-origin POST /predict.
About this service
What it does. Contract, tenure, charges, and service flags → churn probability, binary label (F1-tuned threshold), and a risk band.
Implementation. Feature preprocessing and trained estimator in one sklearn pipeline; metrics/threshold read from training outputs at startup/inference.
- GET /meta — optional hold-out metrics summary when configured
- GET /health — liveness and model artifact presence
- GET /openapi.json — machine-readable API contract
Training code and notebooks: Customer-Churn-Prediction-System on GitHub.
Hold-out test metrics
Best model by test ROC-AUC. F1 below is from metrics export; live API uses F1-tuned threshold.
Key findings
From EDA and modeling — detail in repo notebooks.
- Class balance. ~27% churn; stratified split.
- Who churns. Month-to-month and shorter tenure dominate.
- Models. Multiple candidates compared; API serves ROC-AUC winner.
- Threshold. F1-tuned on the test set — not fixed 0.5.
python scripts/generate_figures.py, then place
reports/figures/model_comparison.png at src/api/static/model_comparison.png (or mount/copy beside the app).
Notebooks on GitHub — 01 EDA, 02 features, 03 models, 04 threshold.
Limitations
- Dataset. Public teaching data — not production distribution.
- Churn definition. Snapshot label; real goals may need different cutoffs.
- Ops. No retraining, drift, or monitoring in this deployment surface.