SlideShare a Scribd company logo
ML study
7번째
12.1 Factor analysis
• 이 전 장에서는 latent variable z = {1,2,..,K}  표현력의 한계
An alternative is to use a vector of real-valued latent variables,zi ∈R

• where W is a D×L matrix, known as the factor loading matrix, and Ψ is a D×D covariance matrix.
• We take Ψ to be diagonal, since the whole point of the model is to “force” zi to explain the correlation, rather than
“baking it in” to the observation’s covariance.
• The special case in which Ψ=σ2I is called probabilistic principal components analysis or PPCA.
• The reason for this name will become apparent later.
12.1.1 FA is a low rank parameterization of an MVN
• FA can be thought of as a way of specifying a joint density model on x using a small number of parameters.
12.1 Factor analysis
• The generative process, where L=1, D=2 and Ψ is diagonal, is illustrated in Figure 12.1.
• We take an isotropic Gaussian “spray can” and slide it along the 1d line defined by wzi +μ.

• This induces an ellongated (and hence correlated) Gaussian in 2d.
12.1.2 Inference of the latent factors
•

latent factors z will reveal something interesting about the data.

xi(D차원)를 넣어서 L차원으로 매핑시킬 수 잇음
training set을 D차원에서 L차원으로 차원 축소
12.1.2 Inference of the latent factors
• Example
• D =11차원(엔진크기, 실린더 수, 가격,...), N =328 개의 example(자동차 종류), L = 2

• 각 피쳐(엔진크기, 실린더 수,.. 11개)의 유닛 벡터 e1=(1,0,...,0), e2=(0,1,0,...,0)를 저차원 공간에 사영한 것이 파
란색 선 (biplot이라고 함)
• biplot 가까이 있는 빨간색점(차량)이 그 특성을 잘 가지고 있는 차

training set을 D차원에서 L차원으로 차원 축소 (빨간색 점)
12.1.3 Unidentifiability
• Just like with mixture models, FA is also unidentifiable
• LDA 처럼 매번 분석시마다, z(토픽)의 순서가 바뀜
• 분석 능력에는 영향을 주진 않지만, 해석 능력에 영향을 줌
• 해결 방법
• Forcing W to be orthonormal Perhaps the cleanest solution to the identifiability problem is to force W to be
orthonormal, and to order the columns by decreasing variance of the corresponding latent factors. This is the
approach adopted by PCA, which we will discuss in Section 12.2.
• orthonormal 하다는 것은 벡터들이 서로 직교한다
• 직교성을 유지하려면,
머피's 머신러닝: Latent Linear Model
12.1.4 Mixtures of factor analysers
•

let [the k’th linear subspace of dimensionality Lk]] be represented by Wk, for k=1:K.

• Suppose we have a latent indicator qi ∈{1,...,K} specifying which subspace we should use to generate the data.

• We then sample zi from a Gaussian prior and pass it through the Wk matrix (where k=qi), and add noise.

각 데이터 Xi가 k개의 FA에서 나왔다는 모델
(GMM과 비슷)
12.1.5 EM for factor analysis models
Expected log likelihood

ESS(Expected Sufficient Statistics)
12.1.5 EM for factor analysis models
• E- step

• M-step
12.2 Principal components analysis (PCA)
• Consider the FA model where we constrain Ψ=σ2I, and W to be orthonormal.
• It can be shown (Tipping and Bishop 1999) that, as σ2 →0, this model reduces to classical (nonprobabilistic)principal
components analysis( PCA),
• The version where σ2 > 0 is known as probabilistic PCA(PPCA)
머피's 머신러닝: Latent Linear Model
proof sketch
• reconstruction error를 줄이는 W를 구하는 것 = z로 사영되는 데이터의 분산이 최대가 되는 W를 구하는 것
• z로 사영되는 데이터의 분산이 최대가 되는 W를 lagrange multiplier 최적화로 구해본다

• z로 사영되는 데이터의 분산이 최대가 되는 W를 구해봤더니 데이터의 empirical covariance matrix의 [첫번
째, 두번째, 세번쨰.. eigenvector]
proof of PCA
• wj ∈RD to denote the j’th principal direction
• xi ∈RD to denote the i’th high-dimensional observation,

