Rules versus examples
A spam filter can be built two ways. You can write the rules yourself: block messages containing certain phrases, from certain domains, with too many links. Or you can collect thousands of messages already marked spam or not spam and let an algorithm find the rule that separates them.
| Traditional programming | Machine learning | |
|---|---|---|
| Input | Data + rules written by a person | Data + the answers for that data |
| Output | Answers | A rule (the model) |
| Breaks when | The world outgrows the rules | The new data stops resembling the old |
| Improved by | Editing code | Better or more data, or a better model family |
The second approach wins when the rule exists but is too tangled to write down, like recognising a handwritten 7, pricing a house from forty attributes, or spotting fraud in a pattern of card payments.

