← ⚙️ Inside AI

Inside AI · Topic 2 of 10

Algorithms and machine learning

In normal programming a person writes the rules. In machine learning the computer finds the rules itself from examples.

📌 Key points

  1. An algorithm is a precise, step-by-step set of instructions for solving a problem or doing a task.
  2. In traditional programming a programmer writes the rules: input + rules → output.
  3. In machine learning (ML) the computer is given examples (data, often with the right answers) and finds the rules itself: data + answers → rules.
  4. The result of machine learning is a model: a program that makes predictions or decisions about new inputs.
  5. Rule-based programs are predictable and easy to explain, but some rules are too hard to write by hand, such as how to recognise handwriting.
  6. ML works well when there are many examples but the rules are too complex to write. It needs lots of good data, can still make mistakes and can be hard to explain.
  7. ML still uses algorithms: a learning algorithm builds the model from the data.
  8. AI is the big field. Machine learning is one part of AI, and deep learning is one part of machine learning.

📖 Key words

Algorithm
A precise, step-by-step set of instructions for solving a problem.
Rule-based system
A program that follows rules written by a person, e.g. "if temperature < 20 °C, turn the heating on".
Machine learning
A type of AI where computers learn patterns from data instead of being given every rule.
Model
The program produced by machine learning. It uses what it learned to make predictions.
Prediction
A model's output for a new input, e.g. "this email is spam".
Deep learning
Machine learning with neural networks that have many layers.

✏️ Worked example

How could a computer decide which emails are spam?

  1. Rule-based way: a programmer writes rules such as "if the email says WIN MONEY, mark it as spam".
  2. Problem: spammers just change the words, so the programmer must keep writing new rules.
  3. Machine learning way: give a learning algorithm thousands of emails, each labelled "spam" or "not spam".
  4. The algorithm finds patterns in the words, links and senders, and builds a model that predicts how likely a new email is to be spam.
  5. When users mark new emails as spam, the model can be trained again, so it keeps up with new tricks.
💡 Remember

Remember: traditional programming is "rules in, answers out". Machine learning is "examples in, rules out".

Test yourself8 questions from a bank of 18. A new mix every time.
Start the quiz →

It’s bedtime! 😴

It’s late, and even Numo is getting sleepy. The best thing you can do for your learning now is… go to sleep!

✨ Sleep helps you

  • 🧠 remember what you learned today: your brain saves it while you sleep
  • 🌱 grow and stay healthy
  • ⚡ wake up with energy, ready to learn and play
  • 😊 feel happy and calm

🦉 Going to bed late can make you

  • 😩 tired and sleepy at school tomorrow
  • 🤯 find it harder to focus and to remember
  • 😠 grumpy and easily upset
  • 🤧 catch colds more easily

Children your age need 9 to 12 hours of sleep every night. Numo will be right here tomorrow!