1. Home
  2. Steve Brunton

Jan 26, 2020

PCA is just SVD on mean-centered data

13 min → 1:29

Overview

Steve Brunton explains the step-by-step math behind Principal Component Analysis, how it connects to Singular Value Decomposition, and how it compresses complex data into its most informative patterns.

3 things to know

Brunton: Principal component analysis finds directions with maximum data spread

Steve Brunton explains that Principal Component Analysis shrinks complex datasets by turning them into a new system of right-angle directions that capture the largest possible data spread.

▶ Watch at 3:16

Brunton: Singular value decomposition finds the best basis for variance

Steve Brunton presents Principal Component Analysis as a practical statistical application of Singular Value Decomposition, which provides the tool to find the optimal hierarchical basis for representing data variance.

▶ Watch at 0:16

Brunton says subtracting column averages keeps focus on data spread

Steve Brunton explains that mean-centering calculates and subtracts the average value for each feature column from all data points so the analysis focuses on variance around the data's center rather than absolute position.

More

This ensures the analysis focuses on the variance around the data's center rather than its absolute position.

▶ Watch at 9:58

Also in this episode

Brunton says covariance matrix eigenvectors set the principal component directions

Steve Brunton describes the covariance matrix as a calculation from mean-centered data that maps relationships between features, with its eigenvectors defining the directions of the principal components.

More

A matrix calculated from the mean-centered data (`C = B^T * B`) that describes the relationships between different features.

Brunton says squared singular values measure variance each component captures

Steve Brunton notes that the eigenvalues of the covariance matrix, which correspond to the squared singular values, quantify the total variance each principal component captures to rank each component's importance.

More

This allows for a ranked assessment of each component's importance.

Brunton says loadings form the new axes for projecting data

Steve Brunton defines loadings as the eigenvectors of the covariance matrix, which form the new set of principal direction axes onto which the data is projected.

More

The eigenvectors of the covariance matrix.

Brunton says projecting centered data onto loadings gives new coordinates

Steve Brunton explains that principal component scores are the coordinates of the original data points in the new coordinate system, calculated by projecting mean-centered data onto the loadings.

More

The coordinates of the original data points in the new coordinate system defined by the loadings.

Brunton says PCA matrix rows typically represent one single experiment

Steve Brunton notes that in the context of Principal Component Analysis, each row of the data matrix typically represents a single observation or experiment, while the columns represent the different measured features.

Principal Components and Loadings

Quotes

“So the headline here is this very important statistical representation of your data can be achieved just by computing the SVD of your mean-subtracted data.”

▶ Watch at 9:58

“PCA is the bedrock dimensionality reduction technique for probability and statistics, and it's still very, very commonly used in data science and machine learning applications when you have big data that might have some statistical distribution, and you want to uncover the low-dimensional patterns to build models off of it.”

▶ Watch at 0:16

“The idea here is that we're going to try to find... the dominant kind of combinations of features that describe as much of the data as possible.”

▶ Watch at 3:16

Full summary

Episode Overview

  • Principal Component Analysis (PCA) is introduced as the foundational technique for dimensionality reduction, acting as a statistical interpretation of Singular Value Decomposition (SVD).
  • The lecture outlines the step-by-step mathematical procedure for performing PCA, which involves mean-centering the data, calculating the covariance matrix, and then finding its eigendecomposition.
  • The video demonstrates how the results of PCA (the principal components and loadings) are directly related to the matrices obtained from the SVD of the mean-centered data.
  • The core goal of PCA is to identify a new, data-driven coordinate system where the axes are ordered by the amount of variance they capture, allowing for the compression of high-dimensional data into its most informative, lower-dimensional patterns.

