Session 1 — From Data to Decisions: Your First Predictive Model
Score every customer; offer retention to the right ones.
Approve, price, or decline — with an expected loss attached.
Stock the shelf, staff the store, book the truck.
A list price with an honest error bar.
Block, review, or approve in 50 ms.
Overbook the slot, call the patient.
What Netflix's research group credits its recommendation models with saving in reduced churn. A churn model, at planetary scale.
What Stripe reports its Radar models remove for the average business. Every decision: a threshold on a probability, in about 100 ms.
Neither is a better algorithm. Both are a good model plus a decision rule nobody skipped.
Dashboards, reports, churn rate by region last quarter.
A probability or a number for every unit, next month. This course.
Optimize the decision the prediction feeds: budgets, schedules, prices.
A prediction is only valuable when a decision changes because of it.
Netflix, Capital One, and your local hospital all run the same loop. Only the data changes.
Tonight: one customer.
Churn — did they leave? Yes / No.
Next month.
Who gets the retention offer.
Churn rate by contract type. The signal is already visible — before any model.
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression df = pd.read_csv('…/telco_churn.csv') X = pd.get_dummies(df[['tenure', 'MonthlyCharges', 'Contract']], drop_first=True) y = (df['Churn'] == 'Yes').astype(int) X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, stratify=y, random_state=835) # the most important line model = LogisticRegression(max_iter=1000).fit(X_train, y_train) pred = model.predict(X_test) # customers it has never seen
Coefficients are fit to these customers only.
Customers it has never seen. Its score here is a forecast of next month, not a memory of last month.
stratify=y keeps the churn rate identical in both halves — 26.5% on each side.
model accuracy
"nobody churns" baseline
ROC-AUC
| predicted: stays | predicted: churns | |
|---|---|---|
| actually stays | 914 · left alone, correctly | 121 · wasted offer |
| actually churns | 173 · missed — customer lost | 201 · caught |
The model catches 201 of 374 churners — 54%. Accuracy never told you that.
Nobody chose 0.5. It assumes both mistakes cost the same.
More offers sent, far fewer $1,500 customers lost. The arithmetic picks the cutoff.
No class Mon Oct 12 (October Break). Session 13 meets in the exam-week slot.
Every session has a live notebook.
Python notebooks on real data.
Kaggle-style, teams of 2–3, launches Oct 26.
Notebook + 2-page memo + 8-min talk, Dec 14.
Next Monday: data wrangling, EDA, and the anatomy of leakage.