Gradient LabStart the lesson

Lessons › Chapter 4: Classification

Decision boundaries

Each student is now a dot on a map: how long they studied (one direction) and how long they slept (the other). Teal passed, coral failed. Can you see where one group ends and the other begins?

Watch it move. This lesson is interactive on Gradient Lab: every step is an animated scene you can replay.

Start the interactive lesson

Step by step

Story

Where is the line?

Leo plots customers by income and debt. Somewhere on that map there’s a border between repaid and defaulted loans.

Concept

Two clues at once

Each student is now a dot on a map: how long they studied (one direction) and how long they slept (the other). Teal passed, coral failed. Can you see where one group ends and the other begins?

Key idea

Draw a dividing line

A classifier draws a line that separates the groups as well as it can. This line is called the decision boundary.

Build

Each side gets an answer

Everything on one side of the line is “pass”, everything on the other is “fail”. Shade the map and you can see the model’s answer for every possible student at once.

Build

A new student arrives

A new student studied 5 hours and slept 3. Find their spot on the map. It lands on the teal side, so the model guesses “pass”.

Insight

Curvy boundaries

Sometimes no straight line works, like when one group sits in the middle of the other. More flexible models can draw curved boundaries, such as this circle.

Real life

In real life: a fruit-sorting machine

Packing plants photograph each fruit on the belt and measure things like size and color. That puts every fruit on a map, and a learned boundary decides which bin it drops into, many fruits per second.

Quick check: What is a decision boundary?

Points on one side get one answer, points on the other side get the other.

Pseudocode

# each student has two clues: hours studied, hours slept
point = [studied, slept]

# a straight boundary: one line splits the map
if studied + 0.9 × slept > 7.3:
    guess "pass"
else:
    guess "fail"

# curvier models can draw curvy boundaries

Key terms

decision boundary
The line (or curve) where the model switches from one answer to the other.