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 AUC0.846
Average precision0.659
Precision @0.50.512
Recall @0.50.789
Brier0.163
Optuna trials25

Top features (gain)

cat__Contract_Month-to-month0.293
cat__OnlineSecurity_No0.154
cat__Contract_Two year0.078
cat__InternetService_Fiber optic0.053
cat__PaymentMethod_Electronic check0.046
cat__TechSupport_No0.045
cat__Contract_One year0.037
cat__InternetService_DSL0.036
cat__StreamingTV_Yes0.030
cat__StreamingMovies_Yes0.025

Latency (/predict, local loopback, one uvicorn worker)

Sequential p50 / p95 ms28.5 / 35.2
8 concurrent clients p50 / p95 ms305.6 / 401.4

Loopback HTTP against one local uvicorn process. Not a production SLO.

Drift (held-out baseline vs training reference)

Drifted columns1
Drift share0.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]