Introduction to AI Lesson 6 of 25

Part 1 · Lesson 6 · 6 min

Rules vs learning: two ways to make a machine smart

Try writing the rules for telling a cat from a dog. How many rules do you need?

Rules are a recipe you write. Learning is a cook who tastes thousands of dishes and works out the recipe.

There are two basic ways to make a computer do something smart. You can write the rules yourself, step by step. Or you can show it examples and let it work out the rules on its own.

Let us try the first way on a job any five-year-old can do.

Writing the rules for "cat"

Every rule you write has exceptions, and every fix creates new ones. You know a cat when you see one, but you cannot fully explain how you know.

The second way: learn from examples

Machine learning flips the job around. You collect lots of examples with the right answer attached, and the computer searches for the pattern that connects them.

Show it examples instead

So computers do not only do what they are explicitly told. A learning system writes its own rules from examples. The catch: those rules are usually a huge pile of numbers, and often nobody can read them out in plain words.

Which tool when?

Learning is not always better. When the logic is clear, stable and has to be checked line by line, plain rules are cheaper, faster and easier to audit.

Rules or learning?

A good rule of thumb: if you can write the logic on one page and it rarely changes, use rules. If the pattern is fuzzy, huge, or keeps moving, use learning.

Go deeper optional

Real systems usually combine both. A learned model gives a score, like "87% likely to be fraud", and hand-written rules decide what to do with it, like "above 80%, freeze the card and call the customer". The rules act as guardrails around the model.

Because learned rules are hard to read, there is a whole field called explainable AI. It builds simpler models on purpose, or tools that show which inputs pushed a decision one way or the other. In regulated work, being able to explain a decision can matter as much as getting it right.

Check yourself

1. Which task suits hand-written rules best?

2. What does a learning system use instead of hand-written rules?

3. Why did spam filters move from rules to learning?