Machine Learning · Insper
The ML Landscape
A map before the algorithms
The kinds of learning, a real project from end to end, and what it means to generalize
The path of this lesson
- Kinds of learningsupervised, unsupervised, reinforcement: by the feedback
- The project loopframe, get data, prepare, train, evaluate, deploy: a loop
- Generalizationunderfitting, overfitting, no free lunch
- Responsibilityfairness, privacy, transparency, feedback loops
Each stage answers one question: which kind of learning, by its feedback? → which steps does a real project take? → what makes a model good on new data? → who answers for what the model decides?
Stage 1 · which kind of learning, by its feedback?
Learning paradigms: by the feedback
Machine learning (ML) problems are classified by the kind of feedback the learner gets.
Predict. Three situations: (a) past e-mails, each marked spam or not; (b) a pile of customer records, no marks at all; (c) a program that plays a game and only learns at the end whether it won. What feedback does each one have?
Supervised learning: inputs and the answers
The data contains inputs \(x\) and the desired outputs \(y\) (labels). Goal: learn \(f\) with \(f(x) \approx y\) on new data.
regression
\(y\) is continuous: house prices, energy demand, a patient's length of stay
classification
\(y\) is categorical: spam or not, benign or malignant tumor, which digit is in the image
Unsupervised learning: only the inputs
No labels. The goal is to discover structure.
clustering
group similar observations, e.g. customer segments
dimensionality reduction
compress many features into a few informative ones: PCA (principal component analysis), t-SNE, UMAP
topic modeling
discover themes in a collection of documents (BERTopic)
Reinforcement learning, and the mixtures
- An agent acts in an environment, receives rewards and learns a policy that maximizes long-term reward: game-playing systems (AlphaGo), robotic control.
- Out of scope for this course, but you should recognize it on the map.
semi-supervised
few labels, many unlabeled examples
self-supervised
labels manufactured from the data itself: how foundation models are pre-trained
weak supervision
noisy, programmatic labels
Stage 2 · which steps does a real project take?
The ML workflow
A model is a small part of a larger, iterative process. The course is organized around this loop.
Two practical truths about the loop
most of the work is in steps 2–3
practitioners routinely report spending most of their time understanding and preparing data, not fitting models
the loop never ends
deployed models decay as the world changes (drift); monitoring and retraining are part of the job
Stage 3 · what makes a model good on new data?
Generalization: the central problem
Predict. A model gets every training example right: it has memorized them. Is it a good model?
It can still be useless. What matters is performance on data it has never seen.
underfitting
too simple to capture the pattern: poor even on the training data
overfitting
captures noise as if it were signal: excellent on training, poor on new data
Simulator: underfitting and overfitting
Predict. As the degree goes from 1 to 15, what happens to the training error? And to the test error?
The goal, written down
\[ \text{minimize } \underbrace{\mathbb{E}_{(x,y)\sim \mathcal{D}}\big[L\big(f(x),\,y\big)\big]}_{\text{expected loss on new data}} \quad \text{while only observing a finite sample} \]
Train/test splits, cross-validation, regularization, the bias–variance trade-off: all exist to manage this tension.
The golden rule. Never evaluate a model on data it was trained on. Test data must simulate the future: unseen, untouched, used once.
No free lunch
- Wolpert (1996): averaged over all possible problems, no learning algorithm is better than any other.
- In practice: there is no universally best model. Try several families and validate.
That is why the course teaches a portfolio: linear models, neighbors, kernels, trees, ensembles, networks.
Stage 4 · who answers for what the model decides?
Ethics: four questions before shipping a model
Models trained on historical data inherit historical bias.
fairness
equal performance across groups? A credit model trained on biased decisions reproduces them at scale
privacy
was the data collected with consent? can people be re-identified?
transparency
can decisions be explained to those affected?
feedback loops
does deploying the model change the data it will be retrained on? (predictive policing)
Who owns the decision
"The model said so" is never an acceptable justification for a decision that affects people. You, the practitioner, own the consequences.
Summary
- Paradigms by feedback: supervised (labels), unsupervised (structure), reinforcement (rewards).
- The workflow is a loop, and most of the work is in the data.
- The goal is performance on new data: never evaluate on the training data.
- No free lunch: try several families and validate.
- The practitioner owns the consequences.
Next: Exploratory Data Analysis, the first contact with a dataset.