Chapter 002 established the reversal that defines Machine Learning: rules are no longer written, they are induced from observations. Induction presupposes a signal that steers the learning — information telling the algorithm in which direction to correct its parameters.
The nature of that signal is the only criterion that separates the paradigms. One question determines it:
"For past observations, do we have the value we are trying to predict?"
Everything in this chapter follows from that question. Learn to ask it first, before considering the industry, the data format, the volume, or the algorithm someone has already suggested.
| Answer to the question | Signal available | Paradigm | Statement of the problem |
|---|---|---|---|
| Yes — every historical observation carries the target value | A known target value, observation by observation | Supervised learning | Reproduce, on unseen cases, the input-output association observed in the data |
| No — no target value is available | No external signal; only the internal structure of the data can be exploited | Unsupervised learning | Expose a latent organization among the observations |
| No, but — a delayed evaluation of actions exists | A scalar reward emitted by an environment after each action | Reinforcement learning | Find an action strategy that maximizes cumulative reward |
For a properly formulated problem these three answers are exhaustive and mutually exclusive. A problem that appears to belong to two paradigms at once is a problem whose formulation has not been settled. The open question is then "what is the target variable", not "what is the paradigm".
Learning signal — rigorous definition
Information used by an algorithm to assess the quality of its current hypothesis and to derive from that assessment a direction in which to correct its parameters. It takes one of three forms: a target value attached to each observation, an internal consistency criterion defined on the data alone, or a scalar reward emitted by an environment in response to an action.
Learning paradigm — rigorous definition
A class of problems defined by the nature of the available signal and, consequently, by the form of the optimization problem posed: minimization of an empirical risk over labeled pairs, optimization of an internal structural criterion, or maximization of an expected cumulative reward.
In plain terms
The signal is what lets the algorithm know it is wrong. The paradigm is the family of problems defined by what you have to learn from.
Point of caution
With no signal at all there is no learning in the sense of Mitchell (1997): absent a performance measure P, no experience E can improve anything. An algorithm with nothing to be corrected against is not learning, it is computing.
The highlighted branches mark the scope of this course. The others are defined here so that you can place them, but they are not developed further.
The most expensive confusion, in project framing as in interviews, is to classify a problem by something that is not a criterion at all.
| Criterion wrongly invoked | Immediate counter-example |
|---|---|
| The application domain | Healthcare produces supervised work (diagnosis on labeled cases), unsupervised work (patient typologies) and reinforcement work (adaptive dosing) |
| The data type | One image feeds a supervised classifier just as readily as an unsupervised grouping of photographs |
| The model architecture | A deep network can be supervised, unsupervised (autoencoder) or reinforcement-based |
| The data volume | Ten thousand labeled rows and ten million labeled rows pose the same supervised problem; volume changes the method, not the paradigm |
| The business intent | "Understand our customers" translates equally well into a segmentation or into a churn prediction |
Guiding principle: the paradigm is read off the available data, never off the subject matter, the tooling, or the sponsor's ambition.
Rigorous definition
Let X be an input space and Y an output space. We are given a training sample of n pairs
S = { (x_1, y_1), ..., (x_n, y_n) }, x_i ∈ X, y_i ∈ Yassumed drawn independently and identically distributed from an unknown, fixed joint distribution P(X, Y). Supervised learning consists in selecting, from a hypothesis class H, a function f: X → Y that minimizes the expected risk R(f) = E[ L(f(X), Y) ], where L is a loss function measuring the discrepancy between the predicted and the observed value. Since P is unknown, the algorithm in practice minimizes the empirical risk computed on S, subject to regularization.
In plain terms
You supply examples whose correct answer is known, and you ask the algorithm to build the function that best reproduces that correspondence, so it can be applied to cases whose answer is unknown.
On the word "supervised"
It refers to the presence of a supervisor — an operator, a process, or a later observation — that provided the correct value for each example. The supervisor acts when the dataset is assembled, never during training. By the time the algorithm runs, the supervisor is gone and only its record remains.
Point of caution
The fixed-distribution assumption is load-bearing. When P(X, Y) shifts between
training and production, the empirical risk stops estimating the expected risk
and performance degrades. That phenomenon is covered in chapter 082,
082.0-monitoring-and-drift.md.
Rigorous definition
An observation for which the value of the target variable is recorded alongside the explanatory variables, that value being defined unambiguously and applied consistently across the whole dataset.
In plain terms
A row of the table whose answer is already known.
Where labels come from
Delayed observation (the loan was repaid or it was not), human annotation (a radiologist reads a scan), system records (the customer canceled), or physical measurement (the part failed at 412 hours).
Point of caution
The cost of obtaining labels is frequently the limiting factor of a supervised project. Explanatory variables are abundant; labels rarely are. A project plan that budgets for feature engineering but not for labeling is a project plan with a hole in it.
The label is present at training time and absent at prediction time. A setup in which the label were available at the moment of prediction would have no predictive value whatsoever — you would simply read the answer. Keep that asymmetry in mind: several of the most damaging errors in applied work, data leakage foremost among them, amount to smuggling the label back into the prediction phase.
The type of the target variable determines the sub-family. Nothing else does.
| Classification | Regression | |
|---|---|---|
| Nature of the target | Categorical: a finite set of classes | Numeric and continuous |
| Question asked | "Which class does this observation belong to?" | "What value does this quantity take?" |
| Model output | A class, usually accompanied by a probability | A real number |
| Example target | Loan default: yes / no | Sale price: $412,500 |
| Usual metrics | Accuracy, precision, recall, F1, AUC | RMSE, MAE, MAPE, R² |
| Representative algorithms | Logistic regression, decision trees, random forests, gradient boosting, SVM | Linear regression, regularized regression, regression trees, gradient boosting |
| Notion of error | Discrete: the class is either right or wrong | Continuous: the error has a magnitude |
Rigorous definition
A supervised learning problem in which the output space Y is a finite set of classes { , ..., }. The model generally estimates the conditional probability P(Y = | X = x); the predicted class results from applying a decision rule to that probability vector.
In plain terms
Place each observation into one of the categories defined in advance.
Sub-types: binary (2 exclusive classes), multiclass (k exclusive classes), multi-label (k classes that may hold simultaneously), ordinal (k ordered classes, for example a risk grade from A to E).
Point of caution
The classes are defined before training and are part of the specification of the problem. A classification model cannot produce a class it has never seen. If a new class appears in production, no threshold tuning will make the model report it; the specification has to be reopened.
Rigorous definition
A supervised learning problem in which the output space Y is a subset of the reals. The model estimates a regression function, most often the conditional expectation E[Y | X = x], by minimizing a squared or absolute loss.
In plain terms
Estimate a number rather than a category.
Terminological warning
In modern usage the word "regression" carries no sense of going backward or falling off. It is inherited from Francis Galton's work on the inheritance of human stature (1886), which described a regression toward the mean: the children of unusually tall parents tended, on average, to be less tall than their parents. The word named a particular statistical phenomenon. It was then extended to the fitting method used to demonstrate that phenomenon, and finally to any prediction of a numeric quantity. No inference should therefore be drawn from the word itself: "regression" means only that the target is a number.
A confusion not to make
Logistic regression is a classification algorithm, despite its name. It
regresses the log-odds on the explanatory variables and outputs a probability of
class membership. It is covered in chapter 036,
036.0-logistic-regression.md.
| # | Domain | Business problem | Type | Target variable |
|---|---|---|---|---|
| 1 | Banking | Consumer credit approval | Binary classification | Default within 12 months: yes / no |
| 2 | Banking | Card transaction fraud detection | Imbalanced binary classification | Fraudulent transaction: yes / no |
| 3 | Banking | Loss given default | Regression | Unrecovered amount, in dollars |
| 4 | Healthcare | Diagnostic support on medical imaging | Multiclass classification | Condition identified among k categories |
| 5 | Healthcare | Readmission risk | Binary classification | Readmission within 30 days: yes / no |
| 6 | Real estate | Property valuation | Regression | Actual sale price, in dollars |
| 7 | Human resources | Voluntary attrition prevention | Binary classification | Resignation within 6 months: yes / no |
| 8 | Human resources | Time-to-hire estimation | Regression | Days between posting and signature |
| 9 | Manufacturing / IoT | Predictive maintenance | Binary classification | Failure within 7 days: yes / no |
| 10 | Manufacturing / IoT | Remaining useful life of equipment | Regression | Operating hours before failure |
| 11 | Marketing | Churn prediction | Binary classification | Cancellation within 90 days: yes / no |
| 12 | Marketing | Customer lifetime value | Regression | Expected cumulative margin at 24 months, in dollars |
| 13 | Transportation | Travel time estimation | Regression | Actual duration, in minutes |
| 14 | Cybersecurity | Phishing email filtering | Binary classification | Malicious email: yes / no |
| 15 | Energy | Grid load forecasting | Regression | Consumption at H+24, in megawatts |
How to read the table: in all fifteen cases, historical data carries the
answer. The loan was repaid or it was not, the property sold at an observed
price, the part failed at a measured hour. It is that retrospective availability
of the target that makes the problem supervised — not the intention to predict.
Note also that the technical qualification of case 7 says nothing about its
lawfulness: non-discrimination obligations are addressed in chapter 095,
095.0-capstone-project.md.
The fourth column repays a second reading. Eight of the fifteen cases are classification and seven are regression, and in every case the split follows from the target type alone. The domain contributes nothing: banking, human resources and manufacturing each appear in both columns, with a classification problem and a regression problem drawn from the same data.
A student prepares for an examination using past papers. Each paper comes with its worked solution. The student attempts the question, compares the attempt to the solution, identifies the gap, and adjusts the method. After enough exercises, the student sits an unseen paper whose solution does not yet exist.
| Study situation | Supervised learning | Notation |
|---|---|---|
| The question on the paper | The explanatory variables of an observation | |
| The worked solution | The label, the known target value | |
| The collection of past papers | The training set | S |
| The student's method of solving | The learned function | f |
| The gap between attempt and solution | The loss on one observation | L(f(), ) |
| Revising the method | Updating the parameters | optimization |
| The mock exam | The validation set | — |
| The final exam, unseen paper | The test set, then production | — |
| The mark obtained on the final exam | Generalization performance | R(f) |
Extensions
A student who memorizes the solutions without acquiring the method aces the past
papers and fails the unseen one: that is overfitting, covered in chapter 031,
031.0-overfitting-and-underfitting.md. A student who has the solution sheet
during the exam obtains an excellent mark that measures nothing: that is data
leakage, covered in chapter 028, 028.0-data-leakage.md.
Limits of the analogy
The student understands what they are doing and can transfer the method to a neighboring subject. The model establishes a statistical correspondence only, and does not transfer outside the domain covered by its training data.
Rigorous definition
A class of problems in which one is given a sample { , ..., }, ∈ X, with no associated target variable. The objective is to estimate a structure of the distribution P(X): a partition of the observation space, a low-dimensional manifold approximating the point cloud, a density, or regularities of co-occurrence. Optimization is carried out on a criterion defined exclusively from the data, with no reference to an expected value.
In plain terms
You supply observations with no answers attached and ask the algorithm to bring out the internal organization of the data.
On the phrase "unsupervised"
It signals the absence of a reference answer, not the absence of human involvement. The choice of variables, of distance, of the number of groups and of the scaling belongs entirely to the analyst.
Point of caution
An unsupervised algorithm always returns a result, including when the data contain no structure whatsoever. Ask a partitioning method for four groups on a perfectly uniform cloud and you will get four groups. The production of a result is therefore never evidence that a structure exists.
The distinction is easy to hold onto: clustering acts on the rows of the table, dimensionality reduction acts on the columns.
Rigorous definition
The problem of building a partition or a covering of a set of observations into groups such that a within-group similarity measure is maximal and a between-group similarity measure is minimal, in the sense of a distance specified by the analyst. An inertia-based partitioning method minimizes the within-group sum of squares:
argmin Σ Σ || x - μ_j ||²
C j=1..k x ∈ C_jwhere denotes the center of group .
In plain terms
Group together the observations that resemble one another, without knowing in advance which groups exist or how many there are.
Parameters that belong to the analyst
Number of groups, distance measure, scaling, choice of variables. Each of these changes the result; there is no "true" partition that an algorithm would discover independently of them.
Point of caution
The groups produced have no names. Naming and interpreting them is a business act performed after the algorithm has run — never an output of the algorithm.
Rigorous definition
The problem of constructing a map g: X → Z, with dim(Z) < dim(X), that best preserves some property of the original distribution: explained variance for principal component analysis, local neighborhood structure for non-linear embedding methods, reconstruction capacity for autoencoders. The optimized criterion is internal to the data.
In plain terms
Represent the same observations with fewer variables, losing as little information as possible.
Operational purposes: visualization, compression, denoising, preprocessing for a supervised model, mitigation of the curse of dimensionality.
Point of caution
Used upstream of a supervised model, dimensionality reduction must be fitted on
the training data alone and then applied unchanged to validation and test data.
Fitting it on the full dataset is data leakage, covered in chapter 028,
028.0-data-leakage.md.
A retail chain has 12,000 active customers. No target variable exists: management is not asking for a behavior to be predicted, but for the structure of the base to be understood. Four variables are retained — annual purchase frequency, average basket, tenure, share of purchases made online — and a four-group partitioning is applied after scaling.
Raw output of the algorithm
| Group | Size | Share | Annual frequency | Average basket | Tenure | Online share |
|---|---|---|---|---|---|---|
| Group 1 | 4,320 | 36% | 1.2 purchases | $38 | 8 months | 22% |
| Group 2 | 3,600 | 30% | 11.4 purchases | $42 | 5.2 years | 15% |
| Group 3 | 2,880 | 24% | 4.1 purchases | $187 | 3.4 years | 71% |
| Group 4 | 1,200 | 10% | 0.4 purchases | $25 | 6.1 years | 5% |
The numeric identifiers carry no meaning. "Group 1" says nothing and is not ordered relative to "Group 2". Rerun the algorithm from a different initialization and the same customers may come back as Group 3.
Business interpretation, produced after the algorithm
| Group | Name given by the business | Reading | Action considered |
|---|---|---|---|
| Group 1 | Recent occasional buyers | Low tenure, low engagement | Activation journey over the first 6 months |
| Group 2 | Neighborhood regulars | High frequency, low basket, in-store channel | Loyalty program, basket growth |
| Group 3 | High-basket online buyers | Basket four times higher, digital channel | Premium offer, dedicated delivery service |
| Group 4 | Dormant customers | High tenure, near-zero activity | Reactivation campaign, or removal from the active file |
The decisive point: the second column was not produced by the algorithm. It was written by business managers examining the statistical profile of each group. A clustering algorithm delimits groups; it does not name them and it does not explain them.
This is the most important structural difference from supervised learning. Every supervised prediction can be confronted with the observed value: accuracy is measurable. In unsupervised learning there is no reference partition, and the question "is this segmentation correct?" is not well posed. Evaluation then rests on two orders of criteria.
| Order of criterion | Nature | Examples | Limitation |
|---|---|---|---|
| Internal criteria | Statistical, computed on the data alone | Silhouette coefficient, within-cluster inertia, Davies-Bouldin and Calinski-Harabasz indices | A high score is no evidence of business relevance |
| Business-utility criteria | Operational, judged by domain owners | Groups that are interpretable, actionable, of workable size, stable over time | Subjectivity, dependence on the expertise available |
Point of caution: a segmentation with an excellent silhouette coefficient whose groups call for no action is an operational failure; a partition with a mediocre internal score whose groups call for differentiated, measurable actions is a success. The final criterion is usefulness.
Consequence for project management: an unsupervised project cannot be governed by a contractual threshold of the form "at least 90% accuracy". It is governed by an interpretability review conducted with the business. Anyone who writes an accuracy target into the statement of work for a segmentation project has misidentified the paradigm.
| Domain | Application | Sub-family | Output used |
|---|---|---|---|
| Retail | Customer base segmentation | Clustering | Homogeneous groups for differentiated targeting |
| Commerce | Market basket analysis | Association rules | Products frequently bought together |
| Insurance | Typology of claim profiles | Clustering | Groups used as a basis for pricing |
| Bioinformatics | Grouping of gene expression profiles | Clustering | Candidate molecular subtypes |
| Manufacturing | Compression of sensor signals | Dimensionality reduction | Compact representation for monitoring |
| Documentation | Thematic grouping of a corpus | Clustering | Document families with no prior taxonomy |
| Cybersecurity | Detection of atypical behavior | Anomaly detection | Alerts for an analyst to qualify |
| Marketing | Reducing a survey to its principal axes | Dimensionality reduction | Synthetic attitude factors |
A professional observation: unsupervised learning appears more often upstream of a supervised project, as exploration, than as an autonomous production system. A segmentation can itself become an explanatory variable in a later supervised model.
Rigorous definition
A learning framework in which an agent interacts sequentially with an environment. At each time step t the agent observes a state , selects an action according to a policy π, receives a scalar reward and observes a new state . The problem is most often formalized as a Markov decision process (S, A, P, R, γ), with γ ∈ [0, 1[ the discount factor. The objective is to find a policy π maximizing the expected discounted cumulative return:
J(π) = E[ Σ γ^t · r_(t+1) ]
t≥0Standard reference: Sutton and Barto, Reinforcement Learning: An Introduction (1998, second edition 2018).
In plain terms
The agent does not learn from correct answers supplied in advance but by successive attempts: it acts, the environment penalizes or rewards it, and it adjusts its strategy so as to accumulate as much reward as possible.
What separates a reward from a label
A label states the correct answer, exists before training, and concerns a single isolated observation. A reward evaluates the answer produced, is generated during interaction, bears on a sequence of actions, and depends on the model's own actions.
Point of caution
The delayed character of the reward creates the credit assignment problem: when a reward arrives at the end of hundreds of actions, determining which of them contributed is the central difficulty of the paradigm.
The cycle repeats until a terminal state, or indefinitely. The structural peculiarity of the paradigm shows up here: the training data are produced by the agent itself. A mediocre policy generates mediocre trajectories, and the agent must nonetheless learn from them. Hence the exploration-exploitation trade-off: a policy that never exploits accumulates no reward, a policy that never explores freezes on a local optimum. That trade-off has no counterpart in supervised learning, where the dataset is fixed.
| Term | Notation | Definition | Example: warehouse robot |
|---|---|---|---|
| Agent | — | The entity that decides and acts | The robot controller |
| Environment | — | The system the agent interacts with, producing transitions and rewards | The warehouse, its racking, its obstacles |
| State | Description of the situation at time t, sufficient to decide | Position, load carried, battery level | |
| Action | The decision taken among those available | Move forward, turn, grip, release | |
| Reward | Scalar emitted by the environment, evaluating the transition | +10 parcel delivered, -1 per second, -100 collision | |
| Policy | π(a|s) | Rule mapping each state to an action or to a distribution over actions | The learned navigation strategy |
| Episode | — | One complete trajectory, from an initial state to a terminal state | One delivery run, from pickup to drop-off |
| Return | Discounted sum of rewards from time t onward | Total value of the run as seen from step t |
| Domain | Application | Nature of the reward | Maturity |
|---|---|---|---|
| Games | Go, chess, video games | Win, score | Demonstrated, with major academic references |
| Robotics | Locomotion, grasping, navigation | Progress toward the goal, collision penalty | Operational in controlled environments |
| Data centers | Cooling control | Energy saved under a temperature constraint | Documented industrial deployments |
| Finance | Order execution, dynamic allocation | Risk-adjusted return | Real use, heavily supervised by regulators |
| Advertising | Slot allocation, contextual bandits | Click, conversion | Very widespread, in bandit form |
| Logistics | Scheduling, inventory management | Total cost, service level | Emerging, generally in simulation |
The special case of multi-armed bandits: a simplified form of reinforcement learning with no state transition, deployed at scale for content allocation and adaptive testing. For most organizations it is their only real exposure to this paradigm.
Learning to ride a bicycle does not proceed from a solution sheet. Nobody can supply, for each millisecond, the exact handlebar angle and torso lean. The instruction "keep your balance" is not a label. The available signal is a consequence: the learner stays upright, or falls. And the link between the wrong movement and its consequence is delayed by a few seconds.
| Element of the situation | Formal counterpart |
|---|---|
| The learner on the bicycle | The agent |
| The bicycle, the road, gravity | The environment |
| Lean, speed, handlebar position | The state |
| Correct the trajectory, pedal, brake | The action |
| Meters covered without falling, a fall | The reward |
| The reflexes acquired | The policy π |
| Trying an unusual trajectory | Exploration |
| Repeating what worked | Exploitation |
What the analogy makes visible
The skill is acquired through interaction, not by memorizing question-answer pairs. It cannot be transmitted by a lecture, and acquiring it requires a large number of attempts, unsuccessful ones included. A child falls a few dozen times; an artificial agent commonly needs millions of episodes. When each episode has a material or human cost, training under real conditions becomes impractical — hence the requirement for a simulator.
Reinforcement learning occupies a large place in the field's public communication and a marginal place in project portfolios. Four obstacles explain the gap.
| Obstacle | Statement | Practical consequence | Situations where it is lifted |
|---|---|---|---|
| 1. A simulable environment is required | Learning demands massive interaction, unacceptable on the real system | You need a faithful simulator, and building one is a project in its own right | Games, well-modeled physical systems, queueing systems, digital environments |
| 2. Computational cost | The number of episodes exceeds the volume of a supervised training run by several orders of magnitude | High compute budget, long lead times, slow iterations | Low-dimensional problems, bandits, cheap simulations |
| 3. Reward specification | Turning a business objective into a scalar is hazardous: the agent optimizes exactly what is written | Degenerate behaviors that maximize the measure without serving the intent | Objectives with a direct measure that cannot be gamed |
| 4. Controllability in production | The policy explores, evolves, and takes sequential decisions that are hard to audit | Difficulty in certification, traceability and behavioral guarantees | Low-criticality domains, or setups bounded by external safety rules |
Obstacle 3 in detail: degenerate behaviors
A badly specified reward function leads the agent to maximize the measure rather than the objective the measure stands for. The literature calls this reward hacking.
| Intended objective | Reward as written | Possible degenerate behavior |
|---|---|---|
| Clean a room | Quantity of dust collected | Spread the dust so it can be collected again |
| Finish a race | Points accumulated along the course | Loop over a high-point zone without crossing the finish line |
| Maximize engagement | Session duration | Favor polarizing content at the expense of satisfaction |
| Reduce processing time | Cases closed per hour | Close difficult cases without resolving them |
| Avoid collisions | Penalty on contact | Stand still |
The agent does not optimize the designer's intent; it optimizes the reward function. Any gap between the two will be exploited. This meets Goodhart's law: when a measure becomes a target, it ceases to be a good measure.
Point of caution on obstacle 4: a supervised model outputs a pointwise prediction that a business process can filter before any action is taken; a reinforcement agent outputs an action policy. The point of human control must therefore be designed explicitly, in the form of safety constraints external to the learning itself.
Signal availability admits intermediate states: partial labels, manufactured labels, labels that exist but are extremely rare. Three configurations follow.
None of these three is a fourth paradigm. Each is a position on the same axis: how much of the target signal you have, and where it came from.
Rigorous definition
A class of problems in which the sample combines a labeled subset = { (, ) } of size l and an unlabeled subset = { } of size u, generally with u >> l. The methods exploit the marginal distribution P(X) estimated on to constrain the estimation of P(Y | X) learned on , under regularity assumptions: smoothness, cluster, manifold.
In plain terms
You have many observations and few known answers; the unlabeled mass is used to get more out of the small number of labels available.
Point of caution
The regularity assumptions are not always satisfied. When they are not, adding unlabeled data can degrade performance relative to a model trained on the labeled data alone. Semi-supervised learning is not a free improvement; it is a bet on the geometry of the data.
Case study: medical imaging
A hospital holds 200,000 archived scans, of which only 2,000 are annotated. Annotation takes a radiologist several minutes per scan, and annotating the full archive would represent several person-years. A strictly supervised approach discards 99% of the available information; a semi-supervised approach learns the structure of the image space on the 198,000 raw scans and fits the decision rule on the 2,000 annotated ones.
Rigorous definition
A class of methods in which the target variable is constructed automatically from the internal structure of the data, with no annotator involved. A so-called pretext task is defined so that its label is deducible from the raw data; the model is trained on that task by ordinary empirical risk minimization, and the resulting representation is then reused for the target task.
In plain terms
The algorithm manufactures its own exercises and its own solution sheets from raw data, which removes the annotation cost.
A decisive clarification
The learning mechanics remain strictly supervised: there is a target value, a loss function, a comparison between prediction and target. Only the provenance of the label changes — extracted from the data instead of supplied by an operator. Self-supervised learning is therefore not a fourth paradigm but a way of obtaining labels.
Point of caution
The quality of the representation depends entirely on the relevance of the pretext task. A task solvable through a superficial artifact yields a representation of no value for the target task.
Case study: masked word prediction
Starting from a raw, unannotated text corpus, training examples are built by masking words and asking the model to restore them.
| Step | Content |
|---|---|
| Raw data | "The policy rate was raised by twenty-five basis points." |
| Manufactured example (input) | "The policy rate was [MASK] by twenty-five basis points." |
| Manufactured label (target) | "raised" |
| Annotation cost | None: the label is the word removed |
This mechanism, popularized by BERT-style architectures (Devlin et al., 2018) and then generalized by autoregressive language models, makes it possible to exploit very large corpora with no human annotation. The resulting representation is subsequently specialized on a supervised task for which few labels exist.
Rigorous definition
The problem of identifying observations whose generation is improbable under the distribution of the observations considered normal. Depending on the availability of labeled anomaly examples, it is formulated as a strongly imbalanced supervised classification, as an unsupervised density or support estimation, or as one-class classification.
In plain terms
Spot what falls outside the ordinary, whether or not you have examples of abnormal cases.
Taxonomic position
Anomaly detection straddles two paradigms. It is not an additional family: it names a business objective that can be addressed within either paradigm depending on the data available.
| Data configuration | Applicable paradigm | Usual methods | Evaluation |
|---|---|---|---|
| A history of confirmed, labeled anomalies, in very low proportion | Supervised, under strong imbalance | Gradient boosting, random forests with resampling or class weighting | Recall, precision, area under the precision-recall curve |
| No labeled anomalies, or future anomalies distinct from past ones | Unsupervised | Isolation Forest, density estimation, one-class SVM, autoencoder | Internal criteria, alert rate, expert qualification |
| A few labeled anomalies and a mass of unqualified observations | Semi-supervised | Model normality, then calibrate the threshold on the labeled cases | Precision on confirmed cases, cost of false positives |
A practical decision rule
If the anomalies to be detected resemble those already observed and labeled, the problem is supervised. If the anomalies to be detected are unknown by nature, the problem is unsupervised.
In banking fraud detection, known schemes are handled in a supervised way, with
the imbalance techniques covered in chapter 050,
050.0-class-imbalance-understanding.md; new schemes escape by construction a
model trained on the past and call for an unsupervised approach. Production
systems frequently combine the two.
Reading the "reframe" branch: the absence of labels does not disqualify the project, it moves its first step. The question becomes "how do we build a labeled dataset" — annotation, prospective collection, exploitation of a system log — or "which unsupervised objective are we prepared to accept".
| Criterion | Supervised | Unsupervised | Reinforcement |
|---|---|---|---|
| Labels | Required for every training observation | None | None; replaced by a reward signal |
| Question asked | "What is the value of Y for this observation?" | "What organization structures these observations?" | "Which sequence of actions maximizes cumulative return?" |
| Analogy | Learning from worked exercises | Sorting objects with no prior taxonomy | Acquiring a motor skill |
| Accuracy measurement | Direct: compare prediction to observed value | Impossible in the strict sense: no ground truth | Indirect: cumulative reward over episodes |
| Sub-types | Classification, regression | Clustering, dimensionality reduction, association rules | Value-based methods, policy-based methods, bandits |
| Typical algorithms | Linear and logistic regression, decision trees, random forests, gradient boosting, SVM, neural networks | k-means, hierarchical clustering, DBSCAN, PCA, UMAP, autoencoders | Q-learning, SARSA, policy gradients, actor-critic |
| Frequency in industry | Dominant: the large majority of models in production | Significant, mainly in exploration and preparation | Marginal outside R&D, with the notable exception of bandits |
| Example | Predict whether a customer will cancel within 90 days | Segment the customer base into homogeneous groups | Optimize an inventory management policy in simulation |
| Coverage in this course | The central subject, from chapter 004 to the end | Positioned here, not developed further | Positioned here, not developed further |
Both procedures produce groups; the resemblance ends there. Confusing the two is one of the most frequent errors in interviews.
| Point of comparison | Classification | Clustering |
|---|---|---|
| Paradigm | Supervised | Unsupervised |
| Do the groups exist before the analysis? | Yes, they are part of the specification | No, they result from the computation |
| Number of groups | Fixed by the business problem | Chosen by the analyst, often by exploration |
| Do the groups have names? | Yes, with a business meaning defined a priori | No, arbitrary identifiers to be interpreted |
| Data required | Labeled observations | Observations alone |
| Question asked | "Does this observation belong to class A or class B?" | "What groups emerge from these observations?" |
| Evaluation | Accuracy, recall, precision, F1, AUC | Silhouette, inertia, business utility |
| Stability of meaning | Stable: the classes do not change | Unstable: another initialization or another k changes the groups |
| Example | Assign an email to "spam" or "legitimate" | Discover four profiles in a customer base |
| Business phrasing that triggers it | "We know what we are looking for" | "We want to know what is there" |
A one-question test: does the list of groups appear in the statement of work? If it does, the problem is classification. If it does not, it is clustering.
A marketing team asks for a model predicting "high-potential customers". No variable of that name exists anywhere in the information system. The intention to predict is not enough to create a supervised problem. Two ways out exist, and exactly one must be chosen explicitly: define a target that is measurable and verifiable in the history — for example "revenue over the next 12 months above $5,000" — or accept an exploratory unsupervised approach producing groups to be interpreted.
Correct formulation : "A supervised problem requires a target variable that is defined, measurable and present in the history. Until that variable exists, there is no supervised problem."
Both produce groups, which is enough to sustain the confusion. The discriminating criterion is not the output but the input: do the classes pre-exist in the training data? One consequence shows up regularly in practice: a clustering presented as a predictive model, complete with a claimed accuracy figure — a figure that is meaningless in the absence of a reference partition.
Correct formulation : "Classification assigns an observation to classes defined beforehand and learned from labeled examples; clustering forms groups from similarities alone, with no pre-existing classes and no measurable accuracy."
The absence of labels lightens data collection and gives the impression of a less demanding problem. On validation, the opposite is true: with no ground truth, the project has no objective stopping criterion, and the number of groups, the distance and the scaling are choices that no metric settles. A supervised project ends with a performance figure on a test set; an unsupervised project ends with a business acceptance decision.
Correct formulation : "Unsupervised learning is less demanding in labeled data and more demanding in interpretation: its difficulty moves from collection to validation."
The list "supervised, unsupervised, reinforcement, Deep Learning" mixes two planes of classification. The first three terms name paradigms, defined by the nature of the learning signal; the fourth names a class of models, defined by an architecture. A neural network trained on labeled images is supervised; an autoencoder is unsupervised; a network optimizing a policy from rewards is reinforcement.
Correct formulation : "Deep Learning is a class of models usable within all three paradigms; it sits on a different plane of classification."
To predict churn at 90 days, a team retains as an explanatory variable the
number of calls to the cancellation desk. Performance is excellent in validation
and worthless in production: at the moment the prediction has to be issued, that
call has not yet taken place. The variable is not predictive of the event, it is
constitutive of it. This form of data leakage, covered in chapter 028,
028.0-data-leakage.md, is not detectable through metrics — it improves them.
Control rule : for every explanatory variable, verify that its value would genuinely be available at the instant the model is queried in production.
Correct formulation : "The label postdates the explanatory variables; any information contemporaneous with or subsequent to the realization of the target must be excluded from the training set."
"Healthcare is supervised" and "marketing is clustering" are statements with no foundation. Healthcare gives rise to readmission prediction (supervised), to the identification of patient subgroups (unsupervised) and to sequential adaptation of a dosing protocol (reinforcement). Marketing gives rise to churn prediction, to segmentation, and to dynamic offer allocation through bandits.
Correct formulation : "The paradigm is determined by the nature of the available learning signal, never by the industry sector."
THE SINGLE CRITERION
"For past observations, do we have the value
we are trying to predict?"
Yes ..................................... SUPERVISED
No ...................................... UNSUPERVISED
No, but a delayed evaluation
of actions is available ................. REINFORCEMENT
SUB-FAMILIES
Supervised : classification (categorical target)
regression (numeric target)
Unsupervised : clustering, dimensionality reduction,
association rules
Reinforcement : value-based or policy-based methods
INTERMEDIATE CONFIGURATIONS
Semi-supervised : only a fraction of the observations is labeled
Self-supervised : labels manufactured from the data;
the mechanics remain supervised
Anomalies : supervised if past anomalies are labeled,
unsupervised if they are unknown by nature
WHAT IS NOT A CLASSIFYING CRITERION
the domain, the data type, the volume,
the model architecture, the stated business goal
A DISTINCTION NEVER TO LOSE
Classification : the groups exist before the analysis
Clustering : the groups result from the analysis
WHAT EACH PARADIGM MEASURES
Supervised : an accuracy, against the observed value
Unsupervised : an internal cohesion and a business utility
Reinforcement : a cumulative reward over episodes
WHERE DEEP LEARNING SITS
A class of models usable within all three paradigms.
It is not a fourth paradigm.Summary statement
Learning paradigms are distinguished by the nature of the available signal and by nothing else: a known target value, observation by observation, defines supervised learning; the internal structure of the data alone defines unsupervised learning; a delayed reward emitted by an environment defines reinforcement learning. The domain, the volume and the model architecture have no bearing on this classification.
Associated quizzes :
003.1-quiz-classifying-criterion.md,
003.2-quiz-supervised-learning.md,
003.3-quiz-unsupervised-learning.md,
003.4-quiz-reinforcement-learning.md,
003.5-quiz-intermediate-paradigms.md,
003.6-quiz-problem-qualification.md
Next chapter : 004.0-supervised-learning-formalization.md