1 / 26
Artificial Intelligence · Grade 7 · Chapter 5

How AI Models Work

Inside the Neural Network: How machine learning turns patterns into predictions.

Chapter Goals

What We Will Master Today

The Magic Photo Classifier

How Does Your Phone Know It's a Cat?

No programmer wrote 10,000 if statements describing every cat ear, whisker, or tail angle. So how does AI instantly identify cats in photos?

Discuss before revealing: Could you write if/else rules that work for EVERY cat in the world?
Core Concept 1

Traditional Programming vs Machine Learning

Traditional Code

Inputs + Hardcoded Rules → Output

Human programmer writes explicit rules for every edge case.

Machine Learning (AI)

Inputs + Target Answers → Learned Rules (Model)

AI discovers patterns automatically from training data!
Core Concept 2

Data Feature Extraction

Computers can't "see" colors or "hear" sounds — they only understand numbers. Data must be converted into numerical features.

Image Pixels

A photo is converted into a grid of numbers representing Red, Green, and Blue brightness (0 to 255).

Audio Waveforms

Microphone sound is broken down into frequency numbers (pitch and volume over time).

Visualizing Data

How AI Sees a 3x3 Pixel Image

Imagine a tiny 3x3 image grid converted into numbers for the AI:
[255, 0, 0]
[0, 255, 0]
[0, 0, 255]
[128, 128, 0]
[255, 255, 255]
[0, 0, 0]
Core Concept 3

What is an Artificial Neural Network?

An AI model inspired by biological brains, made of interconnected mathematical nodes (neurons) grouped in layers.

1
Input Layer (Features)
2
Hidden Layers (Pattern Finding)
3
Output Layer (Prediction)
Architecture Diagram

Structure of a 3-Layer Neural Net

INPUTS
x1
x2
x3
HIDDEN LAYER
h1
h2
h3
h4
OUTPUT
Cat
Dog
Core Concept 4

What are Weights and Biases?

Connections between neurons have Weights (importance strength) and Biases (threshold modifiers).

High Weight

If feature = "Pointy Ears", weight is high for "Cat" prediction.

Low / Negative Weight

If feature = "Pointy Ears", weight is low for "Fish" prediction.

Physical Analogy

How AI Learns: Shooting a Basketball

1
First Shot: Misses left (High Error)
2
Calculate Error: Adjust wrist angle & force
3
Repeat 10,000 times until swish!
AI training works the exact same way: calculate prediction error and tweak weights backward!
Training Cycle

The Machine Learning Loop

Forward Pass

Input data moves forward through layers to make a guess.

Loss Calculation

Compare guess with true answer to calculate error score.

Backpropagation

Adjust connection weights backward to improve next guess!

Critical Thinking

Garbage In = Garbage Out!

An AI is only as good as the data used to train it.

Scenario: You train an AI dog classifier using 5,000 photos of dogs in snow. What happens when you test it with a dog on a green lawn?
Discussion: The AI might learn that "Snow = Dog" instead of learning dog features!
Smartboard Voting

Is This AI (Machine Learning) or Traditional Code?

1. ATM machine counting cash bills

2. Spam filter learning suspicious email text

3. Spotify generating personalized weekly playlists

4. Microwave timer counting down 60 seconds

AI Domains

Computer Vision vs Natural Language Processing

Computer Vision (CV)

Processes visual pixels to recognize objects, medical X-rays, and self-driving roads.

Natural Language Processing (NLP)

Processes text tokens to translate languages, answer questions, and summarize documents.

Spot the Flaw

What is "Overfitting"?

A student memorizes the exact answers to last year's math test, but doesn't understand the concepts. When given new test questions, they fail!
In AI, Overfitting happens when a model memorizes training photos instead of learning general patterns.
Quick Check · Quiz 1

How does Machine Learning differ from Traditional Programming?

AML uses faster microchips
BML learns patterns from data instead of hardcoded rules
CTraditional code doesn't use math
DML only runs on smartphones
Click to reveal answer
Quick Check · Quiz 2

What is the primary role of "Weights" in a neural network?

ATo measure the file size of the AI
BTo adjust connection strength between neurons
CTo increase computer battery life
DTo turn the monitor on and off
Click to reveal answer
Quick Check · Quiz 3

Which neural network layer is responsible for extracting hidden features?

AInput Layer
BHidden Layer
COutput Layer
DPower Supply
Click to reveal answer
Quick Check · Quiz 4

What is the consequence of training an AI model on incomplete or biased data?

AThe AI becomes conscious
BThe computer melts
CThe AI makes biased or inaccurate predictions
DNothing changes
Click to reveal answer
Guided Practice

Design an AI Weather Predictor Model

Input Layer (3 Features): Temperature, Humidity %, Wind Speed

Hidden Layer: Combines features to calculate storm likelihood

Output Layer: "Rain" (85% confidence) vs "Clear" (15% confidence)

Real-World AI

Where Neural Networks Work Today

Myth vs Fact

AI Myth Buster

Myth

"AI is conscious and thinks like a human brain."

Fact

"AI is high-speed mathematical probability matching data patterns."

Safety Rule

Human-in-the-Loop (HITL)

Critical decisions (medical diagnoses, legal judgements) must ALWAYS be verified by human experts, not left solely to AI predictions.

Summary & Takeaways

What We Learned in Chapter 5

Pipeline Recap

The AI Pipeline in 4 Steps

1
Collect & Clean Data
2
Extract Features
3
Train Neural Net
4
Make Predictions
Exit Ticket

Neural Net Reflection

In 2 sentences, explain:

What is the job of the Hidden Layer inside a neural network?

Next Chapter: Python Conditionals (if/elif/else)!