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 lessonStep by step
Seeing the data
Maya wants to actually see how customers cluster, on a single slide for the board.
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).
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.
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.
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.
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?
- Drawing high-dimensional data as a 2D map (correct)
- Predicting prices
- Filling in missing values
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