1 / 11
Take a machine learning model from a notebook to a reliable production system: reproducible Python projects, data validation, scikit-learn feature pipelines, MLflow experiment tracking and model registry, pytest for data, models, and APIs, GitHub Actions CI/CD, FastAPI serving, containers, batch…
Taking Machine Learning Models from Notebook to Production with MLflow, FastAPI, and CI/CD
Read before you buy: the PDF here is a free sample — the first 20 pages of the 463-page book (payments, sales and reviews on this demo site are sample data). Get the full e-book at thenexbooks on Gumroad.
Training a model is the easy part. This book teaches everything that comes after.
A model that scores well in a notebook still has to run every month, reproduce its numbers, reject bad data, reach the systems that need its predictions, survive a release, and tell you when it stops working. MLOps is the set of engineering habits that makes that possible — and the best way to learn them is to apply them to one real project from start to finish.
This book does exactly that. You build a complete, working churn-prediction system with widely used open-source tools — scikit-learn, MLflow, FastAPI, pytest, and GitHub Actions — and you learn the ideas underneath them, so the lessons carry over to whatever platform your team uses.
What's inside
- What MLOps really is for classic machine learning, and how to frame a model around a business decision and its capacity limits
- A clean, packaged Python project: src layout, typed YAML configuration, pinned dependencies, lock files, and reproducible runs with seeds and data fingerprints
- A seeded synthetic data generator and a data contract that catches missing IDs, duplicates, out-of-range values, and unknown categories before they reach a model
- Feature pipelines with scikit-learn, custom transformers, and how to prevent leakage and training–serving skew
- Experiment tracking with MLflow: parameters, metrics, tags, artifacts, and comparing runs to choose a model with evidence
- A config-driven training pipeline with a quality gate, evaluation beyond accuracy (thresholds, calibration, slices, business cost), and the MLflow Model Registry with versions, aliases, and promotion
- Model packaging: MLflow models, signatures, bundled code, and safe serialization
- Testing with pytest: unit tests for data and features, model quality gates, behavioral tests, and API tests
- CI/CD with GitHub Actions: test and training workflows, scheduled retraining, environments, and release gates
- Online serving with FastAPI: Pydantic validation, health checks, batch endpoints, request IDs, logging, and performance basics
- Containers for ML services, batch scoring with partitioned and idempotent outputs, and release strategies: shadow mode, canaries, A/B tests, and rollback
- Monitoring and operations: prediction logs, delayed labels, drift with PSI and the KS test, prediction drift, champion-vs-challenger retraining, model cards, and audit trails
One running example, start to finish. You build the churn model for Fairhollow Broadband, a fictional regional internet provider whose retention team can call only a fifth of its customers each month. The project grows from a single script into a tested, versioned, served, and monitored system with a prediction API, a monthly batch job, a drift report, and a retraining job. Then a network slowdown and a competitor's fiber launch change the data — and you watch the monitoring catch it, retrain, and promote a better model. The data is generated from a fixed seed, so every number in the book can be reproduced on your machine.
Current and honest. The Python code was run with Python 3.12, scikit-learn 1.9, pandas 3.0, MLflow 3.17, FastAPI, and pytest on a CPU-only machine, and the book shows real output. Container builds and GitHub Actions workflows are clearly labeled as written but not executed in the book's environment. There are no invented benchmarks or statistics. Every chapter includes runnable code, Tips, Notes, Warnings, a "Try It Yourself" section, and Key Takeaways, and the appendices give you a cheat sheet, templates and reference material, a production checklist, and a glossary.
Format: PDF, 463 pages (A4), linked table of contents and bookmarks. English. First Edition, 2026. Published by thenexbooks. Requires basic Python and some familiarity with training a simple model. This book is independent and is not affiliated with, sponsored by, or endorsed by the MLflow project, Docker, Inc., GitHub, or any other vendor.
Table of Contents
Part I — Foundations
- Ch 1 · What MLOps Is: From Notebook to Production
- Ch 2 · Framing the Churn Problem: Business Goals, Metrics, and a Baseline
- Ch 3 · Project Structure: The src Layout, Packaging, and Configuration
- Ch 4 · Reproducible Environments: Python Versions, Dependencies, and Lock Files
- Ch 5 · Reproducible Runs: Seeds, Data Fingerprints, and Deterministic Pipelines
Part II — Data and Features
- Ch 6 · The Fairhollow Dataset: A Seeded Synthetic Data Generator
- Ch 7 · Data Validation: Schemas, Contracts, and Quality Checks
- Ch 8 · Feature Pipelines with scikit-learn: ColumnTransformer and Custom Transformers
- Ch 9 · Training–Serving Skew and Leakage: Keeping Features Consistent
- Ch 10 · Data and Model Versioning: Hashes, Manifests, and Lineage
Part III — Experiments and the Model Registry
- Ch 11 · Experiment Tracking with MLflow: Runs, Parameters, Metrics, and Artifacts
- Ch 12 · The Training Pipeline: From Config File to Registered Model
- Ch 13 · Evaluation Beyond Accuracy: Thresholds, Calibration, Slices, and Business Cost
- Ch 14 · The MLflow Model Registry: Versions, Aliases, and Promotion
- Ch 15 · Model Packaging: MLflow Models, Signatures, and Safe Serialization
Part IV — Testing and Automation
- Ch 16 · Testing ML Code: Unit Tests for Data, Features, and Pipelines with pytest
- Ch 17 · Testing Models: Quality Gates, Behavioral Tests, and Regression Checks
- Ch 18 · CI for ML with GitHub Actions
- Ch 19 · Continuous Training and Delivery: Pipelines, Triggers, and Release Gates
Part V — Deployment and Serving
- Ch 20 · Serving Predictions with FastAPI
- Ch 21 · Hardening the Prediction Service: Validation, Errors, Logging, and Performance
- Ch 22 · Containers for ML: Dockerfiles, Images, and Runtime Configuration
- Ch 23 · Batch Scoring: Scheduled Jobs, Partitions, and Idempotent Outputs
- Ch 24 · Deployment Strategies: Shadow Mode, Canaries, A/B Tests, and Rollback
Part VI — Monitoring and Operations
- Ch 25 · Monitoring ML Systems: Service Health, Prediction Logs, and Delayed Labels
- Ch 26 · Detecting Drift: PSI, KS Tests, and Prediction Drift
- Ch 27 · Retraining: Triggers, Champion vs Challenger, and Safe Promotion
- Ch 28 · Governance and Case Study: Model Cards, Audit Trails, and the Fairhollow Platform
Appendices
A · MLOps Cheat Sheet
B · Templates and Reference
C · Production Checklist
D · Glossary
Book details
| Detail | |
|---|---|
| Pages | 463 |
| Format | PDF (A4) |
| Language | English |
| Level | Intermediate |
| Edition | 1st Edition (2026) |
| Download on this site | Free sample, first 20 pages (PDF) |
| Publisher | thenexbooks |
Files you get
No reviews yet. Only buyers can review.
More from thenexbooks