Suffolk University • Sawyer Business School

Ship It — Deployment, Monitoring & Your Prediction Story

Persist the pipeline, track it, put a front end on it, watch it drift, know the rules — then the night the course was built for: your prediction stories, presented

Session 13 of 13 · Mon Dec 14
Module: Finale
150 Minutes
Mondays 5:00 PM
Hands-On Learning
01 // LEARNING OBJECTIVES

What You'll Learn Today

By the end of tonight you'll have both the concept and the working code — every objective maps to a cell you run yourself.

01

Ship a Pipeline, Not a Model

joblib.dump the whole fitted Pipeline — preprocessing and all — so scoring a new customer is one line and the encoder can't drift from the model.

02

Track, Serve, and Monitor

MLflow to record every experiment, Gradio to give a model a face in ten lines, Evidently to detect when the data feeding the model no longer looks like the data that trained it.

03

Know the Rules of the Road

The EU AI Act's risk tiers and AI-literacy duty, the deferred high-risk deadlines for credit and hiring, and the US state laws (Colorado, Jan 2027) requiring explanation and human review for consequential automated decisions.

04

Tell a Prediction Story

Question, data, model, honest evaluation, decision with a number, trust story. Eight minutes, one narrative — the skill the whole semester was building toward.

02 // SESSION AGENDA

Today's Journey

A business question, a dataset, a model — and the judgment to evaluate it.

5:00 PM - 5:15 PM

From Notebook to Production: Persist the Pipeline

15 minutes

The Telco pipeline, fitted, saved with joblib, loaded in a fresh process, scoring a new customer from a dict. Version the file, record the scikit-learn version, and never save the model without its preprocessing.

  • A model file without its ColumnTransformer is a model that will silently mis-score the first unseen category
  • Reproducibility checklist: random_state, library versions, data snapshot, the exact training query
5:15 PM - 5:30 PM

Track It With MLflow, Serve It With Gradio

15 minutes

mlflow.start_run, log_params, log_metrics, log_model — the experiment log that replaces 'final_v3_REAL.ipynb'. Then gradio.Interface around predict_proba: a working web demo of the churn model from inside Colab in ten lines, shareable by link.

  • MLflow 3 tracks classical experiments and LLM traces in one UI
  • A Gradio demo is the fastest way to let a business owner poke at a model and find its failure modes
5:30 PM - 5:45 PM

Monitor It: Drift, Decay, and the Rules

15 minutes

Models rot. Evidently compares this month's input distributions to the training data and flags drift; label delay means you watch the inputs before you can watch the accuracy. Then one slide on the law: EU AI Act risk tiers and the AI-literacy duty in force since 2025, high-risk obligations for credit scoring and hiring now due Dec 2027, and Colorado's SB 26-189 rules for consequential decisions from Jan 2027.

  • Watch input drift weekly, outcome metrics when labels arrive, and set a retraining trigger before launch
  • If your model touches credit, hiring, insurance, or health, it is in scope somewhere: explanation, human review, and documentation are the direction of travel
5:45 PM - 6:45 PM

Final Presentations, Block 1

60 minutes

Six teams, eight minutes each plus two for questions. The question, the data, the model, the honest evaluation, the decision with a number, the trust story. The audience asks the executive's questions: why this prediction? how sure? what if it's wrong?

  • Timekeeper is strict at 8:00 — practice with a clock
  • Every listener writes one sentence per team: the number they remember
6:45 PM - 6:55 PM

Break

10 minutes

Stretch, coffee, congratulate Block 1.

6:55 PM - 7:20 PM

Final Presentations, Block 2

25 minutes

The remaining teams. Same format, same questions, same clock.

  • Notebooks and memos were due last night; presentations are graded on the story, not the slides
  • Listeners' one-sentence notes go in the box for the Signal Award vote
7:20 PM - 7:30 PM

The Signal Award & Closing

10 minutes

