Module 4 โ€“ How AI Learns
beginner15 XP

Training AI with Examples ๐ŸŽ“

See how AI learns from labelled examples โ€” just like how you learned to read

Training AI with Examples ๐ŸŽ“

Remember Learning to Read?

When you were tiny, someone showed you pictures and said words:

๐Ÿ“ธ "CAT" ๐Ÿ“ธ "DOG" ๐Ÿ“ธ "CAR" ๐Ÿ“ธ "CAT" ๐Ÿ“ธ "DOG" ๐Ÿ“ธ "CAR" ... (repeated many, many times) ... โ†’ You learned to recognise and read those words!

Training AI works EXACTLY the same way โ€” just with millions of examples instead of dozens!

The Training Process ๐Ÿ‹๏ธ

Step 1: Show AI an example [Photo of cat] + label: "cat" ๐Ÿฑ Step 2: AI makes a guess "I think this is... a dog?" ๐Ÿ• (Wrong!) Step 3: Tell AI it's wrong "No! This is a cat!" Step 4: AI adjusts tiny numbers inside itself Step 5: Try again with next photo [Photo of cat] + label: "cat" AI guesses: "cat?" ... "Yes!" Step 6: Repeat 10,000,000 times โ†’ AI becomes GREAT at recognising cats!

๐Ÿคฏ How Much Training Does AI Need?

| AI System | Training Examples | |-----------|-----------------| | Basic cat recogniser | ~10,000 photos | | Face ID | Millions of face photos | | Self-driving car | Billions of driving miles | | ChatGPT | 570 GB of text (billions of sentences) |

๐ŸŽฎ Real Example: Google's Cat Detector

In 2012, Google built an AI and showed it 10 million YouTube thumbnails without telling it what was in them.

The AI independently discovered that cats were one of the most common things in images online!

Nobody told it what cats were. It figured it out from PATTERNS alone. Mind-blowing! ๐Ÿคฏ

The Training Ingredients

Python
# What you need to train an AI:
training_data = [
    {"input": cat_photo_1, "label": "cat"},
    {"input": cat_photo_2, "label": "cat"},
    {"input": dog_photo_1, "label": "dog"},
    # ... millions more ...
]

# The AI adjusts itself until it gets most answers right
model.train(training_data)
# โ†’ Now model.predict(new_photo) works! ๐ŸŽ‰
โŒจ๏ธ

Type it yourself

Don't just read it โ€” type the example from above into the box, press Run โ–ถ, and watch what happens. Typing it yourself is how it really sticks! Stuck? Tap Show example.

Python ยท Playground
Output
Press โ–ถ Run to see your code come to lifeโ€ฆ

Quick check

01/2

How is training an AI similar to how you learned to recognise words as a child?