The ice cream seller's rule 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold
The ice cream seller picks how many ice creams to prepare for tomorrow with a rule: if it is colder than 21 degrees, 28, otherwise 47. A person wrote this rule.
The last eight days 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold
The dots are the real sales of the last eight days: temperature on the horizontal axis, ice creams sold on the vertical axis. The rule is close to some days and far from others.
The rule's errors 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold
The dashed lines are the rule's error on each day; on average it is off by 4.13 ice creams. Doing better means trying thresholds and numbers by hand. Add one more feature, such as whether the day is a weekend, and the number of rules to try multiplies.
Learning from examples 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold learned line
This time we do not write the rule. The program looks at the data of eight days and draws its own line: sales = 1.59 · temperature + 4.43. How the line is found is the job of the next topics.
The line's errors 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold learned line
The dashed lines are now the errors of the learned line: 1.95 ice creams on average. The rule's average was 4.13.
A prediction for tomorrow 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold learned line
Tomorrow is expected to be 27 degrees. The rule says 47, the hollow circle. The learned line says 47.25, the red dot.
When the data changes 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold learned line
Grab a day and drag it: the line is recomputed from the new data at once. The rule stays the same until someone rewrites it. You can also drag the rule's threshold and its two numbers by their rings.
Why it matters 0 5 10 15 20 25 30 35 0 10 20 30 40 50 60 70 temperature, degrees ice creams sold learned line
Machine learning means getting the rule from data. Spam filters, recommender systems and speech recognition take this path for jobs too complex to write rules for by hand. In return they need enough correct data.