Gradivex
  • Home
  • Academy
  • Arena
  • Visualizer
  • Models
Log in
AI Fundamentals/How Machines Learn/Lesson 3

Unsupervised learning

Module 2 · Lesson 3 of 5 · 7 min read
Theory

No labels, just structure

Both lessons so far had ground truth on every single example: the real apartment price, the human-applied spam tag. Every loss function you saw was comparing a guess to a known correct answer. Unsupervised learning removes that answer entirely, the dataset arrives with zero labels attached.

With no correct answer to check against, the algorithm has exactly one tool left: similarity. It measures how close examples are to each other and groups what looks alike, separates what doesn't. That single idea: grouping by similarity, is called clustering, and it's the most common unsupervised task there is.

You're about to do it yourself, the same way you ran the training loop by hand in lesson one, except this time nobody hands you the groups.

Interactive

Which cluster does this customer belong to?

Two reference customers below. For each new customer, judge which one they resemble more, based only on their numbers, nobody has told you what the 'right' groups are.

Alex2 visits/mo · €15/visit avg
Jordan11 visits/mo · €85/visit avg
Sam3 visits/mo · €18/visit avg
Taylor10 visits/mo · €90/visit avg
Morgan2 visits/mo · €12/visit avg
Casey12 visits/mo · €78/visit avg
Riley4 visits/mo · €22/visit avg
Drew9 visits/mo · €95/visit avg
0/6 matched
Theory

When the outlier IS the task

Remember the €40k bonus from last lesson? There, the outlier was a nuisance you had to be aware of when choosing between MAE and MSE. In unsupervised learning, finding exactly that kind of point can BE the entire task. It's called anomaly detection: flag whatever doesn't look like anything else, without ever being told in advance what "normal" or "abnormal" means.

Fraud detection, faulty sensor readings, network intrusions, none of these come with a labeled training set of "here are 10,000 examples of fraud." The system learns what normal looks like from the bulk of the data, then flags what breaks the pattern.

One more unsupervised task worth knowing: dimensionality reduction. A company might track 200 different financial metrics, many of which move together and say almost the same thing. Reducing those 200 columns down to a handful of combined indicators means far less data for a model to process, less compute, less cost. It isn't free: some information is lost in the compression. But when most of what mattered was concentrated in a few underlying patterns anyway, that trade is usually worth it.

Interactive

Clustering, anomaly detection, or dimensionality reduction?

Same three options every time, which unsupervised task is actually being described?

An online store groups its customers into segments based on purchase behavior, with no predefined categories.

A credit card company automatically flags a transaction that doesn't match a customer's usual spending pattern.

A dataset with 200 financial metrics per company gets compressed into a handful of variables that capture most of the meaningful variation.

A streaming service groups viewers with similar watching habits to power its recommendations.

A factory sensor system notices a machine's vibration readings look nothing like its usual baseline, days before it fails.

An image dataset with millions of pixels per photo gets reduced to a few hundred meaningful components before further processing.

0/6 chosen
Theory

Three tasks, one missing ingredient

Clustering, anomaly detection, and dimensionality reduction all share the same starting condition: no labels, ever. The algorithm works entirely off the structure already sitting inside the data.

That completes two of the three families from lesson one. Supervised learning had a known correct answer for every example. Unsupervised learning has none at all. The last family still needs a proper look: , where there's still no per-example correct answer, but there IS a signal, arriving after the fact, in the form of a reward.

Takeaway

What you learned

  • ✓Unsupervised learning works with zero labels, the algorithm's only tool is similarity between examples.
  • ✓Clustering groups similar examples together with no predefined categories, the way you just grouped customers by comparing them to two reference points.
  • ✓Anomaly detection flags whatever doesn't resemble the rest of the data, without ever being shown a labeled example of what 'abnormal' looks like.
  • ✓Dimensionality reduction compresses many correlated variables into far fewer, cutting compute cost at the price of some lost information, never a free trade, but often a worthwhile one.
Mentor-0

Stuck on something in this lesson? Ask.

0/1000

Every lesson is free to read. Log in to save your progress, complete lessons, and earn Compute and XP.

Log in free
Supervised learningReinforcement learning
Gradivex

Understand AI from the inside, read it, see it, prove it.

Platform

AcademyVisualizerRoadmapsModels

Community

DiscordLeaderboard

Company

PrivacyTerms

© 2026 Gradivex. All rights reserved.