What is machine learning?

Programs that learn from examples instead of following rules someone wrote by hand, and why that turned out to be such a powerful idea.

Lesson · 12 min

In this lesson you will

  • Describe machine learning as learning a task from examples rather than from hand-written rules
  • Recognise which everyday problems suit rules and which suit learning
  • Name the two big families you will meet first, supervised and unsupervised learning

Welcome! You use machine learning dozens of times a day, usually without noticing: when your inbox quietly hides spam, when your phone groups photos by the people in them, when a map predicts how long your drive will take. In this course you will build up, one small step at a time, exactly how those systems work. No programming needed yet, just curiosity.

The course tutor, a friendly robot

Two ways to get a computer to do something

The traditional way to program a computer is to write the rules. To add sales tax, you write “multiply the price by 1.08”. To sort names, you follow a known recipe. The rules are exact and the computer follows them perfectly.

But try writing the rules for “is this email spam?”. You might start with “if it mentions a prize, it’s spam”, then discover legitimate emails about prizes, spam that misspells “prize” on purpose, spam in other languages… The list of exceptions never ends.

Machine learning flips the approach around. Instead of writing the rules, we show the computer lots of examples (thousands of emails, each marked spam or not spam) and let it work out the pattern for itself. The pioneer Arthur Samuel described it in the 1950s as giving computers the ability to learn without being explicitly programmed. His checkers program played thousands of games against itself and became a better player than Samuel was.

Machine learning is the field of building programs that improve at a task by learning from examples (data) instead of following rules written by a person.

Rules or learning? Try it

Some tasks are perfect for rules: they are exact and the rules are short. Others are fuzzy, full of exceptions, or so complex nobody could write the rules down. Sort the cards below. The second tab previews the two big families of machine learning you will meet in the next lesson.

Loading the interactive graphic…

Some jobs are easy to hand to a computer as a list of rules, and some are not. Let's sort a few together.

A useful test: if you can’t explain the rules, but you can easily give examples, it’s a job for learning. You can’t describe exactly what makes a face your friend’s face, but you can point at a hundred photos of them.

Why learning wins on messy problems

Here’s the same idea with numbers. The dots are houses: how big each one is, and what it sold for. Your job is to write a rule that predicts the price from the size. Use the sliders to tune a simple “small houses cost this much, big houses cost that much” rule, then press Let the model learn and compare.

Loading the interactive graphic…

Notice two things:

  1. The learned model misses by less, and it found its answer in an instant.
  2. Press New houses: your carefully tuned rule is now wrong again and must be re-tuned by hand, while the model simply learns again from the new examples. Learning adapts.

That second point is why machine learning took over so many fields: the world changes, and a system that can relearn from fresh data keeps up.

The plan for this section

In this first section you will build the simplest useful learning machine, a straight line that predicts house prices, and learn the three ideas that sit underneath nearly all of machine learning, including the giant models behind today’s AI:

  • a model that turns an input into a prediction,
  • a cost that measures how wrong those predictions are,
  • an optimiser (gradient descent) that nudges the model to be less wrong, again and again.

Check yourself

Self-check · 4 questions

What is machine learning?

1. Which description fits machine learning best?
2. Which task is the best fit for hand-written rules rather than learning?
3. In the house-price widget, you pressed New houses. Why did the learned model cope better than your tuned rule?
4. What are the three ingredients you will build in this section?