Give the same 150 iris flowers five labelled examples instead of 112, and a logistic regression drops to 0.7491 accuracy on the 38 held-out rows. Give a semi-supervised learner the same five labels plus the 107 unlabelled rows and it reaches 0.8596. Raise the labels to 60 and the two are level, at 0.9456 and 0.9430. Nothing about the flowers changed, and nothing about the metric changed. What changed is how much the program was allowed to learn from, and that is what the word “paradigm” describes.
This article is about the three ways a machine can learn, and about the one thing that separates them: the signal. Supervised learning gets answers, unsupervised learning gets rows, reinforcement learning gets a reward for acting. Each section covers the loop, the sub-types, where it is used and where it breaks. The comparison is measured rather than asserted: 30 split seeds on one dataset, the same held-out rows for every method, and a separate metric for the methods that predict classes and the ones that group rows. Every program was run on Windows 11 (build 26300) with Python 3.14.6, NumPy 2.5.5 and scikit-learn 1.9.1, and again on Ubuntu 24.04.5 under WSL 2 with Python 3.12.3 and the same library versions, with identical output.
The Short Answer
- The paradigm is set by the learning signal, not by the algorithm. Labels, raw rows, or rewards. The same model family can appear in more than one paradigm.
- Labels are the expensive part of supervised learning. Cutting from 112 labels to 15 costs about 7.5 accuracy points on this data; cutting to 5 costs about 20.
- Semi-supervised learning buys back part of that loss while labels are scarce: 11 points over supervised learning at five labels, and no advantage left by 60.
- Unsupervised learning answers a different question. Its adjusted Rand index of 0.5936 on held-out rows is not comparable to an accuracy score, and the article keeps them apart.
- Reinforcement learning needs no dataset at all. It needs an environment, a reward and a policy that explores; all ten seeds found the shortest path in this gridworld.
What Separates the Three Paradigms
| Supervised | Unsupervised | Reinforcement | |
|---|---|---|---|
| What the program receives | Rows with the answer attached | Rows with no answer | A reward after each action |
| What is fitted | A mapping from features to target | A grouping, projection or density | A policy, or the value of state-action pairs |
| What is optimised | A loss against the supplied answers | An internal criterion, such as within-cluster distance | Expected discounted return |
| What it outputs | A class or a number | Groups, axes or anomaly scores | An action to take in each state |
| When the data arrives | All at once, before training | All at once, no answers | One step at a time, from acting |
The distinction survives even though the algorithms do not respect it neatly. A neural network is not a paradigm; it is a model family that can be trained supervised, used as an unsupervised autoencoder, or trained by policy gradient. The paradigm describes the problem the optimiser is solving, which is why the same library can offer all three and why a scatter plot of the data cannot tell you which one you need.
Supervised Learning: Every Answer Costs a Label
The loop is short. Fit a function to pairs of input and answer, measure how wrong its predictions are with a loss, adjust the parameters, repeat. A logistic regression minimises log loss; a decision tree minimises impurity; both are doing the same thing at a different level of detail. The loop’s distinguishing feature is that every training row carries the answer, so the size of the training set is capped by how many answers someone was willing to produce.
Classification or regression. The target decides the sub-type. On the same iris rows, predicting the species is classification and predicting petal length is regression, and the same features serve both. Accuracy, precision, recall and the confusion matrix summarise the first; MAE, RMSE and R² summarise the second. A page that reports accuracy for a numeric target has mixed the two up.
Where it is used. Spam filtering, fraud detection, credit scoring, medical triage and defect detection are all supervised, because a record of past correct answers exists. The costs are real: labels need expert time, noisy labels teach the model the noise, and a label that was itself produced by an earlier model imports that model’s mistakes.
The middle ground. When a small labelled set sits inside a large unlabelled one, semi-supervised learning uses both. This article’s experiment is that situation: a supervised model on the same labelled subset, compared with LabelSpreading, which propagates the labels through a similarity graph built from all 112 training rows. At five labels the semi-supervised model scored 0.8596 against 0.7491, and its spread across seeds was also narrower (0.0650 against 0.1620). The gain is real on this data and it is not free: the method assumes that nearby points share a label, and when that assumption is wrong it spreads the wrong answer confidently. Self-supervised learning is a different middle ground, in which the data supplies its own labels by masking or predicting parts of itself; it is behind most modern language and image models and is out of scope here.
Unsupervised Learning: Structure Without Answers
There is no target to compare against, so the algorithm must optimise something internal. K-means minimises the squared distance from each row to its cluster centre; PCA maximises explained variance; an isolation forest scores how quickly a point is isolated by random splits. In each case the objective is a proxy for a structure someone hopes is there.
Three sub-types. Clustering groups rows: on the 112 training rows, k-means with three clusters scored an adjusted Rand index of 0.5936 on the 38 held-out rows, against 0.6256 in-sample. That gap is the honest part of the result: the in-sample number flatters the method, and the held-out number is the one to quote. Dimensionality reduction compresses features into fewer axes, and its natural metric is explained variance rather than agreement with labels. Anomaly detection scores how unusual a row is, which is unsupervised in training and evaluated like classification at the end.
What the output can claim. A cluster is not a class. The species labels were never given to k-means, and it still recovered one species cleanly and split the other two between clusters, which is why an ARI of 0.5936 rather than 1.0 is the correct summary. The result says the data has structure that partly matches the species; it does not say the algorithm discovered the species.
Where it is used. Customer segmentation, document grouping, compression before a supervised model, and novelty detection in logs or transactions. In every case the output needs a human or a downstream task to decide whether the structure is useful; there is no accuracy score to settle it.
Reinforcement Learning: Learning From Consequences
Here the data is generated by acting. The agent observes a state, chooses an action, receives a reward and a new state, and updates the value of that action. Q-learning stores one value per state-action pair and moves it toward the reward plus the discounted best value of the next state. Exploration is not optional: without a random action now and then, the agent never discovers that a better path exists.
What it measured. A 4×4 gridworld with two holes, 300 episodes and epsilon 0.2. Across 10 seeds, all 10 reached the goal, and every one took 6 steps, which is the Manhattan distance from the corner and therefore the shortest possible path. The spread is 0.00 because the task is small and deterministic; that makes the result clean, not impressive, and a harder environment would separate the seeds.
Two families. Value-based methods learn how good each state or action is and act greedily; policy-based methods learn the action probabilities directly and are better suited to continuous actions. Actor-critic methods do both. The distinction matters when the action space is large, because a value for every action stops being tractable.
Where it is used. Control, robotics, game playing and recommendation, where feedback is delayed and the right action is not known in advance. The hard parts are reward design, sample cost and evaluation: an agent that learned a policy needs a held-out set of environments, not a single lucky episode.
What the Label Budget Shows
The experiment fixes everything except the number of labels. Each of 30 split seeds makes one stratified 112/38 split, and the 38 held-out rows are used only for scoring. For each budget, one stratified subset of the training rows is drawn and shared by both supervised methods, so the comparison is like for like:
def choose_labels(y_train: np.ndarray, count: int, rng: np.random.Generator) -> np.ndarray:
"""Pick `count` labelled rows, spread across the classes present."""
classes, counts = np.unique(y_train, return_counts=True)
if count >= len(y_train):
return np.arange(len(y_train))
shares = np.maximum(np.round(counts / counts.sum() * count).astype(int), 1)
while shares.sum() > count:
shares[int(np.argmax(shares))] -= 1
while shares.sum() < count:
shares[int(np.argmax(counts - shares))] += 1
picked: list[int] = []
for cls, share in zip(classes, shares):
pool = np.flatnonzero(y_train == cls)
picked.extend(rng.choice(pool, size=int(share), replace=False).tolist())
return np.array(sorted(picked))
| Labelled rows | Supervised accuracy | Semi-supervised accuracy | Baseline |
|---|---|---|---|
| 5 | 0.7491 ± 0.1620 | 0.8596 ± 0.0650 | 0.3351 |
| 15 | 0.8754 ± 0.0715 | 0.9114 ± 0.0505 | 0.3307 |
| 40 | 0.9342 ± 0.0462 | 0.9167 ± 0.0626 | 0.3158 |
| 60 | 0.9456 ± 0.0408 | 0.9430 ± 0.0415 | 0.3307 |
| 112 | 0.9509 ± 0.0307 | 0.9456 ± 0.0345 | 0.3158 |
label budget: how far each paradigm gets as labels are removed
dataset iris, 150 rows, 4 features, 3 classes
protocol 30 split seeds, 112 training / 38 held-out rows per seed
labelled rows drawn only from the 112 training rows, shared by the supervised and semi-supervised runs
labelled supervised accuracy semi-supervised accuracy baseline
rows mean sd mean sd mean
5 0.7491 0.1620 0.8596 0.0650 0.3351
10 0.8447 0.0739 0.8904 0.0553 0.3158
15 0.8754 0.0715 0.9114 0.0505 0.3307
25 0.8991 0.0738 0.9132 0.0540 0.3158
40 0.9342 0.0462 0.9167 0.0626 0.3158
60 0.9456 0.0408 0.9430 0.0415 0.3307
84 0.9553 0.0302 0.9421 0.0355 0.3307
112 0.9509 0.0307 0.9456 0.0345 0.3158
15-labelled paired comparison, supervised minus semi-supervised: mean -0.0360, sd 0.0777, supervised ahead on 9 of 30 seeds
k-means, no labels at any point
held-out ARI mean 0.5936 sd 0.0794 min 0.4497 max 0.7827
in-sample ARI mean 0.6256 sd 0.0405
note ARI and accuracy are different scales; the table above does not compare them
wrote label_budget.json
Three findings, in order of how much they should change a decision.
Semi-supervised learning helps while labels are scarce. Eleven accuracy points at five labels, about four at fifteen, and the paired difference across the 30 seeds (supervised minus semi-supervised) is −0.0360 with a standard deviation of 0.0777, with the semi-supervised model ahead on 21 of 30 seeds. A spread larger than the mean is why the article reports the win rate rather than a significance claim: the direction is consistent, the size is not precisely known.
The advantage disappears once labels are plentiful. At 60 labels the supervised model reaches 0.9456 and the semi-supervised one 0.9430, which is level. Beyond that the extra unlabelled rows add nothing measurable on this data.
The clustering score is a different number on a different scale. K-means, with no labels at any point, reached a held-out adjusted Rand index of 0.5936 (0.4497 to 0.7827) and an in-sample ARI of 0.6256. An ARI of 0.59 and an accuracy of 0.95 cannot be compared, and nothing here suggests clustering is “almost as good” as classification. They answer different questions.
Choosing a Paradigm
| Question | Supervised | Unsupervised | Reinforcement |
|---|---|---|---|
| Do you have correct answers for past cases? | Required | Not needed | Not needed |
| Is the target a category or a number? | Either | Neither: structure only | Neither: an action |
| Is feedback delayed until after a sequence of actions? | No | No | Yes |
| Can you afford the labels? | Usually the constraint | Labels are the point | Reward design is the constraint |
| What does success look like at evaluation? | Accuracy, F1, RMSE on held-out rows | Cluster agreement, explained variance, expert review | Return over several runs, in environments not used for training |
Four short cases. A model that flags fraudulent transactions has years of confirmed cases: supervised. A marketing team with no segments and no labels wants groups to describe: unsupervised. A robot that must choose moves before knowing whether they worked: reinforcement. A speech recogniser with 10 hours of transcripts and 1,000 hours of audio: supervised with a semi-supervised phase, because the labels are the bottleneck.
Real projects mix the three. A common pattern is unsupervised pretraining followed by supervised fine-tuning, which is supervised learning that starts from structure rather than labels, and it is why the boundaries in this article are described as signals rather than as separate worlds.
Where Each Paradigm Fails
Supervised learning fails when the labels are wrong, thin or unrepresentative. It learns whatever pattern the labels encode, including a clinician’s inconsistent judgements, and it degrades quietly when the test distribution moves away from the training one. The 0.7491 at five labels is the optimistic case: the five were drawn to represent all three classes, and a random five would sometimes contain none of one species.
Unsupervised learning fails when the structure is in the eye of the algorithm. K-means always returns k clusters, whether or not k is right; here the held-out ARI of 0.5936 shows partial agreement with the species, and the in-sample 0.6256 shows how much a within-sample score can flatter it. Silhouette scores compare cluster shapes, not truth.
Reinforcement learning fails when the reward is wrong or the agent has not explored enough. A policy that reaches the goal in 6 steps in a deterministic 4×4 grid says nothing about a task with thousands of states, delayed rewards and a stochastic environment, where evaluation needs many runs and a fixed protocol.
Key Takeaways
- The learning signal defines the paradigm labels, rows, or rewards.
- Supervised accuracy is bought with labels , and the first few labels are worth far more than the last few.
- Semi-supervised learning closes part of the gap at low label counts, then stops helping: 0.8596 against 0.7491 at five labels, level by 60.
- Keep classification and clustering metrics apart. 0.95 accuracy and 0.59 ARI are not the same kind of number.
- In-sample scores flatter clustering 0.6256 in-sample against 0.5936 held out.
- Reinforcement learning needs an environment, not a dataset , and one deterministic gridworld proves only that the loop works.
Conclusion
The three paradigms are one idea with three inputs. Supervised learning consumes answers, unsupervised learning consumes structure, reinforcement learning consumes consequences, and each one constrains what the program can be asked to do. The measured comparison here is deliberately narrow: on one small dataset, with 30 splits and one metric per task, labels bought accuracy, semi-supervision bought some of it back while labels were scarce, and clustering answered a different question without pretending otherwise.
The next decision is not which algorithm to try; it is which of the three signals you actually have. Once that is settled, the algorithm articles in the artificial intelligence section take each family in turn, and how we test machine learning code explains the splits, baselines and repeated runs behind every number here.
Source Code and Tests
All programs on this page are in the machine-learning/types-of-machine-learning directory of the MYCPLUS Python examples repository.
Build and test:
python -m pip install -r requirements-dev.txt
python label_budget.py
python -m unittest discover -s tests -v
The 18 tests check the properties this article claims: the 112/38 split and its stratification, that the labelled subset comes only from training rows and contains every class, that the same seed gives the same subset to both supervised methods, that a scaler fitted on training rows differs from one fitted on everything, that k-means receives no labels (the test permutes them and the clusters do not change), that both supervised models beat the majority baseline, and that all ten gridworld seeds reach the goal in the optimal six steps.
What I Verified
| Check | Windows 11 | Ubuntu 24.04.5 (WSL 2) |
|---|---|---|
| Environment | Build 26300, Python 3.14.6, NumPy 2.5.5, scikit-learn 1.9.1 | Kernel 5.15.146.1, Python 3.12.3, NumPy 2.5.5, scikit-learn 1.9.1 |
label_budget.py | Ran; table as shown, 30 seeds × 8 budgets | Identical output, line for line |
reinforcement.py | Ran; 10 seeds, 6 steps each, sd 0.00 | Identical output, line for line |
| 18 unit tests | Pass | Pass |
| Held-out rows | Touched only by predict and score; labels never enter a fit | Same code, same guarantee |
Not covered: macOS, ARM, other library versions, a stochastic or larger reinforcement environment, more than one dataset, and any claim that the iris gradient generalises to harder data.




