sciandu
Computer science

Computer science

Artificial intelligence

Why some programs learn from examples instead of following rules, and what that has to do with your everyday life.

What you need first

Your phone recognises your face, your spam filter sorts out annoying mails and your music app suggests songs you actually like. Behind all of this sits the same idea: machines that learn from examples. How that works is easier to understand than you might think.

Following rules or finding patterns

A classic program follows rules a human wrote down: if the price is above 10 euros, show a warning. For many tasks that works great. But try writing rules for how to recognise a cat in a photo. Nobody can. Learning systems take a different path: they get many examples, the so-called training data. That can be thousands of photos, each one labelled cat or dog. From these they work out the patterns that tell the two apart, all on their own.

Learning boundary
Threshold5
Apples Melons misclassified
12345678910Weight
12 of 14 correct (86%)

The machine learns a boundary from examples. A perfect split is often impossible.

Try it: move the line so it separates the two groups of points as well as possible. That is exactly what a machine learns during training.

Learning a boundary

Many learning tasks come down to the same thing: finding a boundary that separates two groups. The system starts with a random line, looks at example after example and nudges the line a bit with every mistake. After enough rounds, it sits so that even new, unseen examples usually land on the correct side. That is exactly what learning means here: not memorising, but generalising.

Why AI makes mistakes

A learned boundary is never perfect. Some points land on the wrong side, and what the system never saw in its training data, it cannot know. The data determines the quality: if it is one-sided or flawed, the machine learns exactly those flaws too. So check an AI's answers like the advice of a person who knows a lot but is sometimes wrong. You will still meet it daily: in face recognition, in spam filters, in translations, in navigation and in every recommendation feed.

Exercises

0 of 6 solved

Time to try it yourself. You can't break anything, every attempt counts.

What is the difference between a classic program and a learning system?

What does a learning system learn from?

A system is meant to tell cats and dogs apart. It trains on 80 cat pictures and 40 dog pictures. How many training examples is that in total?

Put the steps in the right order for how a learning system finds a dividing line.

  1. 1With each mistake it nudges the line a bit.
  2. 2The system starts with a random line.
  3. 3It looks at one example after another.
  4. 4In the end even new, unseen examples usually land on the correct side.

After training, the system gets 100 new pictures and sorts 90 correctly. How many does it sort wrongly?

Machine learning is not about memorising, but about .

Where this leads