Skip to content

Ch 15: MLOps & Model Deployment - Intermediate

Track: Practitioner | Try code in Playground | Back to chapter overview

Read online or run locally

To run the code interactively, clone the repo and open chapters/chapter-15-mlops-and-model-deployment/notebooks/02_pipelines_cicd.ipynb in Jupyter.


Chapter 15: MLOps — Notebook 02 (Pipelines & CI/CD)

This notebook builds a reproducible sklearn Pipeline, sets up experiment tracking (MLflow with a JSON fallback), a file-backed model registry with stage transitions, and a GitHub Actions CI workflow that gates deploys on eval thresholds.

What you'll learn

Topic Section
sklearn Pipeline for reproducible preprocessing + model §1
Reproducibility: seeds, lockfiles, the data/code/model triplet §2
Experiment tracking with MLflow (and JSON fallback) §3
File-backed model registry: stages and promotion gates §4
CI/CD with GitHub Actions: lint → test → train → eval → register → deploy §5
Quality gates and deploy approvals §6

Time estimate: 2.5 hours


Key concepts

  • sklearn Pipeline — Preprocess + model in one object — same transform at train and serve.
  • Reproducibility triplet — Pin data version, code version, and model artifact together.
  • Experiment tracking — Log params, metrics, and artifacts every run; compare runs without guesswork.
  • Model registry — Stages (None / Staging / Production / Archived) gate which model serves traffic.
  • CI eval gates — A run only promotes if metrics beat the previous Production model.

Run the full notebook for code and outputs.


Generated by Berta AI