ml-serving-pipeline
Telco churn: Pandera validation, XGBoost tuned with Optuna, MLflow registry, FastAPI serving, MongoDB prediction log, Evidently drift, Docker/K8s.
Source on GitHub. Static demo built from committed artifacts by CI; the live API is not hosted.
Model v1 (held-out test, n=1409)
| ROC AUC | 0.846 |
| Average precision | 0.659 |
| Precision @0.5 | 0.512 |
| Recall @0.5 | 0.789 |
| Brier | 0.163 |
| Optuna trials | 25 |
Top features (gain)
| cat__Contract_Month-to-month | 0.293 |
| cat__OnlineSecurity_No | 0.154 |
| cat__Contract_Two year | 0.078 |
| cat__InternetService_Fiber optic | 0.053 |
| cat__PaymentMethod_Electronic check | 0.046 |
| cat__TechSupport_No | 0.045 |
| cat__Contract_One year | 0.037 |
| cat__InternetService_DSL | 0.036 |
| cat__StreamingTV_Yes | 0.030 |
| cat__StreamingMovies_Yes | 0.025 |
Latency (/predict, local loopback, one uvicorn worker)
| Sequential p50 / p95 ms | 28.5 / 35.2 |
| 8 concurrent clients p50 / p95 ms | 305.6 / 401.4 |
Loopback HTTP against one local uvicorn process. Not a production SLO.
Drift (held-out baseline vs training reference)
| Drifted columns | 1 |
| Drift share | 0.053 |
Full Evidently report
Architecture
flowchart LR
csv[Telco CSV] --> val[Pandera] --> train[XGBoost + Optuna] --> mlflow[MLflow registry]
mlflow --> api[FastAPI /predict /predict/batch /model]
api --> mongo[(MongoDB prediction log)]
mongo --> drift[Evidently /drift]
api --> k8s[Docker / K8s HPA]