Gradient LabStart the lesson

Lessons › Chapter 7: Unsupervised learning

t-SNE and UMAP

Place the points on a flat map and nudge them over and over: neighbors pull together, strangers push apart. The hidden groups appear as islands.

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

Seeing the data

Maya wants to actually see how customers cluster, on a single slide for the board.

Problem

Data you can’t look at

Imagine each point has hundreds of features. Drawn in any 3 of them, it looks like a jumble, even though there are real groups hiding inside (shown here in color for us).

Build

Remember who is close to whom

First, for each point, note its nearest neighbors in the original, full-detail data. That neighbor list is what the map must preserve.

Key idea

Arrange a flat map

Place the points on a flat map and nudge them over and over: neighbors pull together, strangers push apart. The hidden groups appear as islands.

Insight

Read the map with care

t-SNE and UMAP are for looking: they show which items are neighbors. But the size of an island and the distance between islands can mislead, so don’t read too much into them.

Real life

In real life: a map of music

Music and video services describe each song or film with hundreds of numbers. A t-SNE or UMAP map lays them out so similar ones sit together, which helps teams see genres, spot mislabeled items and design playlists.

Quick check: What are t-SNE and UMAP mainly used for?

They squeeze many features into a 2D picture that keeps neighbors together.

Pseudocode

data = thousands of points with hundreds of features
for each point: note which points are its close neighbors
place every point on a flat map, randomly at first
repeat:
    pull neighbors together, push strangers apart
show the map: similar things end up side by side