In this lesson: Explain training, weights and error correction without using jargon.
"The machine learns" sounds mystical. It is not. It is guessing, measuring how wrong the guess was, and adjusting. Millions of times.
A model is a big pile of numbers
Suppose you want to predict a student's exam mark from two facts: hours studied, and attendance percentage. A very simple model is:
predicted_mark = (a × hours_studied) + (b × attendance) + c
Here a, b and c are weights. Choosing good numbers for them is the model. Training means finding them.
The training loop
The computer does exactly this, over and over:
- Guess. Start with random weights. Predict a mark for a student whose real mark you already know.
- Measure the error. Predicted 40, actual 70 — the error is 30. This measurement is called the loss.
- Nudge the weights a small amount in whichever direction makes that error smaller.
- Repeat with the next student. And the next. And the next, for millions of rounds.
The nudging step has a name — gradient descent — and it is the single most important algorithm in modern AI. The idea is the same as finding your way downhill in fog: you cannot see the valley, but you can feel which way the ground slopes, so you step that way and repeat.
Neural networks, briefly
Our example combined the inputs once. A neural network stacks that step in layers: the first layer combines the raw inputs, the second layer combines the results of the first, and so on. Each layer can express something more abstract than the one below it. In an image model the early layers react to edges, the middle layers to shapes like an eye or a wheel, the late layers to "cat" or "car". Nobody programmed those stages; they emerged because they were useful for reducing error.
The three ways a machine can be taught
| Style | What it is shown | Everyday example |
|---|---|---|
| Supervised | Examples with correct answers attached | Spam filter, exam-mark prediction |
| Unsupervised | Data with no answers — find the structure | Grouping customers into segments |
| Reinforcement | No answers, only rewards for good outcomes | Game-playing, robot control |
The failure you must know: overfitting
A student who memorises past papers scores well on those papers and badly on a new one. Models do the same thing. A model that has memorised its training data instead of learning the pattern is overfitted: excellent on data it has seen, useless on data it has not.
The defence is simple and non-negotiable: hold back some data the model never trains on, and judge it only on that. If someone tells you their model is 99% accurate and cannot tell you what it scored on held-back data, they have told you nothing.
Try it yourself
On paper, guess values for a, b and c above. Take a student with 10 hours and 80% attendance who actually scored 65. Compute your prediction, find the error, and adjust one weight to shrink it. You have just done, by hand, what training does billions of times.