Dimensionality reduction: PCA, t-SNE, UMAP and LDA

Real data often has dozens or thousands of columns (called dimensions or features). Dimensionality reduction squeezes them into a few new columns that keep the most important information. That makes data easier to see on a chart, faster to train on and less noisy.

Everyday analogy

A shadow. A 3D object casts a 2D shadow on the wall. If you choose the angle well, you can still tell a hand from a bird. PCA picks the angle that keeps the most detail.

Example

A shop has 50 facts about each customer: visits, spend, categories, times of day and more. PCA boils them down to 2 new columns, roughly how much they spend and how often they visit. Plotted on a chart, clear customer groups appear that were invisible in the 50-column spreadsheet.

🧊50 columns• visits, spend, categories…• too many to picture• noisy and slow🗺️2 new columns• "spends a lot"• "visits often"• groups now visible→
Dimensionality reduction keeps the most important information in far fewer columns.
MethodHow it works (simply)Labels needed?Best for
PCA (Principal Component Analysis)Finds the directions where the data varies most and keeps only the top fewNoCompressing data before training, removing noise, quick overviews
t-SNEPlaces similar items close together on a 2D map, focusing on near neighboursNoVisualising clusters, e.g. word or image embeddings
UMAPLike t-SNE but faster, and keeps more of the big-picture layoutNoVisualising large datasets
LDA (Linear Discriminant Analysis)Finds the directions that best separate known groupsYesSimple classification and separating classes

Strengths

  • Turns huge tables into pictures you can understand
  • Faster training with fewer columns
  • Can remove noise and repeated information

Watch out for

  • The new columns are mixes of the old ones, so they're harder to explain
  • On t-SNE maps, the distance between clusters and their sizes don't mean much
  • Some information is always lost

Don't mix up the two LDAs: in machine learning, LDA usually means Linear Discriminant Analysis (this lesson). In NLP, LDA can also mean Latent Dirichlet Allocation, a method that finds topics in documents.

Try it yourself

About 10 min

Reduce 10 facts to 2

  1. Write 10 facts about 6 friends (age, height, sports per week, books per year, coffee per day and so on).
  2. Combine them into just 2 scores, e.g. active and bookish.
  3. Plot your friends on a 2D chart using the two scores.

What you should see: Two well-chosen combined scores show the groups clearly, which is the idea behind PCA.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectYour first machine learning model: predict house pricesAbout 75 min · Copy-paste code · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.