• zi ∈RL to denote the i’th low-dimensional representation

• Let us start by estimating the best 1d solution,w1 ∈RD, and the corresponding projected points˜z1∈RN.

• So the optimal reconstruction weights are obtained by orthogonally projecting the data onto the first principal
direction
proof of PCA
x가 z = wx로 사영된 데이터 포인트의
분산

목적함수가 reconstruction error를 최소화하는 것에서 사영된 점들의 분산을 최대화하는 것으로 바뀌었다

direction that maximizes the variance is an
eigenvector of the covariance matrix.
proof of PCA

Optimizing wrt w1 and z1 gives the same solution as before.

The proof continues in this way. (Formally one can use induction.)
12.2.3 Singular value decomposition (SVD)
• PCA는 SVD와 밀접한 관계가 있다
• SVD를 돌리면, PCA의 해 W를 구할 수 있다
• PCA는 결국 truncated SVD approximation와 같다

thin SVD
SVD: example
sigular value 한개,두개,세개 쓴 근사치
SVD: example
12.2.3 Singular value decomposition (SVD)

PCA의 해 W는 XTX의 eigenvectors와 같으므로, W=V
svd를 돌리면  pca의 해가 나온다
PCA는 결국 truncated SVD approximation와 같다
12.2.4 Probabilistic PCA
• x의 평균은 0, Ψ=σ2I 이고 W가 orthogonal한 FA를 생각하자.

MLE로 구하면,
12.2.5 EM algorithm for PCA
• PCA에서 Estep은 latent 변수 Z를 추론해 내는 것이고 FA EM에서 etep에서의 posterior의 평균을 쓴다

X가 W가 span하는 공간에 사영된 것

확률모델이 아니라 공분산 없다고 침
행렬 표현
12.2.5 EM algorithm for PCA
•

linear regression 업데이트 수식과 매우 닯았죠

• linear regression이 데이터 점이 span하는 열공간에 y를 사영시키는 기하학적 의미 = 예측치와 y의 에러 최소화
(7.3.2)
• // E-step은 W의 열벡터가 span하는 열공간에 X를 사영시키는 것

Wt-1
12.2.5 EM algorithm for PCA
• M-step

multi-output linear regression (Equation 7.89)

• linear regression에서 답 y가 벡터인 경우의 linear regression

• 사영된 zi를 피쳐벡터, xi를 답으로 하는 multi-output linear regression이다
• 파란색 막대에 사영된 zi를 파란색 막대(W)를 돌려서 답 x(초록색 점)과의 에러가 최소화 되는 막대 방향을 찾
는다.
12.2.5 EM algorithm for PCA
• EM의 장점
• EM can be faster
• EM can be implemented in an online fashion, i.e., we can update our estimate of W
as the data streams in.
12.3.1 Model selection for FA/PPCA
12.3.2 Model selection for PCA
Conclusion
• FA는 정규분포의 x 을(D*D paramters), 더 작은 parameter 갯수(D*L)로 표현한다.
• PCA는 FA의 special 케이스이다

• PCA문제

의 해 W는 Z로 사영되는 데이터의 분산이 최대가 되게 하고 가장 큰

eigenvalue에 대응하는 eigenvectors이다
• SVD (X = USV’)에서 V는 X의 공분산 행렬의 eigenvectors이다. 그러므로 W=V

More Related Content

PPTX
머피's 머신러닝: Latent Linear Model
PDF
7. Linear Regression
PPTX
머피의 머신러닝 : Gaussian Processes
PPTX
Murpy's Machine Learing: 10. Directed Graphical Model
PPTX
머피's 머신러닝, Mixture model and EM algorithm
PDF
Support Vector Machine Tutorial 한국어
PDF
8. Logistic Regression
PDF
머피의 머신러닝: Undirencted Graphical Model
머피's 머신러닝: Latent Linear Model
7. Linear Regression
머피의 머신러닝 : Gaussian Processes
Murpy's Machine Learing: 10. Directed Graphical Model
머피's 머신러닝, Mixture model and EM algorithm
Support Vector Machine Tutorial 한국어
8. Logistic Regression
머피의 머신러닝: Undirencted Graphical Model

What's hot (20)

