Skill 01 / 06
Turning history into predictions people can act on. Every project below was rebuilt from scratch, and the live ones run right in your browser.
17
live demos
17
projects in the lab
6
step method
0
servers needed
How machine learning learns
A line, two knobs, and a lot of small steps.
Before the projects: the idea behind all of them, shown on real data and computed live in your browser.
This line + a squash
Logistic regression: the same knobs, then a curve that turns the sum into a chance. Churn, credit, fraud, health.
10 projects
Questions instead of knobs
Decision trees learn which yes/no question splits the data best, then the next one.
Machines, insurance
No answers to learn from
K-means and NMF find groups and themes by themselves.
Segments, reviews
Counting and comparing
Baselines, z-scores and similarities: sometimes the simplest model wins.
Taxi, recommender
How I do it
- 01
Frame the problem
Turn a business question into a target and one metric everyone agrees on.
SQLStakeholder notes - 02
Explore the data
Distributions, gaps and leaks before any model touches it.
PandasPlotly - 03
Engineer features
Encode, scale and build the signals a model can actually use.
scikit-learn Pipelines - 04
Train & validate
Several models, honest validation, the test set kept for the very end.
Cross-validationGrid search - 05
Explain
Choose the model people can read and trust, not just the top score.
CoefficientsFeature effects - 06
Ship
Export it so anyone can try it, right here in the browser.
JSON exportTypeScript
Every project in the lab goes through these steps. Pick one and try it.
Go to the projects17The toolkit
Every model is trained offline with open-source Python, exported as a small JSON file, and re-run in TypeScript. No server, no API key: the demos work the moment the page loads.
01 · Open data
17 public datasets, each with its source and licence on the project page.
hover or tap a logo ↑
02 · Train in Python
One reproducible script cleans, compares and validates every model.
hover or tap a logo ↑
03 · Export
Models become small JSON files: coefficients, tree nodes, neighbour lists, chart data.
tap the file ↑
04 · Run in your browser
The same maths re-implemented in TypeScript, so every demo works with no server.
hover or tap a logo ↑
The models
18
final models
8×
logistic regression shipped
0 / 12
forests & boosting shipped / tried
Random forests and gradient boosting were benchmarked in 12 projects and often scored a little higher. None shipped: the gaps were small (each one is shown on its project page), and the simpler model explains every prediction and runs in your browser.
| Algorithm | Telco churn | Heart failure | Mall segments | NYC taxi | Bank churn | Credit risk | Student grades | Machine defects | Air quality | Bike demand | Card fraud | Insurance fraud | Recommender | Complaint router | Uplift promo | House price range | Feedback themes | Shipped |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Logistic RegressionLinear · classification | 8 / 10 | |||||||||||||||||
Ridge RegressionLinear · regression | 3 / 4 | |||||||||||||||||
Quantile regressionLinear · intervals | 1 / 1 | |||||||||||||||||
Decision TreeTree · rules | 1 / 2 | |||||||||||||||||
Linear SVMLinear · margin | 0 / 2 | |||||||||||||||||
Naive BayesProbabilistic · text | 0 / 2 | |||||||||||||||||
Random ForestEnsemble · bagging | 0 / 7 | |||||||||||||||||
Gradient BoostingEnsemble · boosting | 0 / 11 | |||||||||||||||||
Uplift meta-learnersCausal · uplift | 1 / 1 | |||||||||||||||||
K-MeansClustering | 1 / 1 | |||||||||||||||||
Topic model (NMF)Unsupervised · text | 1 / 1 | |||||||||||||||||
Robust z-scoreStatistics · anomaly | 1 / 1 | |||||||||||||||||
Item-item cosine similarityRecommendation | 1 / 1 | |||||||||||||||||
Association rulesRecommendation | 0 / 1 | |||||||||||||||||
Baseline rulesSanity check | 0 / 5 |
The methodology
Split honestly
Test on data the model has never seen, the way it will meet the future.
Hold-out test set
Touched once: 80/20 split, 8,000 / 2,000 machines, the authors' fixed split for text
Tuned on training data only
Regularisation picked by cross-validation before the test set is opened
Repeated stratified CV
5-fold, repeated 10× and 5×: stable scores on small data
Out-of-fold scores
Every row scored by a model that never trained on it
Randomised control group
Uplift is only ever measured against customers who were randomly left out
Time split
Learn from the past, test on what came after
Calibrated uncertainty
A conformal offset from a separate year, so an 80% range covers about 80%
Rolling backtest
51 forecast origins × 14 days ahead
Price the mistakes
A missed fraud and a false alarm don't cost the same, so the metric shouldn't pretend they do.
Cost-aware threshold
Bad loan approved costs 5× a good one declined → cut-off 0.17
Class weights
Each fraud weighted ~518× while training
Review-budget metrics
Frauds caught in the top N alerts an analyst can check
Gains & lift
Who to call first when the budget only covers some customers
Alert threshold sweep
Detected events vs false alerts at every cut-off
Confidence threshold
Act automatically only when the model is sure; hand the rest to a person
Budget curves
Extra visits for every share of the list you can afford to contact
Hunt for leaks & bias
A score that looks too good is a question, not a result.
Leaky column dropped
Follow-up time quietly encodes the outcome
Too-good feature rejected
Hobbies lift AUC from 0.77 to 0.87: a dataset artifact, not a fraud signal
Sensitive fields left out
Gender, sex and personal profile fields never reach the model
Atypical rows set aside
Foreclosures, family sales and linked-property deals aren't market prices
Beat a baseline, then explain
Prove the model beats a simple rule, then pick the one people can read.
Naive baselines
Last week's demand, the average grade, best sellers, neighbourhood prices
Response model as a foil
Ranking by who will act versus by who the action changes
Simpler model kept
When the gap is small, the readable model ships
Elbow & silhouette
Choosing k for clusters with two independent checks
Coherence & diversity
Choosing the number of themes by whether their words really appear together
Explanations in the demo
Per-prediction drivers, tree paths, 'because you added…', highlighted words
The lab
Next skill
Deep Learning & Vision
Neural networks for images, text and time series.