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
By the end of tonight you'll have both the concept and the working code — every objective maps to a cell you run yourself.
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.
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.
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.
Question, data, model, honest evaluation, decision with a number, trust story. Eight minutes, one narrative — the skill the whole semester was building toward.
A business question, a dataset, a model — and the judgment to evaluate it.
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.
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.
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.
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?
Stretch, coffee, congratulate Block 1.
The remaining teams. Same format, same questions, same clock.
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.
Notebooks, readings, explorers, and the stories behind the methods.
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 ColabThe five beats, the deliverables, the memo structure, the rubric, and the FAQ. Re-read the rubric before you finalize your slides.
Open the briefForty-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 rulesThe 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 coursejoblib vs. pickle vs. skops vs. ONNX, the security caveats, and why you record the scikit-learn version alongside the file.
Open the guideLog 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 quickstartgr.Interface(fn, inputs, outputs).launch(share=True) — a shareable web demo of any Python function, from Colab, in a minute.
Open the quickstartOpen-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 docsA 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 summarySigned 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 pageLesson 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 pageOpen the notebook and build it with us.
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.
joblib.dump(model, 'churn_pipeline_v1.joblib'). Record sklearn.__version__ and the training date in a small JSON next to it.
In a fresh cell: load, build a one-row DataFrame from a dict, predict_proba. This is what the production service will do.
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.
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.
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.
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.
Complete these before next Monday — they are the practice that makes the next session land.
Exam-style questions for the ideas in this session — The Prediction Lifecycle and Classification & Decisions. Every wrong answer names the misconception behind it.