Lesson 1 of 4
Framing ML problems and the core vocabulary
3 min read
Machine learning finds patterns in data to make predictions or decisions without hand-written rules. The first skill is not choosing an algorithm; it's framing the problem.
Types of learning
Supervised: learn from labelled examples (input → known answer).
- Regression: predict a number (salary, delivery time, demand).
- Classification: predict a category (spam or not, will this candidate accept the offer).
- Unsupervised: find structure without labels: clustering (customer segments), dimensionality reduction (PCA), anomaly detection.
- Reinforcement learning: an agent learns by trial and reward (games, robotics, ad bidding).
- Self-supervised: the data provides its own labels (predict the next word); how large language models are pre-trained.
Framing checklist
- What decision will the prediction drive, and what does a mistake cost?
- What exactly is the target, and is it available at prediction time? (No future information, or "leakage".)
- What data exists, how much, how is it labelled, and is it biased?
- What's the baseline? A simple rule ("predict last week's value", "predict the majority class") that the model must beat.
- Does it need ML at all? If a few rules work, ship the rules.
Core vocabulary
- Features (X): input variables. Label/target (y): what you predict.
- Training set to fit, validation set to tune, test set touched once at the end.
- Overfitting: memorises training noise; great on training data, poor on new data.
- Underfitting: too simple to capture the pattern; poor everywhere.
- Hyperparameters: settings you choose (tree depth, learning rate), unlike parameters the model learns (weights).
- Cross-validation: k-fold splits for a more reliable estimate with limited data.
The bias-variance trade-off
- High bias: wrong assumptions, too simple (a straight line for a curve) → underfits.
- High variance: too sensitive to the training data → overfits.
- Total error ≈ bias² + variance + irreducible noise. Increasing model complexity lowers bias but raises variance; the sweet spot is found with validation data.
Fixes for overfitting: more data, simpler model, regularisation (L1/L2), dropout, early stopping, fewer features, ensembling. Fixes for underfitting: more features, a more flexible model, less regularisation, training longer.
Data leakage, the silent killer
Leakage is when training uses information unavailable at prediction time: a "refund_issued" feature for predicting fraud, scaling with statistics from the whole dataset before splitting, or random splits on time-series data. The model looks brilliant offline and fails in production. Split first, fit preprocessing on training data only, and split time series by time.
Check yourself
- Classify these as regression, classification or clustering: predicting salary; grouping students by interests; detecting fake job posts.
- Explain overfitting to a non-technical manager.
- Give an example of data leakage.
Sign up free to save your progress.