Blogs · Machine Learning · Feature Engineering

Dimensionality Reduction: Life Savers

A practical guide to dimensionality reduction, including PCA, t-SNE, UMAP, autoencoders, feature selection, and how to choose the right method.

2020.03.04 · 3 min read · by Zhenlin Wang

Introduction

Dimensionality reduction turns many features into fewer features while trying to preserve the information that matters.

It is useful when:

The goal is not always maximum compression. The goal is preserving useful signal while removing unnecessary complexity.

Feature Selection vs Feature Extraction

There are two major families.

Feature selection keeps a subset of original features. This is easier to explain because the selected features still have original meaning.

Examples:

Feature extraction creates new features from the original ones. This can preserve more signal, but the new features are often harder to interpret.

Examples:

PCA

Principal Component Analysis (PCA) finds orthogonal directions that explain the largest variance in the data.

Use PCA when:

Watch out:

from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler


x_scaled = StandardScaler().fit_transform(x)
x_reduced = PCA(n_components=20).fit_transform(x_scaled)

t-SNE and UMAP

t-SNE and UMAP are often used for visualization. They preserve local neighborhood structure better than PCA, but they are not usually the first choice for production features.

Use them for:

Be careful:

Autoencoders

An autoencoder is a neural network trained to reconstruct its input through a compressed bottleneck. The bottleneck representation can be used as a learned low-dimensional feature.

Use autoencoders when:

They are more flexible than PCA but require more engineering and validation.

Choosing a Method

Use this practical decision path:

  1. If interpretability matters, start with feature selection.
  2. If you need a fast numeric baseline, start with PCA.
  3. If you need visualization, try PCA first, then UMAP or t-SNE.
  4. If the data is nonlinear and large enough, consider autoencoders.
  5. If the downstream model is tree-based, check whether dimensionality reduction is needed at all.

Always compare downstream performance with and without reduction. Dimensionality reduction can remove noise, but it can also remove signal.

Evaluation

Evaluate dimensionality reduction by:

For visualization, pair plots with quantitative checks. Do not make a product decision from a 2D embedding alone.

Closing

Dimensionality reduction is useful when complexity is hurting the system. It should simplify modeling, visualization, storage, or inference without hiding important signal.

Treat it as an engineering tradeoff, not as automatic preprocessing.