Find a course

Module 2: How AI LearnsLesson 4 of 79 min

Sorting and Predicting

Two of AI's favorite jobs are sorting things into groups and predicting what comes next. See how both work and play a guessing game.

Step 1 of 13Learn

Job 1: sorting

Many AI tools sort things into groups. Scientists call this classifying.

  • An email filter sorts messages into "spam" or "not spam."
  • A photo app sorts pictures into "beach," "dogs" or "birthday."
  • A recycling robot sorts trash into plastic, paper and metal.

Each time, the AI looks at something new and decides which group it belongs to, based on patterns it learned.

Step 2 of 13Practice · Diagram

A robot sorts trash

Where does a soda can go?

Tap the shape that answers the question, then press Check.

A robot sorts trashHierarchy diagram: Trash on the belt, Plastic, Paper, Metal.Trash on the beltPlasticPaperMetal
Trash on the belt
Plastic

Bottles.

Paper

Boxes, newspapers.

Metal

Cans.

Step 3 of 13Practice · Sort into groups

You are the AI! Sort these emails.

Tap an item, then tap its group (or drag it there).

Step 4 of 13Learn

Job 2: predicting

AI also predicts: it uses patterns from the past to guess what comes next.

  • A weather computer uses past weather to predict tomorrow's rain.
  • A typing app guesses the next word in your message.
  • A map app predicts how long your trip will take.

A prediction is a smart guess, not a promise. That is why a forecast can say 70% chance of rain and you still stay dry.

Step 5 of 13Practice · Chart

Chance of rain this week

Which day should you surely pack an umbrella?

Tap the bar that answers the question, then press Check.

Chance of rain this weekBar chart with 5 categories: Mon: 10%; Tue: 70%; Wed: 30%; Thu: 90%; Fri: 20%.0%20%40%60%80%100%MonTueWedThuFri10%70%30%90%20%
Made-up numbers to show the idea.
Chance of rain this week
ItemChance of rain
Mon10%
Tue70%
Wed30%
Thu90%
Fri20%

Step 6 of 13Practice · Choose one

A typing app suggests "birthday" after you type "Happy". What is the AI doing?

Step 7 of 13Learn

Twenty questions

Some AI sorts things by asking a chain of yes-or-no questions, like the game twenty questions. This is called a decision tree.

To guess an animal: Does it have feathers? No. Does it live in water? Yes. Does it breathe air? Yes. It might be a dolphin!

The AI learns which questions to ask, and in which order, from its training examples. Good questions split the choices quickly.

Step 8 of 13Practice · Diagram

A decision tree guesses an animal

No feathers, lives in water, breathes air. Tap the answer.

Tap the shape that answers the question, then press Check.

A decision tree guesses an animalHierarchy diagram: Has feathers?, Yes: a bird, No: lives in water?, No: a land animal, Yes: breathes air?, Yes: a dolphin, No: a fish.Has feathers?Yes: a birdNo: lives inwater?No: a land animalYes: breathesair?Yes: a dolphinNo: a fish
Has feathers?
Yes: a bird
No: lives in water?
No: a land animal
Yes: breathes air?
Yes: a dolphin
No: a fish

Step 9 of 13Practice · Put in order

A decision tree is guessing a fruit. Put its questions in a sensible order, from the most general to the most specific.

Drag the items, or use the arrow buttons, to put them in order.

  1. Is it long and curved?
  2. Is it yellow?
  3. Is it a fruit or a vegetable?
  4. Is it a banana?

Step 10 of 13Practice · True or false

A prediction made by AI is always correct.

Step 11 of 13Practice · Fill in the blanks

Fill in the blanks

When an AI sorts things into groups, scientists call it .

Word bank

Step 12 of 13Note

Step 13 of 13Practice · Match the pairs

Is it sorting or predicting? Match each example.

Tap an answer, then tap the place where it belongs (or drag it there).

  1. Spam filter moves junk mail
  2. Weather app says rain tomorrow
  3. Photo app groups dog pictures
  4. Typing app suggests your next word