NelworksNelworks

ML & AI / Season 1 / EP01

The Flattened Soul (PCA & Manifolds)

Shez

I've done it, Kurumi! I've segmented the entire customer base!

Kurumi

(Without looking up) Did you? Or did you just run a library function you don't understand?

Shez

Look at this visualization! It's 50 dimensions of user data—clicks, purchases, mouse movement. Compressed into a beautiful 3D cube!

Shez

See this red cluster? Those are our "High Value Whales."

Kurumi

50 dimensions... compressed to 3. Let me guess. You used PCA?

Shez

"Principal Component Analysis." The classic! It explains 85% of the variance!

Kurumi

You think "Variance" means "Information." That is your first sin.

Kurumi

Shez, what does a user look like to a computer?

Shez

A row in a database?

Kurumi

A point in high-dimensional space. '[Age, Income, Clicks, Region...]'.

Kurumi

When you have 50 columns, that point exists in a 50-dimensional hypercube.

Shez

Right! And that's too hard to see. So I used PCA to rotate it and take a picture of the best angle!

Kurumi

You "took a picture" of a **Shadow** you created.

Kurumi

PCA is a linear projection. It shines a light through the data and captures the shadow on the wall.

Kurumi

If the data is simple, the shadow tells the truth. A straight stick casts a straight shadow.

Kurumi

But if the data is complex... if it curves and loops... the shadow destroys the depth.

Kurumi

Your "Whale Cluster" in red...

Shez

Yeah?

Kurumi

That cluster contains high-spending VIPs... and probably bots that click everything at random.

Shez

What?! No! They are right next to each other in the plot!

Kurumi

They are next to each other in the *shadow*. But in 50D space? They might be lightyears apart.

Kurumi

PCA works by calculating the Eigenvectors of the Covariance Matrix.

Shez

(Eyes swirling) Eigen... what?

Kurumi

Think of it as a press. It tries to find the direction where the data is widest (most variance) and preserves that axis. Then it finds the next widest, orthogonal to the first.

Kurumi

If your data is linear, like physics measurements or simple correlations, it works. The beams stack nicely.

Shez

But my data is people! People aren't steel beams!

Kurumi

Exactly. Marketing data is a **Manifold**. It's curved. It's a Swiss Roll.

Kurumi

When PCA flattens a Swiss Roll, it smashes the top layer onto the bottom layer.

Kurumi

Point A (The beginning of the roll) and Point B (The end of the roll) are far apart if you walk along the dough.

Shez

Yeah, you have to unroll it to get there.

Kurumi

But PCA doesn't unroll. It squashes. Suddenly, Point A and Point B are neighbors.

Kurumi

You just grouped "First time budget shoppers" with "Luxury frequent buyers" because the manifold curved back on itself.

Shez

So my "Red Cluster"...

Kurumi

Is a garbage dump of non-linear interactions smashed together by a mathematical trash compactor.

Shez

But... but the variance! It said 85% variance explained!

Kurumi

(Sighs) Time for lesson two. **Variance is not Significance.**

Kurumi

Imagine you have a feature with massive variance, like "Timestamp of visit." It varies wildly.

Shez

Okay.

Kurumi

And a feature with low variance, like "Is this a Fraud Attempt?" (0 or 1).

Kurumi

PCA chases the variance. If you did not **StandardScale** the data, it will spend all its energy modeling the Timestamp and ignore the Fraud signal because the variance is small.

Shez

I'm not stupid. Of course I standard scaled it!

Kurumi

And it still doesn't work.

Kurumi

Marketing data is often "Sparse." You have One-Hot encoded categories. 'State_NY', 'State_CA', 'State_TX'.

Shez

Yeah, hundreds of columns of 0s and 1s.

Kurumi

Euclidean distance (which PCA relies on) breaks down in high-dimensional sparse space. It's called the **Curse of Dimensionality**.

Kurumi

Standard scaling works if you have multiple continuous variable with high variance. But it still does the problem in binary data in high dimensions.

Shez

So what do I do? How do I unroll the cake?

Kurumi

We need Non-Linear Dimensionality Reduction.

Kurumi

We need to learn the **Topology**, not just the variance.

Kurumi

We use techniques like **t-SNE** or **UMAP**.

Kurumi

UMAP (Uniform Manifold Approximation and Projection). It doesn't look for straight lines.

Shez

What does it do?

Kurumi

It looks at every point and asks: "Who are your 5 closest friends?" It builds a graph of neighborhoods.

Kurumi

Then, it tries to arrange the points in 2D so that those friendships are preserved. It cares about **Local Structure**, not global axes.

Shez

So it unrolls the Swiss Roll?

Kurumi

Yes. It preserves the distance along the curve. The chocolate stays with the chocolate. The vanilla stays with the vanilla.

Shez

Okay... processing...

Shez

My Red Cluster... it exploded!

Kurumi

It didn't explode. It was never whole.

Kurumi

Island 1: The actual Whales.

Kurumi

Island 2: Window shoppers who view a lot but buy nothing.

Kurumi

Island 3: Bots crawling the site.

Shez

Oh my god. They all have the same IP subnet. They aren't customers at all.

Kurumi

And PCA mashed them together with your VIPs because they both had "High Activity Variance."

Shez

I almost sent a 20% discount coupon to a bot farm.

Kurumi

You would have bankrupted the marketing budget.

Kurumi

PCA is fine for linear problems. Genomics. Signal processing. Physical sensors.

Kurumi

But for human behavior? Humans aren't linear. We are messy, curved manifolds.

Shez

This looks less like a cube and more like... a splattered jellyfish.

Kurumi

That is the shape of reality.