The class votes for the project that best found the signal: a real question, an honest model, a decision that changed because of it, and a number attached. Then the last word: you can now take any business question about the future, frame it, model it, evaluate it honestly, and turn it into a decision. That is the skill. Use it well.

  • Grades posted within a week; the course site stays up — the notebooks are yours
  • ISOM 839 (Prescriptive Analytics) picks up where the decision memo ends: from prediction to optimization
03 // INTERACTIVE RESOURCES

Tools & Learning Materials

Notebooks, readings, explorers, and the stories behind the methods.

Hands-On

Session 13 Notebook — Ship It

joblib persistence and reload, a ten-line MLflow run, a Gradio demo of the churn pipeline, an Evidently drift report on a shifted sample, and the launch checklist.

Open in Colab
Project

Final Project Brief — Your Prediction Story

The five beats, the deliverables, the memo structure, the rubric, and the FAQ. Re-read the rubric before you finalize your slides.

Open the brief
Reading

Google — Rules of Machine Learning

Forty-three rules from Google engineers on shipping ML. Rule #1: don't be afraid to launch a product without machine learning. Read before you present.

Read the rules
Go Deeper

Stanford CS 329S — Machine Learning Systems Design (Chip Huyen)

The course notes on data pipelines, deployment, monitoring, and drift that Session 13 compresses into forty-five minutes — free, for when you ship for real.

Open the course
Reading

scikit-learn User Guide — Model Persistence

joblib vs. pickle vs. skops vs. ONNX, the security caveats, and why you record the scikit-learn version alongside the file.

Open the guide
Tool

MLflow — Tracking Quickstart

Log parameters, metrics, and a model in one run; compare runs in the UI. The experiment log that replaces file names ending in _final_v3.

Open the quickstart
Tool

Gradio — Quickstart

gr.Interface(fn, inputs, outputs).launch(share=True) — a shareable web demo of any Python function, from Colab, in a minute.

Open the quickstart
Tool

Evidently — Data Drift Reports

Open-source monitoring: compare a reference dataset to current data, get per-column drift tests and a shareable HTML report. The first thing to schedule after launch.

Open the docs
Reading

EU AI Act — Omnibus Changes and Deferred High-Risk Deadlines (2026)

A law-firm summary of where the AI Act stands after the 2026 Digital Omnibus: the AI-literacy duty already in force, transparency duties from Aug 2026, and Annex III high-risk obligations (credit scoring, hiring, insurance) deferred to Dec 2, 2027.

Read the summary
Reading

Colorado SB 26-189 — Automated Decisions in Consequential Settings

Signed May 2026, effective Jan 1, 2027: disclosure, adverse-outcome explanation within 30 days, and human-review rights for automated decisions in employment and similar contexts. The shape of US regulation to come.

Read the bill page
Story

Story: What Booking.com Learned From 150 Production Models

Lesson one: model performance is not business performance. Lesson five: latency matters. The right last reading for a course that ends with a decision memo, not a leaderboard.

Read the paper page
04 // HANDS-ON ACTIVITIES

Learning by Doing

Open the notebook and build it with us.

Activity 1

Save It, Serve It, Watch It

Take the Telco churn pipeline from Session 5 (with its tuned threshold). Persist it, reload it in a clean state, score a single new customer, wrap it in a Gradio demo, and run a drift report against a deliberately shifted sample.

1

Persist the whole pipeline

joblib.dump(model, 'churn_pipeline_v1.joblib'). Record sklearn.__version__ and the training date in a small JSON next to it.

2

Reload and score one customer

In a fresh cell: load, build a one-row DataFrame from a dict, predict_proba. This is what the production service will do.

3

Give it a face

gr.Interface with sliders for tenure and monthly charges and dropdowns for contract, internet service, payment method → churn probability and the recommended action at the tuned threshold.

4

Check for drift

Shift the test set (e.g., tenure × 0.6, more month-to-month contracts) and run an Evidently DataDriftPreset report comparing it to the training data. Read which columns drifted.

python
import joblib, json, sklearn, pandas as pd
import gradio as gr

