Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Derivation of PCA Using Linear Algebra | Mathematical Foundations of PCA
Principal Component Analysis in Python

bookDerivation of PCA Using Linear Algebra

メニューを表示するにはスワイプしてください

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

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  3

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 2.  3
some-alt