PDF
3 Generative models for discrete data
PPTX
알기쉬운 Variational autoencoder
PDF
Gmm to vgmm
PDF
Eigenvalues of regular graphs
PDF
Flow based generative models
PPTX
Visualizing data using t-SNE
PPTX
Murpy's Machine Learning 9. Generalize Linear Model
PPTX
Normalization 방법
PPTX
제어-물리적시스템의 수학적모델링
PPTX
Focal loss의 응용(Detection & Classification)
PDF
Computational Complexity
PDF
Mathematics
PPTX
A neural image caption generator
PDF
Chapter 19 Variational Inference
PPTX
Knowing when to look : Adaptive Attention via A Visual Sentinel for Image Cap...
PPTX
XAI recent researches
PPTX
Data Visualization and t-SNE
PDF
Lecture 4: Neural Networks I
PDF
Chapter 6 Deep feedforward networks - 1
PDF
Lecture 3: Unsupervised Learning
3 Generative models for discrete data
알기쉬운 Variational autoencoder
Gmm to vgmm
Eigenvalues of regular graphs
Flow based generative models
Visualizing data using t-SNE
Murpy's Machine Learning 9. Generalize Linear Model
Normalization 방법
제어-물리적시스템의 수학적모델링
Focal loss의 응용(Detection & Classification)
Computational Complexity
Mathematics
A neural image caption generator
Chapter 19 Variational Inference
Knowing when to look : Adaptive Attention via A Visual Sentinel for Image Cap...
XAI recent researches
Data Visualization and t-SNE
Lecture 4: Neural Networks I
Chapter 6 Deep feedforward networks - 1
Lecture 3: Unsupervised Learning
Ad

Viewers also liked (14)

PDF
Jensen's inequality, EM 알고리즘
PDF
ThinkBayes: chapter 13  simulation
PPTX
Murpy's Machine Learning:14. Kernel
PDF
ThinkBayes: Chapter 9 two_dimensions
PPTX
파이널 판타지 3 루트 공략
PPTX
TETRIS AI WITH REINFORCEMENT LEARNING
PPTX
머피의 머신러닝 13 Sparse Linear Model
PDF
4. Gaussian Model
PDF
앙상블 학습 기반의 추천시스템 개발
PPTX
머피의 머신러닝: 17장 Markov Chain and HMM
PDF
Probabilistic PCA, EM, and more
PPTX
From A Neural Probalistic Language Model to Word2vec
PDF
Machine Learning : Latent variable models for discrete data (Topic model ...)
PDF
1. boolean 검색
Jensen's inequality, EM 알고리즘
ThinkBayes: chapter 13  simulation
Murpy's Machine Learning:14. Kernel
ThinkBayes: Chapter 9 two_dimensions
파이널 판타지 3 루트 공략
TETRIS AI WITH REINFORCEMENT LEARNING
머피의 머신러닝 13 Sparse Linear Model
4. Gaussian Model
앙상블 학습 기반의 추천시스템 개발
머피의 머신러닝: 17장 Markov Chain and HMM
Probabilistic PCA, EM, and more
From A Neural Probalistic Language Model to Word2vec
Machine Learning : Latent variable models for discrete data (Topic model ...)
1. boolean 검색
Ad

Similar to 머피's 머신러닝: Latent Linear Model (20)