# 1) persist the fitted Pipeline (preprocessing + model), plus metadata
joblib.dump(model, 'churn_pipeline_v1.joblib')
json.dump({'sklearn': sklearn.__version__, 'threshold': 0.12, 'trained': '2026-12-14'}, open('churn_pipeline_v1.json', 'w'))

# 2) reload in a clean state and score one customer
pipe = joblib.load('churn_pipeline_v1.joblib')
meta = json.load(open('churn_pipeline_v1.json'))
def score(tenure, monthly, contract, internet, payment):
    row = pd.DataFrame([{'tenure': tenure, 'MonthlyCharges': monthly, 'Contract': contract,
                         'InternetService': internet, 'PaymentMethod': payment}])
    p = float(pipe.predict_proba(row)[0, 1])
    return f'{p:.1%} churn risk — ' + ('SEND RETENTION OFFER' if p >= meta['threshold'] else 'no action')

# 3) a web demo in one call (share=True gives a public link from Colab)
gr.Interface(score,
    inputs=[gr.Slider(0, 72, 12, label='Tenure (months)'), gr.Slider(18, 120, 70, label='Monthly charges'),
            gr.Dropdown(['Month-to-month', 'One year', 'Two year'], value='Month-to-month', label='Contract'),
            gr.Dropdown(['DSL', 'Fiber optic', 'No'], value='Fiber optic', label='Internet'),
            gr.Dropdown(['Electronic check', 'Mailed check', 'Bank transfer (automatic)', 'Credit card (automatic)'], value='Electronic check', label='Payment')],
    outputs='text', title='Telco churn — ISOM 835').launch(share=True)

Notice what the demo exposes in thirty seconds that a notebook never would: a business owner drags tenure to 70 months on a month-to-month contract and asks why the risk is still 20%. That question — why? — is Session 9's SHAP waterfall, and the honest answer might be 'the model has seen very few such customers,' which is Session 9's conformal set saying {both}. Shipping is where the trust layer stops being theory.

05 // KEY TAKEAWAYS

What to Remember

Ship the pipeline, not the model. Persist preprocessing and estimator together, record versions and thresholds, and score new rows exactly the way training rows were built.

Models rot. Track experiments, monitor input drift before labels arrive, set a retraining trigger before launch — and know that credit, hiring, insurance, and health models now come with explanation and human-review obligations.

You can now take any business question about the future, frame it, model it in Python, evaluate it honestly, and turn it into a decision with a number attached. That was the promise. Find the signal.

06 // HOMEWORK

Before Next Session

Complete these before next Monday — they are the practice that makes the next session land.

After the Finale Nothing due. Grades post within a week. Keep the notebooks — every one of them is a template for a real project. If you want to keep going: ISOM 839 (Prescriptive Analytics) turns predictions into optimal decisions; the Kaggle Favorita and Home Credit competitions are excellent next problems; and the Inria scikit-learn MOOC and ISLP labs will deepen everything we did. Thank you for a wonderful semester.
07 // PRACTICE

Test Yourself

Exam-style questions for the ideas in this session — The Prediction Lifecycle and Classification & Decisions. Every wrong answer names the misconception behind it.

Q01 Four analytics projects on the roadmap. Only one of them predicts. Q02 Unit, target, horizon, decision — the framing step everyone skips. Q03 A model beats "predict the majority" by two points. Is that a win? Q04 Train error falls, test error rises. Name the disease. Q05 Why the single most important line in the notebook is the split. Q06 Stratify or not? A 1% fraud rate makes the answer obvious — once you see it. Q19 150 flagged, 120 right, 200 real churners. Precision and recall by hand. Q20 Identical ROC-AUC, wildly different PR-AUC. Which one does fraud care about? Q21 A $50 offer, a $600 save. The break-even probability is not 0.5. Q22 A logistic coefficient of 0.69. Say it in odds. Q23 AUC 0.88, but the 0.85 bucket churns at 55%. What broke? Q24 Top decile captures 38% of buyers. Compute the lift and cash it in.

All of Foundations → · All of Decisions →