What Is Machine Learning?
Instead of writing the rules yourself, you hand over examples and let a procedure find the function. What arrives alongside those examples splits the field.
Why Does This Exist?
Forty thousand boxes a night move past a camera in a parcel depot, and somebody wants the crushed ones pulled off before a customer opens one. Try writing that as a rule. Outline deviation. Missing corner shadow. Torn tape. You will add condition after condition and still miss the box that got sat on, because crushed was never a threshold on anything you can name.
So stop writing the rule. Take four thousand photos a human already marked crushed or fine, hand the pile to a procedure whose job is finding a function that reproduces those verdicts, and use what comes back.
That function is , from an input , one photo, to an output , crushed or fine. You never see it. You see examples of what it does, and you search a family of candidates for whichever matches best. To generalise is to be right about a photo nobody labelled, which is the only thing anybody pays for. When that goes wrong on new data it has a name, overfitting, and it is the natural next page after this one.
Think of It Like This
The new hire standing at the end of the belt
You have somebody new on the sorting line tonight. Option one: hand them a laminated card with sixty rules. They will follow it precisely and freeze the first time a box fails in a way rule forty-three does not cover.
Option two: stand next to them and call it as boxes go past. That one is crushed. That one is fine. No card, no explanation. By the end of the shift they are catching the wet-and-slumped boxes you never described, because they saw eleven of them and you said the word each time.
The interesting part is what else you could have done. Call every box, and they learn from a complete answer key. Call the first fifty, then take a phone call and let them watch eight thousand in silence. Call none, and they still come back with these fall into about four kinds.
Where it stops: the hire understands English, wants to keep the job, and already knows what a box is. A fitting procedure has none of that. It finds whatever function scores well, including one that keys off the camera's timestamp. The analogy shows how supervision shapes learning, not how little the procedure understands.
How It Actually Works
All four paradigms feed one pipeline: examples in, a fitted function out, that function applied to inputs nobody has seen. What changes is the supervision arriving alongside the input, and that single difference carves the field into paradigms.
The four, on the belt
Supervised. Every has its . Four thousand labelled photos, a fitted detector, eight hundred held back so you can count how often it is right. Almost everything in production is supervised, and labels are why. They are the expensive ingredient.
Unsupervised. No anywhere. Push two million unlabelled photos in and ask what structure they have. k-means might return clusters that turn out to be night-shift lighting, the third camera's dirty lens, and genuine damage. Two of those are operations problems, and nothing here has an answer key.
Semi-supervised. Four thousand labelled, two million not. That is what a real project has on day one. The unlabelled mountain still carries information, in where photos bunch together and which directions barely vary, and using it places a boundary with far fewer labels.
Reinforcement. No answer key. A consequence. A robot arm lifting a flagged box earns a reward when it lands in the right chute and nothing when it fumbles. Nobody supplied joint angles, so credit has to spread backward across the whole sequence of moves, which is why reinforcement learning is harder than the tidy diagram suggests.
Where the split stops holding
Blank out a patch of each unlabelled photo and train a model to reconstruct what you removed. There is a label, the patch, and no human produced it. That is self-supervised learning: supervised training on labels invented from the data's own structure. It fits none of the four boxes, and it is how nearly every large modern model gets pre-trained. So treat the paradigms as a question. What supervision do I actually have?
When to write the rule instead
If the rule is writable, write the rule. Parcels over thirty kilograms go to the pallet lane: the belt has a scale, the threshold is a policy decision, and a lookup wins on every axis. Machine learning earns its place when the rule exists but nobody can state it: faces, speech, whether a box looks crushed. Elsewhere you bought a training pipeline and an unexplainable failure mode in exchange for reproducing an if statement.
Code
One measurement per parcel, one threshold, learned rather than guessed.
import numpy as np
def best_cut(x: np.ndarray, y: np.ndarray) -> float: cuts = np.unique(x) # One matrix compare stands in for the whole search over candidate rules. wrong = ((x[None, :] >= cuts[:, None]) != y[None, :]).sum(axis=1) return float(cuts[wrong.argmin()])
rng = np.random.default_rng(0)dent = np.concatenate([rng.normal(2.0, 1.0, 400), rng.normal(6.0, 1.0, 400)])damaged = np.concatenate([np.zeros(400), np.ones(400)]).astype(bool)
for name, cut in (("hand-written rule", 3.0), ("learned rule", best_cut(dent, damaged))): print(f"{name:18s} cut at {cut:5.2f} {((dent >= cut) == damaged).mean():.3f} correct") # -> hand-written rule cut at 3.00 0.921 correct # -> learned rule cut at 4.06 0.984 correctEyeballing the histogram gets you 3.0 and 92.1 percent. The search gets 4.06 and 98.4 percent, about two and a half thousand fewer mistakes a night. No neural network anywhere: it defined a family of rules, scored every member, kept the winner. Everything else in the field is a bigger family, and the simplest fitted rule of that kind is linear regression.
Watch Out For
Modelling something a lookup table already answers
The symptom is a project that keeps almost working. Accuracy sits at 97 percent, the last 3 percent is unpredictable, and every review meeting is about adding features. Meanwhile the real decision rule sat in a policy document the whole time, and your model is an approximation of a document.
Go find the rule before you collect labels. Ask whoever owns the decision to state it. If they can, implement it and keep the model for the residue they genuinely cannot articulate.
Assuming next month's parcels look like last month's
All four paradigms rest on one assumption: the data you fit on comes from the same distribution as the data you predict on. It is the first thing to break in production, and it breaks quietly. The depot installs brighter LEDs. A supplier switches to thinner cardboard. Accuracy slides from 98 percent to 84 percent with no code change and no failed test.
Monitor inputs, not only outputs. Track the distribution of features going in and alarm when it moves, because that signal arrives before the accuracy drop, often before you have fresh labels at all. Distribution shift covers the flavours.
The Quick Version
- Machine learning fits a function from input to output using examples, instead of you writing the mapping.
- The paradigms differ by one thing: what supervision arrives with the input. A label for every example, a few, none, or a reward.
- Semi-supervised is the realistic starting condition for most projects, not the exotic case.
- Self-supervised learning invents labels from unlabelled data, so the classic three-way split no longer covers the field.
- Unsupervised learning has no answer key, which makes evaluation a judgement about usefulness.
- If the rule is writable, write the rule. Everything here also assumes training and deployment data match, and that assumption fails first.