Perceptron & Linear Classification

The Foundation of All Neural Networks

Difficulty
Beginner
Duration
12-18 minutes
Prerequisites
Basic graphs

What You'll Discover

Journey from complete ignorance to intelligent weather prediction

The Simplest Neural Network

Meet the perceptron - a single neuron that makes binary decisions. It's the building block of every neural network, including ChatGPT!

Decision Boundaries

Watch as the perceptron learns to draw a line that perfectly separates rainy days from sunny days in weather data.

Learning from Mistakes

See how the perceptron adjusts its "opinions" (weights) every time it makes a wrong prediction - just like how you learn!

Real-World Application

Use actual weather data to predict rain based on humidity and temperature - a practical AI application you can understand.

Foundation for Complex AI

Understand how this simple concept scales up to power modern AI systems like image recognition and language models.

Interactive Learning

Step through each prediction, see the math in action, and watch the decision boundary evolve in real-time.

Key Concepts Covered

Linear Classification

Separating data into two categories using a straight line

Decision Boundaries

The line that separates different classes of data

Perceptron Learning Rule

How the algorithm adjusts weights when it makes mistakes

Weight Updates

The mathematical process of learning from errors

Binary Classification

Making yes/no decisions based on input data

Pattern Recognition

How AI systems learn to recognize patterns in data

Step
1/ 40

🌦️ The Weather Prediction Challenge

Meet Sarah, a weather enthusiast who wants to predict rain using just two simple measurements:

Today's Data:Humidity: How much moisture is in the air (0-100%) • Temperature: How hot it is outside (0-40°C)

The Question: Can we draw a simple line that separates rainy days from sunny days?

Our Dataset: 10 days of weather history • Rainy Day 1: 72.2% humidity, 17.9°C → 🌧️ RAIN • Rainy Day 2: 77.7% humidity, 16.0°C → 🌧️ RAIN • Rainy Day 3: 81.0% humidity, 15.3°C → 🌧️ RAIN • Rainy Day 4: 62.4% humidity, 20.4°C → 🌧️ RAIN • Rainy Day 5: 62.1% humidity, 22.6°C → 🌧️ RAIN ...and 5 more days!

The Goal: Train the simplest possible "brain" (a perceptron) to learn this pattern. It's like teaching a computer to be a weather forecaster with just one decision rule!

What You'll See: The perceptron architecture shows how inputs (humidity and temperature) flow through weights to make a decision. The scatter plot shows our weather data - notice the pattern? Blue dots (rainy) tend to be in one region, yellow dots (sunny) in another. Can the perceptron learn to draw a line between them?

Perceptron Architecture

Perceptron Decision Process
Input Values
Bias (+1)
Positive Weight
Negative Weight

Weather Data: Can You See the Pattern?

Humidity (0-1 normalized)Temperature (0-1 normalized)0.000.000.250.250.500.500.750.751.001.00Weather Data Classification
Rain (Class 1)
Sunny (Class 0)
Decision Boundary
Target