Learning from data in its simplest form: a model with two parameters, the best-fit line as what the computer learns, a prediction for a new point, the error, one outlier, and data with nothing to learn.
Step 1 of 5 · A model
Step 1 of 5
A model
Machine learning is a way of writing software without writing the rule: instead of telling the computer what to do, you give it examples, and it finds a rule that fits them itself. That rule is called a model, and the numbers that set it are called parameters.
The simplest model is a line, , with two parameters: the intercept and the slope . On the board are twenty measurements made by a rule the computer does not know, with noise. To learn is to choose and so that the line passes as close to the points as it can: the best-fit line, which minimises the sum of the squared distances. Predict, and then Look inside will show what the computer learned.
Step 2 of 5
Predicting
A model that has learned is useful when it answers new questions. The board has no measurement at , but the line has an answer.
Step 3 of 5
The error
How wrong is the model? Its error is the spread of the points about the line, , roughly a point’s typical distance from the line. In the real world you do not choose the noise, but you can collect more accurate data.
Step 4 of 5
Bad data
A model is only as good as its data. Real measurements sometimes hold a mistake: a faulty instrument, a mistyped digit. Predict what one such measurement will do.
Step 5 of 5
Nothing to learn
Look inside now shows the mean and the spread about it, . Guessing the mean is the simplest model there is, with no at all. The question is whether a line does any better.
Loading the interactive version…
Loading the interactive version…
Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.
Practice · Predict, then look
The twenty measurements were made by a rule in which rises by for each of , plus noise. A computer will find their best-fit line, the line that fits them best. What will its slope be?
Practice · Predict, then look
The twenty measurements were made by a rule in which rises by for each of , plus noise. A computer will find their best-fit line, the line that fits them best. What will its slope be?
Practice · Calculate
The board shows the learned line, . What does it predict for in a new measurement at ?
Practice · Calculate
The board shows the learned line, . What does it predict for in a new measurement at ?
Practice · Reach the target
The model’s error is the spread of the points about the line. Change Noise until the error is below , and press Check.
Practice · Reach the target
The model’s error is the spread of the points about the line. Change Noise until the error is below , and press Check.
Practice · Predict, then look
We will add one bad measurement to the data, far below the rule, near the right-hand end. What will happen to the slope of the learned line?
Practice · Predict, then look
We will add one bad measurement to the data, far below the rule, near the right-hand end. What will happen to the slope of the learned line?
Practice · Predict, then look
Now and are unrelated: the rule’s slope is , and the points are scattered about the mean with a spread of . Will the line the computer learns predict much better than guessing the mean?
Practice · Predict, then look
Now and are unrelated: the rule’s slope is , and the points are scattered about the mean with a spread of . Will the line the computer learns predict much better than guessing the mean?
Lesson complete. Every practice question here is done.