DEV Community

Cover image for From Jupyter Notebook to Production: Building an Enterprise MLOps Pipeline for Churn Prediction
kim40404
kim40404

Posted on

From Jupyter Notebook to Production: Building an Enterprise MLOps Pipeline for Churn Prediction

Introduction

One of the biggest traps in Data Science is the "Jupyter Notebook Illusion." It’s easy to train a model with 95% accuracy, but it’s completely useless if it never leaves the notebook. Recently, I challenged myself to build not just a Machine Learning model, but a fully containerized, production-ready Enterprise MLOps Pipeline to predict Telecommunications Customer Churn.

In this article, I want to share how I architected the system, handled imbalanced data, and built a "Quiet Luxury" Executive Dashboard to serve the predictions.

The Architecture

I decoupled the system into three main layers to ensure scalability:

  1. The Brain (Model & Tracking): I used XGBoost combined with SMOTE to handle the severe class imbalance in churn datasets. To make sure every experiment is reproducible, I integrated MLflow to track metrics (accuracy, f1-score) and log the model artifacts.
  2. The Engine (Serving): The model is served using FastAPI, creating a low-latency RESTful API. The entire backend is containerized using Docker.
  3. The Eyes (Telemetry & UI): To ensure the system's health in production, I set up Prometheus to scrape metrics and Grafana for real-time visualization. Finally, I built a dark-themed, interactive Web Dashboard for the executives to consume the AI predictions effortlessly.

Handling The "Black Box" Problem

Executives don't just want a probability score; they want to know why. To solve this, I integrated SHAP (SHapley Additive exPlanations). Now, the dashboard doesn't just say "94% risk of churn", it actually breaks down the exact features (e.g., Month-to-month contract, Fiber optic) that are driving that prediction.

The Result

You can see the fully interactive architecture and the dashboard in action in my GitHub repository. I’ve open-sourced the entire codebase, including the Docker Compose setups and the UI templates.

👉 Check out the full Repository here: https://github.com/kim40404/mlops-churn-dicoding

If you find the repository helpful, I would highly appreciate a Star ⭐! Let me know in the comments if you have any questions about deploying XGBoost models with FastAPI or setting up MLflow.

Top comments (0)