Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Derivation of PCA Using Linear Algebra | Section
Principal Component Analysis Fundamentals

bookDerivation of PCA Using Linear Algebra

Sveip for å vise menyen

PCA seeks a new set of axes, called principal components, such that the projected data has maximum variance. The first principal component, denoted as w1w_{\raisebox{-0.5pt}{$1$}}, is chosen to maximize the variance of the projected data:

Var(Xw1)\mathrm{Var}(X w_1)

Subject to the constraint that w1=1\|w_{\raisebox{-0.5pt}{$1$}}\| = 1. The solution to this maximization problem is the eigenvector of the covariance matrix corresponding to the largest eigenvalue.

The optimization problem is:

maxw wTΣwsubject tow=1\max_{w} \ w^T \Sigma w \quad \text{subject to} \quad \|w\| = 1

The solution is any vector ww that satisfies Σw=λw\Sigma w = \lambda w, where λ\lambda is the corresponding eigenvalue. In other words, ww is an eigenvector of the covariance matrix Σ\Sigma associated with eigenvalue λ\lambda.

12345678910111213
import numpy as np # Assume cov_matrix from earlier X = np.array([[2.5, 2.4], [0.5, 0.7], [2.2, 2.9]]) X_centered = X - np.mean(X, axis=0) cov_matrix = (X_centered.T @ X_centered) / X_centered.shape[0] # Find the principal component (eigenvector with largest eigenvalue) values, vectors = np.linalg.eig(cov_matrix) principal_component = vectors[:, np.argmax(values)] print("First principal component:", principal_component)
copy

This principal component is the direction along which the data has the highest variance. Projecting data onto this direction gives the most informative one-dimensional representation of the original dataset.

question mark

Which statement best describes the role of the covariance matrix in the derivation of PCA using linear algebra

Velg det helt riktige svaret

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 1. Kapittel 7

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 1. Kapittel 7
some-alt