Key Concepts

  • Principal Component Analysis (PCA): A dimensionality reduction method that transforms a dataset into a new coordinate system of "principal components," which are orthogonal directions that capture the maximum possible variance in the data.
  • Statistical Interpretation of SVD: PCA is presented as a practical application of SVD for statistical analysis, where SVD provides the tool to find the optimal hierarchical basis for representing data variance.
  • Data Matrix Convention: In the context of PCA, each row of the data matrix typically represents a single observation or experiment, while the columns represent the different features measured.
  • Mean-Centering: A critical preprocessing step where the average value for each feature (column) is calculated and then subtracted from all data points. This ensures the analysis focuses on the variance around the data's center rather than its absolute position.
  • Covariance Matrix: A matrix calculated from the mean-centered data (C = B^T * B) that describes the relationships between different features. The eigenvectors of this matrix define the directions of the principal components.
  • Principal Components and Loadings:
    • Loadings (V): The eigenvectors of the covariance matrix. These form the new set of axes (principal directions) onto which the data is projected.
    • Principal Components / Scores (T): The coordinates of the original data points in the new coordinate system defined by the loadings. They are calculated by projecting the mean-centered data onto the loadings (T = B * V).
  • Variance Explained: The eigenvalues of the covariance matrix, which correspond to the squared singular values, quantify the amount of total variance captured by each principal component. This allows for a ranked assessment of each component's importance.

Quotes

  • At 00:16 - "PCA is the bedrock dimensionality reduction technique for probability and statistics, and it's still very, very commonly used in data science and machine learning applications when you have big data that might have some statistical distribution, and you want to uncover the low-dimensional patterns to build models off of it." - Explaining the fundamental importance and modern relevance of PCA.
  • At 03:16 - "The idea here is that we're going to try to find... the dominant kind of combinations of features that describe as much of the data as possible." - Describing the primary objective of using PCA to discover the most informative patterns in a dataset.
  • At 09:58 - "So the headline here is this very important statistical representation of your data can be achieved just by computing the SVD of your mean-subtracted data." - Summarizing the direct and efficient connection between applying the SVD and performing PCA.

Takeaways

  • Always mean-center your data before applying PCA. The first and most critical step is to subtract the mean from your dataset. This ensures that the principal components you discover represent directions of maximum variance (the spread of the data), rather than being skewed by the data's overall location in space.
  • Use SVD for an efficient PCA computation. Instead of manually forming the large covariance matrix and finding its eigenvalues, you can directly compute the SVD of the mean-centered data matrix (B). The right singular vectors (V) are your loadings, and the principal components (scores) can be found from the product of the left singular vectors and the singular values (U * Σ).
  • Use eigenvalues to guide dimensionality reduction. The eigenvalues (or squared singular values) quantify the variance captured by each principal component. To reduce dimensions, you can sum the largest eigenvalues until you account for a desired percentage of the total variance (e.g., 95%) and discard the components associated with smaller, less significant eigenvalues, effectively filtering out noise.

Watch the full episode 13 min

Read along with the audio summary

How do you uncover the low dimensional patterns hidden inside big data to build models off of it? This lecture episode came out on January 26, 2020, and features the instructor walking through the step by step mathematics of dimensionality reduction.

Compress complex datasets by capturing maximum variance. Principal Component Analysis, or PCA, transforms a dataset into a new coordinate system of perpendicular directions, called principal components, that capture the maximum possible spread in the data.

Use Singular Value Decomposition for statistical analysis. You can use SVD on your centered data to directly find the optimal hierarchy for representing variance, skipping the manual creation of a large covariance matrix.

Organize your data matrix the standard way. In PCA, each row typically represents a single observation or experiment, while the columns represent the different features measured.

Center your data around the average before doing anything else. You must calculate the average value for each column and subtract it from all data points, ensuring your analysis focuses purely on the spread around the center.

Map feature relationships through the covariance matrix. Multiplied from the centered data, this matrix describes how different features relate to one another, and its eigenvectors define the directions of your principal components.

This brings us to loadings and scores, which rebuild your coordinate system. Principal components, or scores, are the new coordinates of your original data points, found by projecting the centered data onto those loadings.

Rank your components by the variance they explain. To filter out noise, you can sum the largest values until you reach a desired threshold, such as ninety five percent of the total variance, and discard the rest.

"So the headline here is this very important statistical representation of your data can be achieved just by computing the SVD of your mean subtracted data."

More from Steve Brunton

Related Episodes