PPTX
07. PCA
PDF
3.unsupervised learing(epoch#2)
PDF
R_datamining
PDF
차원축소 훑어보기 (PCA, SVD, NMF)
PDF
3.unsupervised learing
PDF
RUCK 2017 빅데이터 분석에서 모형의 역할
PPTX
Eigendecomposition and pca
PDF
[PyCon KR 2018] 땀내를 줄이는 Data와 Feature 다루기
PDF
Chap06 dimensionality reduction
PPTX
Variational inference intro. (korean ver.)
PDF
PCA (Principal Component Analysis)
PDF
11_통계 자료분석 입문
PDF
S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"
PDF
03. linear regression
PDF
Rdatamining
PDF
내가 이해하는 SVM(왜, 어떻게를 중심으로)
PPTX
Chapter 13 Linear Factor Models
PDF
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
PDF
Big data 시대의 통계학
PDF
(Handson ml)ch.8-dimensionality reduction
07. PCA
3.unsupervised learing(epoch#2)
R_datamining
차원축소 훑어보기 (PCA, SVD, NMF)
3.unsupervised learing
RUCK 2017 빅데이터 분석에서 모형의 역할
Eigendecomposition and pca
[PyCon KR 2018] 땀내를 줄이는 Data와 Feature 다루기
Chap06 dimensionality reduction
Variational inference intro. (korean ver.)
PCA (Principal Component Analysis)
11_통계 자료분석 입문
S.M.Lee, Invited Talk on "Machine Learning-based Anomaly Detection"
03. linear regression
Rdatamining
내가 이해하는 SVM(왜, 어떻게를 중심으로)
Chapter 13 Linear Factor Models
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
Big data 시대의 통계학
(Handson ml)ch.8-dimensionality reduction

머피's 머신러닝: Latent Linear Model

  • 2. 12.1 Factor analysis • 이 전 장에서는 latent variable z = {1,2,..,K}  표현력의 한계 An alternative is to use a vector of real-valued latent variables,zi ∈R • where W is a D×L matrix, known as the factor loading matrix, and Ψ is a D×D covariance matrix. • We take Ψ to be diagonal, since the whole point of the model is to “force” zi to explain the correlation, rather than “baking it in” to the observation’s covariance. • The special case in which Ψ=σ2I is called probabilistic principal components analysis or PPCA. • The reason for this name will become apparent later.
  • 3. 12.1.1 FA is a low rank parameterization of an MVN • FA can be thought of as a way of specifying a joint density model on x using a small number of parameters.
  • 4. 12.1 Factor analysis • The generative process, where L=1, D=2 and Ψ is diagonal, is illustrated in Figure 12.1. • We take an isotropic Gaussian “spray can” and slide it along the 1d line defined by wzi +μ. • This induces an ellongated (and hence correlated) Gaussian in 2d.
  • 5. 12.1.2 Inference of the latent factors • latent factors z will reveal something interesting about the data. xi(D차원)를 넣어서 L차원으로 매핑시킬 수 잇음 training set을 D차원에서 L차원으로 차원 축소
  • 6. 12.1.2 Inference of the latent factors • Example • D =11차원(엔진크기, 실린더 수, 가격,...), N =328 개의 example(자동차 종류), L = 2 • 각 피쳐(엔진크기, 실린더 수,.. 11개)의 유닛 벡터 e1=(1,0,...,0), e2=(0,1,0,...,0)를 저차원 공간에 사영한 것이 파 란색 선 (biplot이라고 함) • biplot 가까이 있는 빨간색점(차량)이 그 특성을 잘 가지고 있는 차 training set을 D차원에서 L차원으로 차원 축소 (빨간색 점)
  • 7. 12.1.3 Unidentifiability • Just like with mixture models, FA is also unidentifiable • LDA 처럼 매번 분석시마다, z(토픽)의 순서가 바뀜 • 분석 능력에는 영향을 주진 않지만, 해석 능력에 영향을 줌 • 해결 방법 • Forcing W to be orthonormal Perhaps the cleanest solution to the identifiability problem is to force W to be orthonormal, and to order the columns by decreasing variance of the corresponding latent factors. This is the approach adopted by PCA, which we will discuss in Section 12.2. • orthonormal 하다는 것은 벡터들이 서로 직교한다 • 직교성을 유지하려면,
  • 9. 12.1.4 Mixtures of factor analysers • let [the k’th linear subspace of dimensionality Lk]] be represented by Wk, for k=1:K. • Suppose we have a latent indicator qi ∈{1,...,K} specifying which subspace we should use to generate the data. • We then sample zi from a Gaussian prior and pass it through the Wk matrix (where k=qi), and add noise. 각 데이터 Xi가 k개의 FA에서 나왔다는 모델 (GMM과 비슷)
  • 10. 12.1.5 EM for factor analysis models Expected log likelihood ESS(Expected Sufficient Statistics)
  • 11. 12.1.5 EM for factor analysis models • E- step • M-step
  • 12. 12.2 Principal components analysis (PCA) • Consider the FA model where we constrain Ψ=σ2I, and W to be orthonormal. • It can be shown (Tipping and Bishop 1999) that, as σ2 →0, this model reduces to classical (nonprobabilistic)principal components analysis( PCA), • The version where σ2 > 0 is known as probabilistic PCA(PPCA)
  • 14. proof sketch • reconstruction error를 줄이는 W를 구하는 것 = z로 사영되는 데이터의 분산이 최대가 되는 W를 구하는 것 • z로 사영되는 데이터의 분산이 최대가 되는 W를 lagrange multiplier 최적화로 구해본다 • z로 사영되는 데이터의 분산이 최대가 되는 W를 구해봤더니 데이터의 empirical covariance matrix의 [첫번 째, 두번째, 세번쨰.. eigenvector]
  • 15. proof of PCA • wj ∈RD to denote the j’th principal direction • xi ∈RD to denote the i’th high-dimensional observation, • zi ∈RL to denote the i’th low-dimensional representation • Let us start by estimating the best 1d solution,w1 ∈RD, and the corresponding projected points˜z1∈RN. • So the optimal reconstruction weights are obtained by orthogonally projecting the data onto the first principal direction
  • 16. proof of PCA x가 z = wx로 사영된 데이터 포인트의 분산 목적함수가 reconstruction error를 최소화하는 것에서 사영된 점들의 분산을 최대화하는 것으로 바뀌었다 direction that maximizes the variance is an eigenvector of the covariance matrix.
  • 17. proof of PCA Optimizing wrt w1 and z1 gives the same solution as before. The proof continues in this way. (Formally one can use induction.)
  • 18. 12.2.3 Singular value decomposition (SVD) • PCA는 SVD와 밀접한 관계가 있다 • SVD를 돌리면, PCA의 해 W를 구할 수 있다 • PCA는 결국 truncated SVD approximation와 같다 thin SVD
  • 19. SVD: example sigular value 한개,두개,세개 쓴 근사치
  • 21. 12.2.3 Singular value decomposition (SVD) PCA의 해 W는 XTX의 eigenvectors와 같으므로, W=V svd를 돌리면  pca의 해가 나온다
  • 22. PCA는 결국 truncated SVD approximation와 같다
  • 23. 12.2.4 Probabilistic PCA • x의 평균은 0, Ψ=σ2I 이고 W가 orthogonal한 FA를 생각하자. MLE로 구하면,
  • 24. 12.2.5 EM algorithm for PCA • PCA에서 Estep은 latent 변수 Z를 추론해 내는 것이고 FA EM에서 etep에서의 posterior의 평균을 쓴다 X가 W가 span하는 공간에 사영된 것 확률모델이 아니라 공분산 없다고 침 행렬 표현
  • 25. 12.2.5 EM algorithm for PCA • linear regression 업데이트 수식과 매우 닯았죠 • linear regression이 데이터 점이 span하는 열공간에 y를 사영시키는 기하학적 의미 = 예측치와 y의 에러 최소화 (7.3.2) • // E-step은 W의 열벡터가 span하는 열공간에 X를 사영시키는 것 Wt-1
  • 26. 12.2.5 EM algorithm for PCA • M-step multi-output linear regression (Equation 7.89) • linear regression에서 답 y가 벡터인 경우의 linear regression • 사영된 zi를 피쳐벡터, xi를 답으로 하는 multi-output linear regression이다 • 파란색 막대에 사영된 zi를 파란색 막대(W)를 돌려서 답 x(초록색 점)과의 에러가 최소화 되는 막대 방향을 찾 는다.
  • 27. 12.2.5 EM algorithm for PCA • EM의 장점 • EM can be faster • EM can be implemented in an online fashion, i.e., we can update our estimate of W as the data streams in.
  • 28. 12.3.1 Model selection for FA/PPCA 12.3.2 Model selection for PCA
  • 29. Conclusion • FA는 정규분포의 x 을(D*D paramters), 더 작은 parameter 갯수(D*L)로 표현한다. • PCA는 FA의 special 케이스이다 • PCA문제 의 해 W는 Z로 사영되는 데이터의 분산이 최대가 되게 하고 가장 큰 eigenvalue에 대응하는 eigenvectors이다 • SVD (X = USV’)에서 V는 X의 공분산 행렬의 eigenvectors이다. 그러므로 W=V