The prediction game
Input → model → guess → score
Many systems in modern AI (the model that finishes your sentence, labels your photo, or writes code) are, underneath, trained by the same simple game. The model looks at some input, makes a guess about an answer, and finds out how wrong the guess was. Then it changes itself a little so that next time the guess is closer. Do that a few billion times and you get something that feels intelligent. The same loop connects a simple price predictor to a model that generates pages of text.
Input, model, prediction
A machine-learning modelmachine-learning modelA mathematical rule whose behavior is fitted to examples so it can make predictions or find patterns in new data.See in glossary → is a functionfunctionA rule that takes an input and gives back exactly one output — like a machine: put something in, get something out. Often written f(x); for example f(x) = 2x turns 3 into 6. A model is just a (very elaborate) function from input to prediction.See in glossary →: a rule that takes an input and produces an output, here a prediction. Training adjusts that rule using examples.
- Input: the size of a house. Prediction: its price.
- Input: an email. Prediction: spam or not.
- Input: the text so far. Prediction: what comes next.
The model is whatever sits in the middle turning one into the other. For now, picture it as a box with a few numbered dials on the side. The same input, with the dials in different positions, produces different predictions. Those dials are the learned part of the model: training changes their settings so the predictions improve and get more and more accurate.
A wrong guess needs a score
A guess is only useful if you can say how good it was. So we need a single number that measures wrongness: bigger when the prediction is far from the truth, smaller when it’s close, zero when it’s perfect. That number is the lossloss functionA single number measuring how wrong the model's predictions are on a batch of data. Training works by adjusting the model to make this number smaller.See in glossary →, and training aims to make it smaller. The choice of loss determines what counts as a good prediction.
Play the game yourself
Here is the smallest possible version. The machine predicts using one dial, w, with the rule prediction = w × input. The gold dots are the real answers we want it to match. Drag w and watch the score. Then hand the job to the machine: “Take one step” lets it feel which way the score is falling and nudge w that way; “Let it learn” repeats that automatically.
Notice what just happened. You didn’t tell the machine the right value of w. You gave it examples and a way to score itself, and the “learning” button found the answer by repeatedly measuring and nudging. No rules about houses or prices were ever written down: only predict, score, adjust.
Learning from examples
The examples must give the model some way to judge its predictions. Sometimes each input comes with a correct answer, such as a house paired with its sale price. Sometimes the training signal comes from the data itself or from the consequences of an action. Those differences give rise to several kinds of machine learning.