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

bookDerivation of PCA Using Linear Algebra

Deslize para mostrar o menu

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

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 7

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 7
some-alt