How Machines Discover Patterns in Data
See how a model finds a pattern in data and uses it to make predictions, and why more examples help.
Machine learning starts with data: examples with the right answers. Here, sales of houses: their size and the price they sold for.
The model looks for a pattern in those examples, such as "every extra square metre adds about €1,800". Then it uses that pattern on a house it has never seen: that is a prediction. Learning is only useful if it works on new cases, not just the examples it already knows.
The pattern can only be as good as the data. With two examples, a model can easily find a pattern that is simply wrong. With many examples, the random ups and downs of single sales cancel out, and the real pattern shows through.
Key takeaways
- Data = examples with the right answers. The model learns from them.
- A pattern is the rule the model finds in the data; a prediction is that rule applied to a new case.
- What matters is how well predictions work on new cases, not on the examples it learned from.
- More (and better) data usually gives a more reliable pattern.
Check your understanding
Go deeper (more technical)
The simulation uses linear regression: the straight line that keeps the squared distances to all the points as small as possible. It is one of the oldest machine learning methods (early 1800s) and still the first thing many data scientists try.
A model that fits its training examples well but fails on new data is overfitting: it learned the noise instead of the pattern. That is why practitioners always keep some data aside (a "test set") that the model never learns from, just to check it, exactly like the 5 new houses here.