2017.11.08 ์กฐ์ค์ฐ metamath@gmail.com
์์ : Pattern Recognition and Machine Learning
์ง์์ด : ํฌ๋ฆฌ์คํ ํผ ๋น์ Christopher Bishop
Springer
import matplotlib.pyplot as plt
import matplotlib as mpl
style_name = 'bmh' #bmh
style = plt.style.library[style_name]
style_colors = [ c['color'] for c in style['axes.prop_cycle'] ]
Consider two variables $x$ and $y$ with joint distribution $p(x,y)$. Prove the following two results
$$ \begin{align} &\mathbb{E}[x] = \mathbb{E}_{y}\left[\mathbb{E}_{x}[x \mid y] \right] \\[5pt] &Var[x] = \mathbb{E}_{y}\left[Var_{x}[x \mid y]\right] + Var_{y}[\mathbb{E}_{x}[x \mid y]] \end{align} $$Here $\mathbb{E}_{x}[x \mid y]$ denotes the expectation of x under the conditional distribution $p(x \mid y)$, with a similar notation for the conditional variance.
1๋ฒ : $\mathbb{E}[x \mid y] = \int_{x} p(x \mid y) \, x \, dx $ ์ด๋ฏ๋ก
$$ \begin{align} \mathbb{E}_{y}[\mathbb{E}_{x}[x \mid y]] &= \int_{y} p(y) \left\{ \int_{x} p(x \mid y) \, x \, dx \right\} dy \\[5pt] &= \int_{x} \int_{y} p(y) p(x \mid y) dy \, x \, dx \\[5pt] &= \int_{x} p(x) \, x \, dx = \mathbb{E}[x] \end{align} $$์ด ์์ Law of total expectation์ด๋ผ ํ๋ค.
2๋ฒ : ์์ ์ฐ๋ณ์ ์ฒซ์งธํญ ๋์งธํญ์ ํ์ด ์ ์ผ๋ฉด
$$ \begin{align} \mathbb{E}_{y}[Var_{x}[x \mid y]] &= \mathbb{E}_{y}[ \mathbb{E}_{x}[x^2 \mid y] - \left(\mathbb{E}_{x}[x \mid y]\right)^2 ] \\[5pt] &= \mathbb{E}_{y}[ \mathbb{E}_{x}[x^2 \mid y]] - \mathbb{E}_{y}[ \left(\mathbb{E}_{x}[x \mid y]\right)^2 ] \\[5pt] &= \mathbb{E}_{x}[x^2] - \mathbb{E}_{y}[\left(\mathbb{E}_{x}[x \mid y]\right)^2 ] \qquad \because \mathbb{E}[x] = \mathbb{E}_{y}[\mathbb{E}_{x}[x \mid y]] \end{align} $$$$ \begin{align} Var_{y}[\mathbb{E}_{x}[x \mid y]] = \mathbb{E}_{y}[\left(\mathbb{E}_{x}[x \mid y]\right)^2 ] - \left( \mathbb{E}_{y}[ \mathbb{E}_{x}[x \mid y] ] \right)^2 \end{align} $$์ ๋ ์์ ๋ํ๋ฉด
$$ \begin{align} & \mathbb{E}_{y}[Var_{x}[x \mid y]] + Var_{y}[\mathbb{E}_{x}[x \mid y]] \\[5pt] &= \mathbb{E}_{x}[x^2] - \mathbb{E}_{y}[\left(\mathbb{E}_{x}[x \mid y]\right)^2 ] +\mathbb{E}_{y}[\left(\mathbb{E}_{x}[x \mid y]\right)^2 ] - \left( \mathbb{E}_{y}[ \mathbb{E}_{x}[x \mid y] ] \right)^2 \\[5pt] &= \mathbb{E}_{x}[x^2]- \left( \mathbb{E}_{y}[ \mathbb{E}_{x}[x \mid y] ] \right)^2 \\[5pt] &= \mathbb{E}_{x}[x^2] - \left( \mathbb{E}_{x}[x] \right)^2 \qquad \because \mathbb{E}[x] = \mathbb{E}_{y}[\mathbb{E}_{x}[x \mid y]] \\[5pt] &= Var[x] \end{align} $$์ด ์์ Law of total variance ๋ผ ํ๋ค.
๋ฉํฐ๋์ด ๋ถํฌ์ ๋ํ ๊ฐ๋ฅ๋๋ ์๋์ ๊ฐ๊ณ
$$ p(\mathcal{D} \mid \boldsymbol{\mu}) = \prod^{N}_{n=1} \prod^{K}_{k=1} \mu^{x_{nk}}_{k} = \prod^{K}_{k=1} \mu_{k}^{(\sum_{n} x_{nk})}=\prod^{K}_{k=1} \mu_{k}^{m_{k}} $$์ ์์์
$$ m_{k} = \sum_{n} x_{nk} $$์ด์ ๋ํ ์ต๋๊ฐ๋ฅ๋ ์ถ์ maximum likelihood estimation์ ์ํ $\boldsymbol{\mu}^{\text{ML}}$์ ๊ตฌํ๊ธฐ
$\mu_{k}$๋ 1-of-K ๋ฒกํฐ์ ๊ฐ k๋ฒ์งธ ์ฝคํฌ๋ํธ๊ฐ 1์ด ๋ ํ๋ฅ ์ ๋ํ๋ด๋ฏ๋ก ๋ค ๋ํด์ 1์ด ๋์ด์ผ ํจ ์ฆ,
$$ \sum_{k=1}^{K} \mu_{k} = 1 $$์ด๊ณ ์ด๋ ์ ์ฝ ์กฐ๊ฑด์ด ๋จ.
์์ ์ ์ํ ๊ฐ๋ฅ๋๋ ์ญ์๋ ๋ก๊ทธ๋ฅผ ์ทจํด์ ๋ค๋ฃจ๊ฒ ๋๋ค. ๋ฐ๋ผ์ ๋ค์ ์ต์ ํ ๋ฌธ์ ๋ฅผ ํ์ด $\boldsymbol{\mu}^{\text{ML}}$์ ๊ตฌํ ์ ์๋ค.
$$ \text{Minimize } \ln p(\mathcal{D} \mid \boldsymbol{\mu}) \quad \text{ s.t. } \sum_{k=1}^{K} \mu_{k} = 1 $$๋ผ๊ทธ๋์ง์์ ๊ตฌ์ฑํ๊ณ ,
$$ \mathcal{L}(\boldsymbol{\mu}, \lambda) = \sum_{k=1}^{K} m_k \ln \mu_k + \lambda \left( \sum_{k=1}^{K} \mu_k -1 \right) $$๊ฐ ๋ณ์ $\mu_k$, $\lambda$๋ก ๋ฏธ๋ถํ ํ 0์ผ๋ก ๋๊ณ ๊ทน์ ์ ์ฐพ๋๋ค.
$$ \begin{align} &\frac{\partial \mathcal{L}}{\partial \mu_k} = \frac{m_k}{\mu_k} + \lambda = 0 \\[5pt] &\frac{\partial \mathcal{L}}{\partial \lambda} = \sum_{k=1}^{K} \mu_k -1 = 0 \end{align} $$์ฒซ๋ฒ์งธ ์์ ์ ๋ฆฌํ๋ฉด $ \mu_k = -m_{k} / \lambda $๋ฅผ ์ป๊ณ ์ด๋ฅผ ๋๋ฒ์งธ ์์ ๋์ ํ๋ฉด
$$ \begin{align} &\sum_{k=1}^{K} \left( - \frac{m_k}{\lambda} \right) = 1 \\[5pt] &-\frac{1}{\lambda} \sum_{k=1}^{K} m_k = 1\\[5pt] &-\frac{1}{\lambda} \sum_{k=1}^{K} \sum_{n=1}^{N} x_{nk} = 1 \end{align} $$์ ์์์ $\sum_{k=1}^{K} \sum_{n=1}^{N} x_{nk} = N$ ์ด ๋๋๋ฐ ์๋ํ๋ฉด $N$๊ฐ์ $K$์ฐจ์ ๋ฒกํฐ $\mathbf{x}$๋ $k$๋ฒ์งธ ์์๋ง 1์ด๊ณ ๋๋จธ์ง๋ ๋ชจ๋ 0์ธ ๋ฒกํฐ์ธ๋ฐ ์ด๋ฅผ ๊ฐ ์๋ฆฌ๋ผ๋ฆฌ ๋ค ๋ํด์ ๋์จ ๋ฒกํฐ๋ ๊ฐ์ง๊ณ ์๋ ๋ฐ์ดํฐ์ค์ $k$๋ฒ์งธ ์๋ฆฌ๊ฐ 1์ธ ๋ฒกํฐ๊ฐ ๋ช ๊ฐ์ธ์ง๋ฅผ ๋ํ๋. ์ด๋ฅผ ์น ๋ค ๋ํ๋ ๊ฑฐ๋๊น ๊ฒฐ๊ณผ๋ $N$์ด ๋จ. ๋ค์ ์ฝ๋๋ก ๊ฐ๋จํ๊ฒ ์คํํด ๋ด
import numpy as np
N = 10
K = 6
D = np.zeros((K,N))
D[np.random.randint(6,size=10),np.arange(10)] = 1
print("๊ธธ์ด K={}์ธ x๋ฒกํฐ N={}๊ฐ".format(K, N))
print(D)
D.sum(axis=1).sum(axis=0)
๊ธธ์ด K=6์ธ x๋ฒกํฐ N=10๊ฐ [[ 0. 0. 0. 0. 0. 0. 0. 1. 0. 0.] [ 0. 0. 0. 0. 0. 0. 1. 0. 0. 0.] [ 0. 0. 0. 1. 0. 1. 0. 0. 0. 1.] [ 0. 1. 0. 0. 1. 0. 0. 0. 0. 0.] [ 0. 0. 1. 0. 0. 0. 0. 0. 1. 0.] [ 1. 0. 0. 0. 0. 0. 0. 0. 0. 0.]]
10.0
๊ฒฐ๊ตญ $\lambda = -N$์ด ๋๊ณ ์ด ๊ฒฐ๊ณผ๋ฅผ ๋ค์ $ \mu_k = -m_{k} / \lambda $ ๋์ ํ๋ฉด ์ต์ข ์ ์ผ๋ก
$$ \mu^{\text{ML}}_k = - \frac{m_k}{N} $$Consider the multivariate Gaussian distribution given by (2.43). By writing the precision matrix (inverse covariance matrix) $\Sigma^{-1}$ as the sum of a symmetric and an anti-symmetric matrix, show that the anti-symmetric term does not appear in the exponent of the Gaussian, and hence that the precision matrix may be taken to be symmetric without loss of generality. Because the inverse of a symmetric matrix is also symmetric (see Exercise 2.22), it follows that the covariance matrix may also be chosen to be symmetric without loss of generality.
๋ค๋ณ์ ์ ๊ท๋ถํฌ์ ์ง์ํญ์ ๋ค์ด์๋ ์ ๋ฐ๋ ํ๋ ฌ์ ์ด๋ค ํ๋ ฌ์ด๋ผ๋ ์ฌ ์ ์๋๋ฐ ์ด๋ค ํ๋ ฌ์ด ์ค๋๋ผ๋ ์ง์ํญ์ ๊ฒฐ๊ณผ๊ฐ ๋์ผํด์ง๋ ๋์นญํ๋ ฌ๋ก ๋ฐ๊ฟ ์ ์๋ค. $\mathbf{M}$์ด ์ผ๋ฐ์ ์ธ ์ ๋ฐฉํ๋ ฌ์ด๋ผ ํ๋ฉด ์ด๊ฒ์ ํญ์ ๋ค์๊ณผ ๊ฐ์ด ๋์นญํ๋ ฌ๊ณผ ๋ฐ๋์นญํ๋ ฌskew symmetric, anti symmetric๋ก ๋ถ๋ฆฌํ ์ ์๋ค.[1]
$$ \mathbf{M} = \mathbf{\Lambda}^{S} + \mathbf{\Lambda}^{A} $$์ด๋ $$ \Lambda^{S}_{ij} = \frac{M_{ij}+M_{ji}}{2}, \qquad \Lambda^{A}_{ij} = \frac{M_{ij}-M_{ji}}{2} $$
๋ฌธ์ ์์ ๋ณด์ด๊ณ ์ ํ๋ ๊ฒ์ ์์์ ํ๋ ฌ $\mathbf{M}$์ ์ ๊ท๋ถํฌ ์ง์ํญ์ ๋ฃ์ด ๊ณ์ฐํ ๊ฒฐ๊ณผ์ $\mathbf{\Lambda}^{S}$๋ฅผ ๋ฃ์ด ๊ณ์ฐํ ๊ฒฐ๊ณผ๊ฐ ๊ฐ๋ค๋ ๊ฒ์ ๋ณด์ด๋ ๊ฒ์ด๋ค. ์๋ ์ฝ๋๋ก ์ผ๋จ ์คํํด๋ณธ๋ค.
# ์์์ 5x5 ํ๋ ฌ
M = np.random.randint(1,30, size=25).reshape(5,5)
print('์๋ ํ๋ ฌ M')
print(M)
print('\n')
# ๋์นญํ๋ ฌ
print('๋์นญ ํ๋ ฌ S')
S = (M + M.T)/2
print(S)
print('\n')
#๋ฐ๋์นญํ๋ ฌ
print('๋ฐ๋์นญ ํ๋ ฌ A')
A = (M - M.T)/2
print(A)
print('\n')
#๋์ ๋ํ๋ฉด ์๋ ํ๋ ฌ์ด ๋๋ค.
print('M = S+A')
print(S+A)
print('\n')
# ์ ๊ท๋ถํฌ ์ง์ํญ์ ๊ณ์ฐํด๋ณธ๋ค. (x-u)^T ฮฃ^-1 (x-u) , (x-u)^T (S) (x-u) ๋น๊ต
# ๊ฒฐ๊ณผ๊ฐ ๊ฐ๋ค.
x = np.random.randint(1, 30, size=5)
u = np.random.randint(1, 30, size=5)
print('(x-u)^T M (x-u) : {}'.format(np.dot(np.dot((x - u).T, M), (x-u))))
print('(x-u)^T S (x-u) : {}'.format(np.dot(np.dot((x - u).T, S), (x-u))))
์๋ ํ๋ ฌ M [[28 13 1 11 3] [ 6 2 1 15 24] [14 24 22 15 25] [17 23 1 11 5] [ 4 26 25 28 2]] ๋์นญ ํ๋ ฌ S [[ 28. 9.5 7.5 14. 3.5] [ 9.5 2. 12.5 19. 25. ] [ 7.5 12.5 22. 8. 25. ] [ 14. 19. 8. 11. 16.5] [ 3.5 25. 25. 16.5 2. ]] ๋ฐ๋์นญ ํ๋ ฌ A [[ 0. 3.5 -6.5 -3. -0.5] [ -3.5 0. -11.5 -4. -1. ] [ 6.5 11.5 0. 7. 0. ] [ 3. 4. -7. 0. -11.5] [ 0.5 1. 0. 11.5 0. ]] M = S+A [[ 28. 13. 1. 11. 3.] [ 6. 2. 1. 15. 24.] [ 14. 24. 22. 15. 25.] [ 17. 23. 1. 11. 5.] [ 4. 26. 25. 28. 2.]] (x-u)^T M (x-u) : 1680 (x-u)^T S (x-u) : 1680.0
์์ ๊ฐ์ด ๋๋ ์ด์ ๋ ๋ค์๊ณผ ๊ฐ๋ค.
$$ \begin{align} \sum_{i} \sum_{j} (x_{i}-\mu_{i}) M_{ij} (x_{j} -\mu_{j}) &= \sum_{i} \sum_{j} (x_{i}-\mu_{i}) (\Lambda^{S}_{ij} + \Lambda^{A}_{ij}) (x_{j} -\mu_{j}) \\[5pt] &= \sum_{j} \left( \sum_{i} (x_{i}-\mu_{i}) \Lambda^{S}_{ij} + \sum_{i} (x_{i}-\mu_{i}) \Lambda^{A}_{ij} \right) (x_{j} -\mu_{j}) \\[5pt] &= \sum_{i} \sum_{j} (x_{i}-\mu_{i}) \Lambda^{S}_{ij} (x_{j} -\mu_{j}) + \underbrace{\sum_{i} \sum_{j} (x_{i}-\mu_{i}) \Lambda^{A}_{ij} (x_{j} -\mu_{j})}_{= 0} \end{align} $$์ ์์ฒ๋ผ $\mathbf{M}$์ ๋์นญํ๋ ฌ $\mathbf{\Lambda}^{S}$์ ๋ฐ๋์นญํ๋ ฌ $\mathbf{\Lambda}^{A}$๋ก ๋ฐ๊พธ๊ณ ์์ ์ ๊ฐํ๋ฉด $\mathbf{\Lambda}^{A}$์ ์ํ ํญ์ 0์ด ๋๋ค. $\mathbf{\Lambda}^{A}$์์ $i=j$์ธ ๊ฒฝ์ฐ ํ๋ ฌ์ ์์๋ ์ด๋ฏธ 0์ด๊ณ $i \ne j$์ธ ๊ฒฝ์ฐ๋ ์์์ ๋ถํธ๊ฐ ์๋ก ๋ฐ๋๊ฐ ๋์ด ๋ํ๋ฉด ๋ค ์ฌ๋ผ์ง๊ธฐ ๋๋ฌธ์ด๋ค.
์ ๊ท๋ถํฌ์ ์ง์ํญ์ ๋ค์ด๊ฐ๋ ์ ๋ฐ๋ ํ๋ ฌ์ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ์ญํ๋ ฌ์ธ๋ฐ ๊ณต๋ถ์ฐ ํ๋ ฌ์ด ๋์นญํ๋ ฌ์ด๊ธฐ ๋๋ฌธ์ ์ ๋ฐ๋ ํ๋ ฌ๋ ๋์นญํ๋ ฌ์ผ ์ ๋ฐ์ ์๋ค. ์ ์ฆ๋ช ์ ํตํด ์ด์ผ๊ธฐํ๊ณ ์ถ์ ์ฌ์ค์ ์ ๋ฐ๋ ํ๋ ฌ์ด ๋์นญํ๋ ฌ์ด๋ผ๋ ์ฌ์ค์ด ์ ๊ท๋ถํฌ์ ์ผ๋ฐ์ฑ์ ์ ํํ์ง ์๋๋ค๋ ๊ฒ์ด๋ค. ์ ๋ฐ๋ํ๋ ฌ ์์น์ ์ผ๋ฐ์ ์ผ๋ก ์กด์ฌํ ์ ์๋ ๋ชจ๋ ์ ๋ฐฉํ๋ ฌ์ด ์ค๋ ๊ฒฝ์ฐ๋ฅผ ๊ทธ์ ๋์ํ๋ ๋์นญํ๋ ฌ๋ก ๋ฐ๊ฟ์๋ ๋ชจ๋ ๋ง๋ค์ด ๋ผ ์ ์๊ธฐ ๋๋ฌธ์ด๋ค.
Show that a real, symmetric matrix $\Sigma$ having the eigenvector equation (2.45) can be expressed as an expansion in the eigenvectors, with coefficients given by the eigenvalues, of the form (2.48). Similarly, show that the inverse matrix $\Sigma^{-1}$ has a representation of the form (2.49).
๋ฌธ์ ์์ ์ฐธ์กฐํ๋ ์์ ๋ค์๊ณผ ๊ฐ๋ค.
$$ \boldsymbol{\Sigma} \mathbf{u}_{i} = \lambda_{i} \mathbf{u}_{i} \tag{2.45} $$$$ \boldsymbol{\Sigma} = \sum_{i=1}^{D} \lambda_{i} \mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i} \tag{2.48} $$$$ \boldsymbol{\Sigma}^{-1} = \sum_{i=1}^{D} \frac{1}{\lambda_{i}} \mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i} \tag{2.49} $$๋จผ์ ์(2.48)์ ์๋ ์ด๋ฒกํฐ์ ํ๋ฐฑํฐ๋ฅผ ํ๋ ฌ๊ณฑํด์ ํ๋ ฌ์ด ๋๊ณ ์ด๋ฅผ ๋ค ๋ํ๋ ์ฐ์ฐ์ ํ๋ ฌํ์์ผ๋ก ์ฐ๋ ๊ฒฝ์ฐ๋ฅผ ์์๋ณด์. $\mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i}$๊ฐ ํ๋ ฌ์ด ๋๊ณ $i$์ ๋ํด ๊ทธ๋ ๊ฒ ์๊ธด ํ๋ ฌ์ ๋ค ๋ํ๋ ์ฐ์ฐ์ด๋๊น ์ด ํ๋ ฌ ๋ํ๊ธฐ๋ฅผ ํ๋ฒ์ ํ๊ธฐ ์ํด์๋ ์์ ์ด๋ฒกํฐ๋ฅผ ๊ฐ๋ก ๋ฐฉํฅ์ผ๋ก ์ ์ด์ ํ๋ ฌ๋ก ๋ง๋ค๊ณ ๋ค์ ํ๋ฒกํฐ๋ฅผ ์ธ๋ก ๋ฐฉํฅ์ผ๋ก ์ ์ด์ ์ ํ๋ ฌ์ ์ ์นํ๋ ฌ๋ก ๋ง๋ค์ด ํ๋ ฌ๊ณฑ์ ํ๋ฉด ํ๋ฒ์ ์(2.48)์ ๊ณ์ฐํ ์ ์๋ค. ์ด๋ ์์ ์์ $\lambda_{i}$๊ฐ ๊ณฑํด์ง๊ธฐ ๋๋ฌธ์ ์ด ์์๋ ํ๋ ฌ๋ก ํํํด์ฃผ์ด์ผ ํ๋ค. $\lambda_{i}$๋ฅผ ์์๋ก ํํํด์ ์(2.48)์ ํ๋ ฌํ์์ผ๋ก ์ฐ๋ฉด ์๋์ ๊ฐ๋ค.
$$ \begin{bmatrix} \lambda_{1} \mathbf{u}_{1} & \lambda_{2} \mathbf{u}_{2} & \cdots & \lambda_{D} \mathbf{u}_{D} \end{bmatrix} \begin{bmatrix} \mathbf{u}_{1}^{\text{T}} \\ \mathbf{u}_{2}^{\text{T}} \\ \vdots \\ \mathbf{u}_{D}^{\text{T}} \end{bmatrix} $$ํ๋ ฌ์ ๊ฐ ์ด์ ํน์ ์์๋ฅผ ๊ณฑํ๋ ๊ฒ์ ๊ทธ ์์๋ฅผ ์ฃผ๋๊ฐ ์์๋ฅผ ๊ฐ์ง๋ ํ๋ ฌ์ ๋ค์์ ๊ณฑํ๋ฉด ๋๋ฏ๋ก ์ ์์ ๋ค์๊ณผ ๊ฐ์ด ์ธ ์ ์๋ค.
$$ \begin{bmatrix} \mathbf{u}_{1} & \mathbf{u}_{2} & \cdots & \mathbf{u}_{D} \end{bmatrix} \begin{bmatrix} \lambda_{1} & 0 & \cdots & 0 \\ 0 & \lambda_{2} & \cdots & 0 \\ & & \ddots & \\ 0 & 0 & \cdots & \lambda_{D} \end{bmatrix} \begin{bmatrix} \mathbf{u}_{1}^{\text{T}} \\ \mathbf{u}_{2}^{\text{T}} \\ \vdots \\ \mathbf{u}_{D}^{\text{T}} \end{bmatrix} $$orthonormalํ ๊ณ ์ ๋ฒกํฐ๋ฅผ ์ด๋ก ๊ฐ์ง๋ ํ๋ ฌ์
$$ \mathbf{U} = \begin{bmatrix} \mathbf{u}_{1} & \mathbf{u}_{2} & \cdots & \mathbf{u}_{D} \end{bmatrix}$$๋ก ๋๋ฉด ์(2.48)์ ๋ค์์ฒ๋ผ ์์ ํ ํ๋ ฌ๋ก ์ธ ์ ์๋ค.
$$ \sum_{i=1}^{D} \lambda_{i} \mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i} = \mathbf{U} \mathbf{\Lambda} \mathbf{U}^{\text{T}} = \mathbf{M} \tag{1} $$๊ฐ์ ๋ ผ๋ฆฌ๋ก ์(2.45)๋ ๋ค์์ฒ๋ผ ์ธ ์ ์๋ค.
$$ \boldsymbol{\Sigma} \mathbf{U} = \mathbf{U} \mathbf{\Lambda} \tag{2} $$์ด์ ์(1)์ ์๋ณ์ $ \mathbf{U}^{\text{T}}$, $\mathbf{U}$๋ฅผ ๊ณฑํ๋ฉด
$$ \mathbf{U}^{\text{T}} \mathbf{M} \mathbf{U} = \mathbf{U}^{\text{T}} \mathbf{U} \mathbf{\Lambda} \mathbf{U}^{\text{T}} \mathbf{U} = \mathbf{\Lambda} \qquad \because \mathbf{U}^{\text{T}} \mathbf{U} = \mathbf{I} $$๊ทธ๋ฆฌ๊ณ ์(2) ์๋ณ์ $ \mathbf{U}^{\text{T}}$๋ฅผ ๊ณฑํ๋ฉด
$$ \mathbf{U}^{\text{T}} \boldsymbol{\Sigma} \mathbf{U} = \mathbf{U}^{\text{T}} \mathbf{U} \mathbf{\Lambda} = \mathbf{\Lambda} $$๋ฐ๋ผ์ $\mathbf{U}^{\text{T}} \mathbf{M} \mathbf{U} = \mathbf{U}^{\text{T}} \boldsymbol{\Sigma} \mathbf{U}$์ด๊ณ ์ด๋ก๋ถํฐ $\mathbf{M}=\boldsymbol{\Sigma}$๊ฐ ๋๋ฉฐ ์ต์ข ์ ์ผ๋ก ์(1)์ ์ํด ๋ค์์ฒ๋ผ ์(2.48)์ด ์ฑ๋ฆฝํ๊ฒ ๋๋ค.
$$ \boldsymbol{\Sigma} = \sum_{i=1}^{D} \lambda_{i} \mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i} $$ํํธ $\boldsymbol{\Sigma} = \mathbf{U} \mathbf{\Lambda} \mathbf{U}^{\text{T}}$ ์ด๊ณ , $\mathbf{U}$๋ $\mathbf{U}^{\text{T}} = \mathbf{U}^{-1}$๋ฅผ ๋ง์กฑํ๋ ์ง๊ตํ๋ ฌ์ด๋ฏ๋ก
$$ \boldsymbol{\Sigma}^{-1} = \left( \mathbf{U} \mathbf{\Lambda} \mathbf{U}^{\text{T}} \right) ^{-1} = \left( \mathbf{U}^{\text{T}} \right)^{-1} \mathbf{\Lambda}^{-1} \mathbf{U}^{-1} = \left( \mathbf{U}^{-1} \right)^{-1} \mathbf{\Lambda}^{-1} \mathbf{U}^{\text{T}} = \mathbf{U} \mathbf{\Lambda}^{-1} \mathbf{U}^{\text{T}} = \sum_{i=1}^{D} \frac{1}{\lambda_{i}} \mathbf{u}_{i} \mathbf{u}^{\text{T}}_{i} $$๋ก ์(2.49)๋ ์ฑ๋ฆฝํจ์ ๋ณด์ผ ์ ์๋ค.
๋ค์ ์(2.51)์ ๊ธฐํํ์ ์๋ฏธ๋
$$ y_i = \mathbf{u}_{i}^{\text{T}} (\mathbf{x}-\boldsymbol{\mu}) \tag{2.51} $$๊ทธ๋ฆผ์ฒ๋ผ $\mathbf{x}-\boldsymbol{\mu}$๊ฐ ๊ธฐ์ ๋ฒกํฐ $\mathbf{u}_{i}$๋ฐฉํฅ์ผ๋ก ๋ถํด๋ ๋ฒกํฐ์ ํฌ๊ธฐ๋ฅผ ๋ํ๋ธ๋ค. ์ฆ, $\mathbf{x}-\boldsymbol{\mu}$์ $\mathbf{u}_{i}$๋ก์ ์ ์ฌ์์ด๋ฉฐ ์ด๋ ๋ ๋ฒกํฐ์ ๋ด์ ๊ณผ ๊ฐ๋ค.
์ ๊ทธ๋ฆผ ์ค๋ช ๊ธ์์ "$\exp(โ1/2)$ of its value at $x = \mu$" ๋ถ๋ถ์ด ์ข ์ ๋งคํ๊ฒ ํด์๋ ์ ๋ ์์ด ์ถ๊ฐ ์ค๋ช ์ ์ ๋ฆฌํ๋ค.
๊ทธ๋ฆผ์์ ๋นจ๊ฐ์ ๋ผ์ธ์ 2๋ณ์ ์ ๊ท๋ถํฌ ํ๋ฅ ๋ฐ๋ํจ์ ๊ฐ์ด
$$ \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{- \frac{1}{2} \right\} $$์ธ ๋ผ์ธ์ด๋ค. ๋ค๋ณ์ ์ ๊ท๋ถํฌ์์ $x = \mu$์ด๋ฉด ์ง์ํญ์ 1์ด ๋์ด ๊ทธ๋์ ํจ์๊ฐ์ $\frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}}$์ด ๋๋ฏ๋ก ๋นจ๊ฐ ๋ผ์ธ์ด ์ด ๊ฐ์ $\exp(โ1/2)$๋งํผ(* which the densityis $\exp(โ1/2)$ of its value at $x = \mu$ *)์ด๋ผ๊ณ ๋งํ ๊ฒ์ด๋ค. ํ์์ ์ฅ์ถ๊ณผ ๋จ์ถ์ ๊ธธ์ด๊ฐ $\sqrt{\lambda}$์ธ ๊ฒ์ ๋ค์๊ณผ ๊ฐ๋ค.
$$ \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{- \frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^{\text{T}} \Sigma^{-1} (\mathbf{x}-\boldsymbol{\mu}) \right\} = \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{ - \frac{1}{2} \right\} $$๋นจ๊ฐ ์ ์์ ๋ชจ๋ ์ ๋ค์ ์ ์์ ๋ง์กฑ์์ผ์ผ ํ๋ค. ์(2.50)์ ์จ์ ์์ ๋ณํํ๋ฉด
$$ \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{ \sum_{i=1}^{D} - \frac{y_{i}^{2}}{2 \lambda_i}\right\} = \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{ - \frac{1}{2} \right\} $$์ด๊ณ , ๊ทธ๋ฆผ์ ๊ฒฝ์ฐ $D=2$์ด๋ฏ๋ก
$$ \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{ -\frac{1}{2} \left( \frac{y_1^2}{\lambda_1} + \frac{y_2^2}{\lambda_2} \right) \right\} = \frac{1}{(2\pi)^{D/2}} \frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp \left\{ - \frac{1}{2}(1) \right\} $$๊ฐ ๋๊ณ ๋นจ๊ฐ์ ์์ $y_1$, $y_2$๋ ๋ค์์ ๋ง์กฑ์ํค๋ ์ ๋ค์ด ๋๋ค.
$$ \frac{y_1^2}{\lambda_1} + \frac{y_2^2}{\lambda_2} = 1 $$์ ์์ ๋ง์กฑ์ํค๋ $y_1$, $y_2$์ ์งํฉ์ ํ์์ด ๋๋ฉฐ ๊ทธ๋ ํ์์ ์ฅ์ถ๊ณผ ๋จ์ถ์ $\sqrt{\lambda_1}$, $\sqrt{\lambda_2}$๊ฐ ๋๋ ๊ฒ์ ์ ์ ์๋ค.
์ ์์ ์๋ฏธ๋ $\boldsymbol{\Sigma}$ ํ๋ ฌ์ ํ๋ ฌ์์ ๊ณ ์ ๊ฐ์ ๊ณฑ์ด๋ผ๋ ๊ฒ์ธ๋ฐ ์ด๋ ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ์ ์๋ค.
์ฐ์ ๊ณ ์ ์น ๋ถํด๋ฅผ ํตํด ํ๋ ฌ $\boldsymbol{\Sigma}$๋ ๋ค์์ฒ๋ผ ๋ถํด ๊ฐ๋ฅํ๋ค.[1][2]
$$ \Sigma = \mathbf{X}\mathbf{\Lambda}\mathbf{X}^{-1} $$์ฌ๊ธฐ์ $\mathbf{\Lambda}$๋ ๊ณ ์ ๊ฐ์ ์ฃผ๋๊ฐ์์๋ก ๊ฐ์ง๋ ๋๊ฐํ๋ ฌ์ด๊ณ , $\mathbf{X}$๋ ํ๋ ฌ $\Sigma$์ ๊ณ ์ ๋ฒกํฐ๋ฅผ ์ด๋ก ๊ฐ์ง๋ ํ๋ ฌ์ด๋ค.
์ด ์ํ์์ ํ๋ ฌ์์ ๊ตฌํ๋ฉด
$$ \det \left(\boldsymbol{\Sigma} \right) = \det \left(\mathbf{X}\mathbf{\Lambda}\mathbf{X}^{-1}\right) = \det \left(\mathbf{X}\right)\det \left(\mathbf{\Lambda} \right) \det \left( \mathbf{X}^{-1} \right) $$์ ๊ฐ๋ค. ์ฌ๊ธฐ์ $\det \left(\mathbf{X} \right)$์ $\det \left(\mathbf{X}^{-1} \right)$ ๋ค์์ฒ๋ผ ์ญ์ ๊ด๊ณ์ด๋ฏ๋ก
$$ \det \left(\mathbf{I} \right) = \det \left(\mathbf{X}\mathbf{X}^{-1} \right) = \det \left(\mathbf{X}\right)\det\left(\mathbf{X}^{-1}\right) = 1 $$๋ค์์ด ์ฑ๋ฆฝํ๋ค.
$$ \det \left(\boldsymbol{\Sigma}\right) = \det\left(\mathbf{\Lambda}\right) $$์ฌ๊ธฐ์ $\mathbf{\Lambda}$๋ ๊ณ ์ ๊ฐ์ ์ฃผ๋๊ฐ์์๋ก ๊ฐ์ง๋ ๋๊ฐํ๋ ฌ์ด๋ฏ๋ก $\det(\mathbf{\Lambda})$๋ ๊ณ ์ ๊ฐ์ ๊ณฑ์ด ๋๋ค. ๋ง์ง๋ง์ผ๋ก ์๋ณ์ 1/2์น ํ๋ฉด
$$ \left\{\det (\boldsymbol{\Sigma}) \right\}^{1/2} = \left\{\det(\mathbf{\Lambda})\right\}^{1/2} = \left\{\prod_{i} \lambda_{i} \right\}^{1/2} = \prod_{i} \lambda_{i}^{1/2} $$์(2.58)์ ์ ๋ถ์ด ์ ์(2.59)๊ฐ ๋๋์ง ์ค๋ช ํ๋ค. ์(2.58)์ ๋ค๋ณ์ ์ ๊ท๋ถํฌ์ $\mathbf{x}$๋ฅผ ๊ณฑํด์ ์ ๋ถํ ๊ฒ์ผ๋ก ๋ค๋ณ์ ์ ๊ท๋ถํฌ์ ์ ๊ทํ ์ฑ์ง์ ์ํด
$$ {(2 \pi)^{D/2}}{|\Sigma|^{1/2}} = \int \exp \left\{ -\frac{1}{2} (\mathbf{x}-\boldsymbol{\mu})^{\text{T}} \boldsymbol{\Sigma}^{-1} (\mathbf{x}-\boldsymbol{\mu}) \right\} \text{d}\mathbf{x} \tag{1} $$์์ ์๊ณ ์๋ค. ์(2.58)์ ๋ ์ ๊ฐํ๋ฉด
$$ \mathbb{E}[\mathbf{x}] = \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ -\frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z} \, d \mathbf{z} + \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \boldsymbol{\mu} \int \exp \left\{ -\frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \text{d} \mathbf{z} $$์ธ๋ฐ ๋์งธํญ์์ $\boldsymbol{\mu}$๋ฅผ ์ ์ธํ ๋ถ๋ถ์ ์(1)์ ์ํด
$$ \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ -\frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \text{d} \mathbf{z} =1 $$์ด ๋์ด ๋์งธํญ์ $\boldsymbol{\mu}$ ๊ฐ ๋๋ค. ์ ๋ถ๋ถ๋ถ์ $\mathbf{x} = \mathbf{z}+\boldsymbol{\mu}$๋ก ์์๋งํผ ๋ํด์ง ๋ณ์๋ณํ๋ ์ ๋ถ์ด๋ฏ๋ก ์(1)๊ณผ ์ ๋ถ๊ฐ์ ๋์ผํ๋ค.
์ฒซ์งธํญ์ $\exp(-\text{quadratic formula})$์ ์งํจ์even function๊ฐ ๋๋๋ฐ ์ฌ๊ธฐ์ ๋ค์ $\mathbf{z}$๊ฐ ๊ณฑํด์ ธ ์๋ ํํ๋ก ํํจ์๊ฐ ๋์ด ์ ๋ถ์ด 0์ด ๋์ด ์ฌ๋ผ์ง๋ค. ๊ทธ๋์ ์(2.59)๋ฅผ ์ป๊ฒ ๋๋ค.
์๋ ์ฝ๋๋ก ์งํจ์์ ๋ณ์๊ฐ ํ๋ฒ ๊ณฑํด์ก์ ๋ ๊ทธ๋ํ๋ฅผ ๊ทธ๋ ค๋ณด์๋ค.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import scipy.integrate as integrate
mpl.style.use(style_name)
plt.rcParams["figure.figsize"] = (10,5)
x = np.linspace(-5, 5, 100)
# exp(-quadratic) is even function
f = np.exp(-x**2)
# even function * variable is odd function
fx = f*x
plt.plot(x, f, label=r"$\exp(-x^2)$")
plt.plot(x, fx, label=r"$x\exp(-x^2)$")
plt.legend(fontsize="15")
plt.show()
์(2.60)~(2.64)๊น์ง๋ ์ข ์ ๊ฐ๊ฐ ๋ณต์กํ ๋ฉด์ด ์์ด์ ์ฑ ์์๋ ๊ณ์ฐ ๊ณผ์ ์ ๋ค ์๋ตํด๋ฒ๋ฆฌ๊ณ ๊ณ์ฐํ๋ ๋ฐฉ์๋ง ๊ฐ๋จํ๊ฒ ์ธ๊ธํ๊ณ ์๋ค. 5๊ฐ์์ ์ ๊ฐ๊ณผ์ ์ ์์ธํ ์ ๋ฆฌํ์๋ค.
5๊ฐ์ ์์ ์๋ ์์ ๊ณ์ฐํ๊ธฐ ์ํ ๊ณผ์ ์ธ๋ฐ ์๋์์ ํ๋ฅ ๋ณ์ $\mathbf{x}$ ์ ๊ณฑ์ ๊ธฐ๋๊ฐ์ ๊ตฌํ๊ธฐ ์ํ ๊ฒ์ด๋ค.
$$ \begin{align} \mathbb{E}[\mathbf{x}\mathbf{x}^{\text{T}}] &= \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} (\mathbf{x}-\boldsymbol{\mu})^{\text{T}} \boldsymbol{\Sigma}^{-1} (\mathbf{x}-\boldsymbol{\mu}) \right\} \mathbf{x}\mathbf{x}^{\text{T}} \text{d}\mathbf{x} \\[5pt] &= \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} (\mathbf{z}+\boldsymbol{\mu})(\mathbf{z}+\boldsymbol{\mu})^{\text{T}}\text{d}\mathbf{z} \end{align} $$$(\mathbf{z}+\boldsymbol{\mu})(\mathbf{z}+\boldsymbol{\mu})^{\text{T}}$ ๋ถ๋ถ์ ์ ๊ฐํ๋ฉด $\mathbf{z}\mathbf{z}^{\text{T}} +\mathbf{z} \boldsymbol{\mu}^{\text{T}}+\boldsymbol{\mu}\mathbf{z}^{\text{T}}+ \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}}$๊ฐ ๋๊ณ ์์์ ํ๋ฒ ๋ ์ ๊ฐํ๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
$$ \begin{align} &\quad \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} (\mathbf{z}+\boldsymbol{\mu})(\mathbf{z}+\boldsymbol{\mu})^{\text{T}}\text{d}\mathbf{z} \\[5pt] &=\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} (\mathbf{z}\mathbf{z}^{\text{T}} +\mathbf{z} \boldsymbol{\mu}^{\text{T}}+\boldsymbol{\mu}\mathbf{z}^{\text{T}}+ \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}})\text{d}\mathbf{z}\\[5pt] &=\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}}\left[ \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} + \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z} \boldsymbol{\mu}^{\text{T}} \text{d}\mathbf{z} + \\ \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \boldsymbol{\mu}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} + \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\}\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} \text{d}\mathbf{z} \right] \end{align} $$์ ๋ถํญ์ ๊ฐ์ด๋ฐ ๋ํญ์ ์(2.59)๋ฅผ ์ ๋ํ ๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ์ฐํจ์๊ฐ ๋์ด ์ ๋ถ์ด 0 ์ด ๋์ด ์ฌ๋ผ์ง๋ค. ๋ ํญ๋ง ๋จ๊ธฐ๊ณ ์ ๊ฐํ๋ฉด
$$ \begin{align} \mathbb{E}[\mathbf{x}\mathbf{x}^{\text{T}}] &= \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}}\left[ \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} + \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\}\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} \text{d}\mathbf{z} \right] \\[5pt] &=\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} + \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\}\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} \text{d}\mathbf{z} \end{align} $$์ด ๋๋๋ฐ ๋๋ฒ์งธ ์ ๋ถ์์ $\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}}$๋ ์ ๋ถ๊ณผ ์๊ด์๋ ์์๋ผ ์ ๋ถ๋ฐ์ผ๋ก ๋น ์ ธ๋์ค๋ฉด
$$ \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \text{d}\mathbf{z} $$์ด ๋๋๋ฐ, ์ฌ๊ธฐ์ $\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}}$๋ฅผ ์ ์ธํ ๋ถ๋ถ์ $\mathbf{z}$์ ๋ํ ์ ๊ท๋ถํฌ์ ์ง์ํญ ๋ถ๋ถ์ ์ ๋ถํ์ฌ ์ ๊ทํ ์์ ์ญ์์ ๊ณฑํด์ฃผ๋ ๊ฒ์ด๊ธฐ ๋๋ฌธ์ 1์ด ๋๋ค. ๋ฐ๋ผ์ ๋๋ฒ์งธ ์ ๋ถ์ $\boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}}$๊ฐ ๋์ด ์ฒซ๋ฒ์งธ ์ ๋ถ๋ง ์ฒ๋ฆฌํ๋ฉด ๋๋ค. ์ด ์ ๋ถ์ ๊ณ์ฐํ๋ ๊ฒ์ด ์(2.61)์ธ๋ฐ ์์ธํ ์ค๋ช ์์ด ๋์ถฉ ๋ง๋ก ๋์ฐ๊ธฐ ๋๋ฌธ์ ์ข ๋ ์์ธํ ์ ์ด๋ณธ๋ค.
$\boldsymbol{\Sigma}$์ ๊ณ ์ ๋ฒกํฐ $\mathbf{u}_i$๋ ์ง๊ต๋จ์๋ฒกํฐorthonormal์ด๋ฏ๋ก ๊ธฐ์ ๋ฅผ ์ด๋ฃจ์ด ์์์ ๋ฒกํฐ $\mathbf{z}$๋ฅผ ๋ค์์ฒ๋ผ ๊ณ ์ ๋ฒกํฐ์ ์ ํ์กฐํฉ์ผ๋ก ์ธ ์ ์๋ค. PRML์์ ์ด๋ฅผ ๊ณ ์ ๋ฒกํฐ์ ์์ ์ฑ the completeness of the set of eigenvectors์ด๋ผ ํ๋ค.
$$ \mathbf{z} = \sum_{j=1}^{D} y_j \mathbf{u}_j \tag{2.60} $$์(2.60)์์ ์ ํ์กฐํฉ ๊ณ์ $y_i$๋ ์ ์(2.51) ์ค๋ช ์ฒ๋ผ ๊ฐ ๊ณ ์ ๋ฒกํฐ ๋ฐฉํฅ์ผ๋ก์ ์ ์ฌ์์ด๋ฏ๋ก $y_j = \mathbf{u}_j^{\text{T}} \mathbf{z}$ ์ด๋ค. $\mathbf{z}=\mathbf{x}-\boldsymbol{\mu}$์ด๋ฏ๋ก ์ด๋ ์(2.51)๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ์ด๋ค. $\Sigma$๊ฐ ๊ณ ์ ๋ฒกํฐ์ ๊ณ ์ ์น์ ๊ณฑthe eigenvector expansion of the covariance matrix์ผ๋ก ๋ํ๋ด์ด์ง๋ ์(2.49), (2.50)๊ณผ ์(2.60)์ ์ฌ์ฉํ์ฌ ์ ์ฒซ๋ฒ์งธ ์ ๋ถ์์ ๋ค์ ์จ๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
$$ \begin{align} &\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} \\[5pt] &= \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ -\sum_{k=1}^{D} \frac{y^2_k}{2 \lambda_k} \right\}\left( \sum_{i=1}^{D} y_i \mathbf{u}_i\right) \left( \sum_{j=1}^{D} y_j \mathbf{u}_j \right)^{\text{T}} \end{align} $$์ ๋ค์ชฝ ์๊ทธ๋งํญ ๋๊ฐ๊ฐ ์๋ก ๊ณฑํด์ง๋ ๋ถ๋ถ์ ๋ฒกํฐ๊ฐ ์๋๋ผ๋
$$\sum_{i=1}^{2} x_i \sum_{j=1}^{2} x_j = (x_1+x_2)(x_1+x_2)=x_1 x_1+x_1 x_2+ x_2 x_1+x_2 x_2 = \sum_i \sum_j x_i x_j$$์ ๋ค๋ฅธ๊ฒ ์์ผ๋ฏ๋ก ๊ทธ๋๋ก ์ ๊ฐํด์ฃผ๋ฉด
$$ \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ -\sum_{k=1}^{D} \frac{y^2_k}{2 \lambda_k} \right\} \sum_{i=1}^{D} \sum_{j=1}^{D} y_i \, y_j \, \mathbf{u}_i \, \mathbf{u}_j^{\text{T}} \text{d}\mathbf{y} $$๊ฐ ๋๊ณ ์ง์ํญ ๋ถ๋ถ์ ์๋ฉ์ด์ ์ธ๋ฑ์ค์ ๋ํด ์์์ด๋ฏ๋ก ์๊ทธ๋ง ๊ธฐํธ ์์ผ๋ก ๋ค์ด๊ฐ๋ฉด
$$ \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \sum_{i=1}^{D} \sum_{j=1}^{D} \exp \left\{ -\sum_{k=1}^{D} \frac{y^2_k}{2 \lambda_k} \right\} y_i \, y_j \, \mathbf{u}_i \, \mathbf{u}_j^{\text{T}} \text{d}\mathbf{y} $$๊ฐ ๋๋ค. ์ ๋ถ๊ธฐํธ์์ $i \times j$๊ฐ ๋งํผ์ ํญ์ด ๋ํด์ ธ ์์ผ๋ฏ๋ก ๊ฐ ํญ์ ์ ๋ถํ์ฌ ๋ํด๋ ๋๋ค. ๊ทธ๋์ ์๊ทธ๋ง ๊ธฐํธ๋ฅผ ์ ๋ถ ๋ฐ์ผ๋ก ๋นผ๋ผ ์ ์๊ณ ๋์์ $ \mathbf{u}_i \, \mathbf{u}_j^{\text{T}}$๋ ์ ๋ถ์ ๋ํด ์์์ด๋ฏ๋ก ๊ฐ์ด ๋น ์ ธ ๋์ค๋ฉด ์ต์ข ์ ์ผ๋ก ์๋์ฒ๋ผ ์ ๋ฆฌ๋๋ค.
$$ \begin{align} &\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\boldsymbol{\Sigma}}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} \\[5pt] &=\frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \sum_{i=1}^{D} \sum_{j=1}^{D} \mathbf{u}_i \, \mathbf{u}_j^{\text{T}} \int \exp \left\{ -\sum_{k=1}^{D} \frac{y^2_k}{2 \lambda_k} \right\} y_i \, y_j \, \text{d}\mathbf{y} \end{align} $$์ ์์ ์ ๋ถ๋ณ์๋ฅผ $\mathbf{z}$์์ $\mathbf{y}$๋ก ๋ฐ๊พผ ๊ฒ์ด๋ค. ๊ทธ๋ฆฌ๊ณ ์(2.54)์ ์ํด ์ ๋ถ๋ณ์๋ฅผ $\mathbf{x}$์์ $\mathbf{y}$๋ก ๋ฐ๊ฟ๋ ์ผ์ฝ๋น์ ํ๋ ฌ์์ด 1์ด ๋จ์ ๋ณด์๋ค. $\mathbf{z}=\mathbf{x}-\boldsymbol{\mu}$๋ก $\mathbf{z}$์ $\mathbf{x}$๋ ์์ $\boldsymbol{\mu}$๋งํผ ์ฐจ์ด๋๋ ๊ด๊ณ์ด๋ฏ๋ก $\mathbf{z}$์์ $\mathbf{y}$๋ก ๋ณ์๋ณํํ ๋ ์ผ์ฝ๋น์ ํ๋ ฌ์๋ ์ญ์ 1์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก ์ ์ ๊ทธ๋๋ก ๋ณ์๋ณํ์ด ์๋ฃ๋ ์์ด ๋๋ค. ์ ์์ ์๊ทธ๋ง ๊ธฐํธ์์ํด $i \times j$๊ฐ ๋งํผ ์ ๋ถํญ์ด ์๋๋ฐ $i = j$์ธ $D$๊ฐ ๊ฒฝ์ฐ๋ฅผ ์ ์ธํ๋ฉด ์ ๋ถํญ์ด 0์ผ๋ก ๋ค ์ฌ๋ผ์ง๋ค. ์ฌ๊ธฐ์๋ ์ฐํจ์ ํน์ฑ์ด ์ฌ์ฉ๋๋ ๊ฒ์ด๋ค. $i \ne j$์ด๊ณ ์ง์ํญ ์์ $k$์ $i$ ๋๋ $j$๊ฐ ๊ฐ์ ๊ฒฝ์ฐ ๊ทธ ๊ฐ์ ์ธ๋ฑ์ค์ ๋ํ ๋ณ์ $y_i$ ๋๋ $y_j$์ ๋ํ ์ ๋ถ์ ์ฐํจ์ ์ ๋ถ์ด ๋์ด ์ ๋ถ๊ฐ์ด 0์ด ๋๋ ๊ฒ์ด๋ค. ๋ฐ๋ผ์ ์ ๋ถ์ด 0์ด ์๋ ํญ๋ง ๋จ๊ธฐ๊ณ ์์์ ํ์ธํ ์(2.55)๋ฅผ ์ด์ฉํด์ ๋ค์ ์ฐ๋ฉด
$$ \begin{align} &\prod_{k=1}^{D}\frac{1}{(2\pi)^{1/2}}\prod_{k=1}^{D}\frac{1}{\lambda_{k}^{1/2}} \sum_{i=1}^{D} \mathbf{u}_i \, \mathbf{u}_i^{\text{T}} \int \exp \left\{ -\sum_{k=1}^{D} \frac{y^2_k}{2 \lambda_k} \right\} y_i \, y_i \, \text{d}\mathbf{y} \\[5pt] &= \sum_{i=1}^{D} \mathbf{u}_i \, \mathbf{u}_i^{\text{T}} \int \prod_{k=1}^{D} \underbrace{\frac{1}{(2\pi \lambda_k)^{1/2}} \exp \left\{ - \frac{y_k^2}{2\lambda_k} \right\}}_{\text{Gaussian}, \mathcal{N}(y_k \mid 0, \lambda_k)} y^2_i \text{d}\mathbf{y} \end{align} $$์ด ๋๋ค. ์ ์ ๋ถ์ $y_1$~$y_D$์ ๋ํ ์ค์ ๋ถ์ด๊ณ ํผ์ ๋ถํจ์์์ ๊ฐ ๋ณ์์ ๋ํ 1๋ณ์ ์ ๊ท๋ถํฌ ํ๋ฅ ๋ฐ๋ํจ์ $D$๊ฐ๊ฐ ๊ณฑํด์ ธ์๋ ํํ์ด๋ค. ์ข ํ์ด์ ์ ์ด๋ณด๋ฉด ๋ค์์ฒ๋ผ ๋ ๊ฒ์ด๋ค.
$$ \begin{align} &\mathbf{u}_1 \mathbf{u}_1^{\text{T}} \int \mathcal{N}(y_1 \mid 0, \lambda_1) \mathcal{N}(y_2 \mid 0, \lambda_2) \cdots \mathcal{N}(y_D \mid 0, \lambda_D) \, y_1^2 \, \text{d}\mathbf{y} \\[5pt]+&\mathbf{u}_2 \mathbf{u}_2^{\text{T}} \int \mathcal{N}(y_1 \mid 0, \lambda_1) \mathcal{N}(y_2 \mid 0, \lambda_2) \cdots \mathcal{N}(y_D \mid 0, \lambda_D) \, y_2^2 \, \text{d}\mathbf{y} \\[5pt]+&\cdots \\[5pt]+&\mathbf{u}_D \mathbf{u}_D^{\text{T}} \int \mathcal{N}(y_1 \mid 0, \lambda_1) \mathcal{N}(y_2 \mid 0, \lambda_2) \cdots \mathcal{N}(y_D \mid 0, \lambda_D) \, y_D^2 \, \text{d}\mathbf{y} \end{align} $$ํธ๋น๋ ์ ๋ฆฌ์ ์ํด ํ๋ณ์์ฉ ์ฐจ๋ก๋ก ์ ๋ถ์ ํ๋ฉด $k \ne i$์ธ ๊ฒฝ์ฐ๋ ์(2.57)์ ์ํด ๋ชจ๋ ์ ๋ถ์ด 1์ด ๋๊ณ $k = i$์ธ ๊ฒฝ์ฐ๋ง ๋จ๊ฒ ๋๋ค.
$$ \sum_{i=1}^{D} \mathbf{u}_i \, \mathbf{u}_i^{\text{T}} \underbrace{\int \frac{1}{(2\pi \lambda_i)^{1/2}} \exp \left\{ - \frac{y_i^2}{2\lambda_i} \right\} \, y^2_i \, \text{d}y_i}_{\lambda_i} $$๋จ์ ์๋ ์ ๋ถ์ ์(1.50)์ ์ํด $\lambda_i$๊ฐ ๋๊ณ ์(2.48)์ ์ํด ์ต์ข ์ ์ผ๋ก ๋ค์์ฒ๋ผ ์(2.61)์ด ์์ฑ๋๋ค.
$$ \frac{1}{(2 \pi)^{D/2}}\frac{1}{|\boldsymbol{\Sigma}|^{1/2}} \int \exp \left\{ - \frac{1}{2} \mathbf{z}^{\text{T}} \boldsymbol{\Sigma}^{-1} \mathbf{z} \right\} \mathbf{z}\mathbf{z}^{\text{T}} \text{d}\mathbf{z} = \sum_{i=1}^{D} \mathbf{u}_i \, \mathbf{u}_i^{\text{T}} \lambda_i = \boldsymbol{\Sigma} \tag{2.61} $$์ฒ์ ๊ณ์ฐํ๊ณ ์ ํ๋ ํ๋ฅ ๋ณ์ $\mathbf{x}$ ์ ๊ณฑ์ ๊ธฐ๋๊ฐ์
$$ \mathbb{E} \left[\mathbf{x} \mathbf{x}^{\text{T}}\right] = \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} + \Sigma \tag{2.62} $$์ด ๋๋ค. ํํธ ๋ถ์ฐ์ ํธ์ฐจํ๊ท ์ ์ ๊ณฑ์ด๋ฏ๋ก ๋ฒกํฐ๋ณ์์ ๋ํด์๋ ๊ฐ์ด ์ ์ฉํด๋ณด๋ฉด
$$ \text{cov}[\mathbf{x}] = \mathbb{E}[ (\mathbf{x}-\mathbb{E}[\mathbf{x}])(\mathbf{x}-\mathbb{E}[\mathbf{x}])^{\text{T}} ] \tag{2.63} $$์(2.63)์ ์(2.62)๋ฅผ ์ด์ฉํ์ฌ ๊ณ์ ์ ๊ฐํ๋ฉด
$$ \begin{align} \text{cov}[\mathbf{x}] &= \mathbb{E} \left[ (\mathbf{x}-\mathbb{E}[\mathbf{x}])(\mathbf{x}-\mathbb{E}[\mathbf{x}])^{\text{T}} \right] \\[5pt] &= \mathbb{E} \left[\mathbf{x}\mathbf{x}^{\text{T}} - \mathbf{x}\mathbb{E}[\mathbf{x}]^{\text{T}} - \mathbb{E}[\mathbf{x} ]\mathbf{x}^{\text{T}} + \mathbb{E}[\mathbf{x}]\mathbb{E}[\mathbf{x}]^{\text{T}} \right] \\[5pt] &= \mathbb{E} \left[ \mathbf{x}\mathbf{x}^{\text{T}} - \mathbf{x}\boldsymbol{\mu}^{\text{T}} - \boldsymbol{\mu}\mathbf{x}^{\text{T}} + \boldsymbol{\mu} \boldsymbol{\mu}^{\text{T}} \right] \\[5pt] &= \mathbb{E} \left[ \mathbf{x}\mathbf{x}^{\text{T}} \right] - \mathbb{E}\left[\mathbf{x}\boldsymbol{\mu}^{\text{T}}\right] - \mathbb{E}\left[ \boldsymbol{\mu}\mathbf{x}^{\text{T}}\right] + \mathbb{E}\left[ \boldsymbol{\mu} \boldsymbol{\mu}^{\text{T}} \right] \\[5pt] &= \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} + \Sigma - \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} - \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} + \boldsymbol{\mu}\boldsymbol{\mu}^{\text{T}} \\[5pt] &= \boldsymbol{\Sigma} \end{align} \tag{2.64} $$์ด ๋์ด ๋ค๋ณ์ ์ ๊ท๋ถํฌ ํ๋ฅ ๋ฐ๋ํจ์์ ๋งค๊ฐ๋ณ์์ธ $\boldsymbol{\Sigma}$ ํ๋ ฌ์ด ๋ ๋ฆฝ๋ณ์๋ค์ ๊ณต๋ถ์ฐ ํ๋ ฌ์ด ๋จ์ ํ์ธํ ์ ์๋ค.
2.3.1 ~ 2.3.4์ ์ 2์ฅ์์ ์ ์ผ ์ค์ํ ๋ถ๋ถ์ด๋ฏ๋ก ๋จํธ์ ์ผ๋ก ์ ๋ฆฌํ์ง ์๊ณ ์ด์ผ๊ธฐ๋ฅผ ํ์ด๊ฐ๋ ๋ฐฉ์์ผ๋ก ์ ๋ฆฌํ๋ค. ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ๋ก ๋ถํฐ ์กฐ๊ฑด๋ถ ํ๋ฅ ๋ถํฌ, ์ฃผ๋ณ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ตฌํ๋ ๋ด์ฉ์ธ๋ฐ ์ด๋ฅผ ์ํด ๋ค์ฐจ์ ๋ฒกํฐ ๋ณ์๋ฅผ 2๊ฐ๋ก ๋๋ ์ ์ด์ผ๊ธฐ๋ฅผ ์งํํ๋ค. ์(2.70)๊ณผ ํจ๊ป ๋ณ์๋ฅผ ๋๋๋ค๋ ๊ฒ์ ๊ธฐํํ์ ์ธ ์๋ฏธ๋ฅผ ์์๋ณธ๋ค.
$$ \begin{align} -\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^{\text{T}} \boldsymbol{\Sigma}^{-1} (\mathbf{x}-\boldsymbol{\mu}) &= -\frac{1}{2} \begin{pmatrix} \mathbf{x}_{a} - \boldsymbol{\mu}_a \\ \mathbf{x}_b - \boldsymbol{\mu}_b \end{pmatrix}^{\text{T}} \begin{bmatrix} \boldsymbol{\Lambda}_{aa} & \boldsymbol{\Lambda}_{ab} \\ \boldsymbol{\Lambda}_{ba} & \boldsymbol{\Lambda}_{bb} \end{bmatrix} \begin{pmatrix} \mathbf{x}_{a} - \boldsymbol{\mu}_a \\ \mathbf{x}_b - \boldsymbol{\mu}_b \end{pmatrix} \\[5pt] &= -\frac{1}{2}\begin{pmatrix} (\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{aa}+(\mathbf{x}_b - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{ba} \\ (\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{ab}+(\mathbf{x}_b - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{bb} \end{pmatrix}^{\text{T}} \begin{pmatrix} \mathbf{x}_{a} - \boldsymbol{\mu}_a \\ \mathbf{x}_b - \boldsymbol{\mu}_b \end{pmatrix} \\[5pt] &= -\frac{1}{2} \left\{ ((\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{aa}+(\mathbf{x}_b - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{ba})(\mathbf{x}_{a} - \boldsymbol{\mu}_a)+((\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{ab}+(\mathbf{x}_b - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{bb})(\mathbf{x}_b - \boldsymbol{\mu}_b ) \right\} \\[5pt] &=-\frac{1}{2}(\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{aa}(\mathbf{x}_{a} - \boldsymbol{\mu}_a) -\frac{1}{2}(\mathbf{x}_{a} - \boldsymbol{\mu}_a)^{\text{T}}\boldsymbol{\Lambda}_{ab}(\mathbf{x}_{b} - \boldsymbol{\mu}_b) \\ &\quad -\frac{1}{2}(\mathbf{x}_{b} - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{ba}(\mathbf{x}_{a} - \boldsymbol{\mu}_a) -\frac{1}{2}(\mathbf{x}_{b} - \boldsymbol{\mu}_b)^{\text{T}}\boldsymbol{\Lambda}_{bb}(\mathbf{x}_{b} - \boldsymbol{\mu}_b) \end{align} \tag{2.70} $$์ ์์ ๋ค๋ณ์ ์ ๊ท๋ถํฌ ํ๋ฅ ๋ฐ๋ํจ์์ ์ง์ํจ์ ๋ถ๋ถ์์ ๋ณ์๋ฅผ $\mathbf{x}_a$, $\mathbf{x}_b$๋ก ๊ฐ๋ผ์ ์ ๊ฐํ๊ฒ์ด๋ค. ๋ฑ์์ด ๊ณ์ ์ฑ๋ฆฝํ๊ธฐ ๋๋ฌธ์ ๊ฐ๋ผ์ ์ ๊ฐํด๋ ์ ๋ชจ์๋ง ๋ฌ๋ผ์ง ๋ฟ ์ฌ์ ํ ์ฒ์ ๋ค๋ณ์ ์ ๊ท๋ถํฌ ํ๋ฅ ๋ฐ๋ํจ์์ ๋๊ฐ์ ํจ์๋ค. ์ ์์ ์ ๊ฐํ๋๊ฒ ์ค์ํ๊ฒ ์๋๋ผ ์ ์์์๋ถํฐ ์์ ์ ๊ณฑ ํ ํฌ๋์ ์จ์ ์กฐ๊ฑด๋ถ ๋ค๋ณ์ ํ๋ฅ ๋ฐ๋ํจ์๋ฅผ ์ ๋ํ๋๋ฐ๋ ๋ช๊ฐ์ง ์๊ฐํด์ผํ ์ ์ด ์๋๋ฐ ๊ทธ๊ฒ๋ค์ ์์ ํ ์ดํดํ๋๊ฒ ์ค์ํ๋ค.
์ฐ์ $p(\mathbf{x}) = p(\mathbf{x}_a, \mathbf{x}_b)$๋ฅผ ์๊ฐํด๋ณด์. ์ต์ด์ $D$์ฐจ์ ๋ฒกํฐ๋ณ์๋ฅผ ๊ฐ์ง๋ $p(\mathbf{x})$๊ฐ ์๋ค. ์ด ๋ฒกํฐ๋ณ์๋ฅผ $D_a$, $D_b$์ฐจ์์ผ๋ก ๋๋ ์ ๊ฐ๊ฐ $\mathbf{x}_a$, $\mathbf{x}_b$๋ก ๋ณด๋ ๊ฒ์ด๋ค. ์ฌ๊ธฐ์ $D=D_a + D_b$์ด๋ค. ์ด๋ฐ ๊ด์ ์์ ๋ณด๋ฉด ์ต์ด $p(\mathbf{x})$๋ $D$์ฐจ์ ๋ฒกํฐ๋ณ์์ ๋ํ ํ๋ฅ ๋ฐ๋ํจ์๊ฐ ๋๊ณ $p(\mathbf{x}_a, \mathbf{x}_b)$๋ $D_a$, $D_b$์ฐจ์์ ๊ฐ์ง๋ ๋ฒกํฐ๋ณ์ $\mathbf{x}_a$, $\mathbf{x}_b$์ ๋ํ ๊ฒฐํฉํ๋ฅ ๋ฐ๋ํจ์๊ฐ ๋๋ค. ํจ์๊ฐ ๋ฐ๋๊ฒ์ ์๋ฌด๊ฒ๋ ์๊ณ ์๋ ๊ทธ ํจ์์ธ๋ฐ ๋ณด๋ ์๊ฐ์ ๋ฐ๋ผ ๊ทธ๋ ๊ฒ ๋ณผ ์ ์๋ ๊ฒ์ด๋ค. ์ด๋ค ๋ ํ๋ฅ ๋ณ์์ ๊ฒฐํฉํ๋ฅ ์ ์ฐจ์์ด ๋ ํฐ, ๋ค์๋งํด ๋ ํ๋ฅ ๋ณ์์ ์ฐจ์์ ๋ํ ์ฐจ์์ ๊ฐ์ง๋ ํ๋ฅ ๋ณ์์ ํ๋ฅ ๋ถํฌ๋ก ๋ณด๋ ๊ฒ์ด๋ค. ์ด๋ฅผ ์ญ์ผ๋ก ์ด์ผ๊ธฐํด๋ณด๋ฉด ์ด๋ค ํฐ ์ฐจ์์ ๊ฐ์ง๋ ํ๋ฅ ๋ณ์์ ํ๋ฅ ๋ฐ๋ํจ์๋ฅผ ์์ ์ฐจ์์ ๊ฐ์ง๋ ๋ ํ๋ฅ ๋ณ์์ ๊ฒฐํฉํ๋ฅ ๋ฐ๋ํจ์๋ก ๋ณด๋๊ฒ์ด๋ค. ๊ทธ๋ ๊ฒ ๋ณด๋ฉด ๊ฒฐํฉํ๋ฅ ๋ถํฌ๋ฅผ $p(\mathbf{x}_a \cap \mathbf{x}_b)$๋ก ์ฐ๋ ๊ฒ๋ณด๋ค $p(\mathbf{x}_a , \mathbf{x}_b)$๋ก ์ฐ๋ ๊ฒ์ด ํจ์ฌ ์๋ฏธ๊ฐ ์ ์ ๋ฌ๋๋ค๊ณ ํ ์ ์๋ค. ์ฌ๋ฌ ํ๋ฅ ๋ณ์์ ๊ฒฐํฉํ๋ฅ ๋ถํฌ๋ผ๋ ๊ฒ์ ๊ทธ๋ฅ ๊ทธ ๋ณ์๋ค๋ก ์ ์๋ ๋ค๋ณ์ ์ค์นผ๋ผ ํจ์์ด๊ธฐ ๋๋ฌธ์ด๋ค. ๋จ, ์กฐ๊ฑด์ ์ ์์ญ์์ ์ ๋ถ์ด 1์ด๋๋ ๊ฒ์ด๋ค. ๋ณ์๋ค์ ๊ฐ์ด ๊ฒฐ์ ๋๋ฉด ํจ์๊ฐ์ด ๊ฒฐ์ ๋๋ ํ์์ ํ๋ฅ ์ ์ธ ์ฌ๊ฑด์ผ๋ก ํด์ํ๋ฉด ๊ฐ๊ฐ์ ์ฌ๊ฑด์ ์๋ฏธํ๋ ์ฌ๋ฌ ๋ณ์๋ค์ ๊ฐ์ด ๊ฒฐ์ ๋์ด ๊ทธ ์ฌ๊ฑด๋ค์ด ๋์์ ์ผ์ด๋ฌ๋ค๋ ์๋ฏธ๊ฐ ๋๋ค.
import numpy as np
# x๋ 4์ฐจ์ ๋ฒกํฐ x_a 2์ฐจ์๋ฒกํฐ, x_b 2์ฐจ์๋ฒกํฐ๋ก ๋ถํด
# x 10๊ฐ๋ฅผ ๋ฌด์์๋ก ์์ฑ
X = np.random.randint(10, size=(4,10))
# 10๊ฐ ๋ฒกํฐ์ ํ๊ท ๋ฒกํฐ
mu = X.mean(axis=1).reshape(-1,1)
# x_a, x_b๋ก ๋๋ ์ ๊ฐ๊ฐ ํ๊ท ์ ๊ตฌํ ๋ฒกํฐ
mu_a = X[0:2,:].mean(axis=1).reshape(-1,1)
mu_b = X[2:,:].mean(axis=1).reshape(-1,1)
print("DATA")
print(X)
print("\n")
print("MEAN")
print(mu)
print("\n")
#๊ฒฐ๊ณผ๋ ๊ทธ๋ฅ ํ๊ท ๋ฒกํฐ๋ฅผ 2๊ฐ๋ก ์ชผ๊ฐ ๊ฒ๊ณผ ๊ฐ๋ค.
print("MEAN Xa")
print(mu_a)
print("MEAN Xb")
print(mu_b)
print("\n")
print("COV MATRIX")
print(np.cov(X)) #Sigma
print("\n")
print("COV MATRIX aa")
print(np.cov(X[:2,:])) #Sigma_aa
print("\n")
print("COV MATRIX bb")
print(np.cov(X[2:,:])) #Sigma_bb
print("\n")
DATA [[8 2 1 3 2 9 7 7 4 0] [3 1 5 9 3 4 9 5 8 9] [3 8 6 5 4 3 0 1 9 3] [0 2 7 8 2 8 6 5 6 4]] MEAN [[ 4.3] [ 5.6] [ 4.2] [ 4.8]] MEAN Xa [[ 4.3] [ 5.6]] MEAN Xb [[ 4.2] [ 4.8]] COV MATRIX [[ 10.23333333 -1.2 -4.62222222 0.62222222] [ -1.2 8.71111111 -1.68888889 4.57777778] [ -4.62222222 -1.68888889 8.17777778 -0.06666667] [ 0.62222222 4.57777778 -0.06666667 7.51111111]] COV MATRIX aa [[ 10.23333333 -1.2 ] [ -1.2 8.71111111]] COV MATRIX bb [[ 8.17777778 -0.06666667] [-0.06666667 7.51111111]]
์ ์ฝ๋๋ 4์ฐจ์ ๋ฒกํฐ๋ฅผ 2์ฐจ์ 2๊ฐ๋ก ๊ฐ๊ฐ ๋๋ ์ ์คํ์ ํด ๋ณธ ๊ฒ์ด๋ค. ๋ฐ์ดํฐ๋ฅผ 2์ฐจ์์ผ๋ก ๋๋ ์ ๊ตฌํ ํ๊ท ๋ฒกํฐ์ ๊ณต๋ถ์ฐํ๋ ฌ์ด ์๋ ๋ฐ์ดํฐ์ ๋ํ ํ๊ท ๋ฒกํฐ์ ๊ณต๋ถ์ฐํ๋ ฌ์ ๋ถ๋ถ๊ณผ ๊ฐ์๊ฒ์ ํ์ธํ ์ ์๋ค.
ํํธ ๊ตฌํ๊ณ ์ถ์ ๊ฒ์ ์กฐ๊ฑด๋ถ ํ๋ฅ ๋ฐ๋ํจ์ $p(\mathbf{x}_a \mid \mathbf{x}_b)$์ธ๋ฐ ์ฌ๊ธฐ์ $\mathbf{x}_b$๋ ๊ด์ฐฐ๋ ์ฆ๊ฑฐ ๋๋ ์ฃผ์ด์ง ์กฐ๊ฑด์ด๋ฏ๋ก ๋ณ์๊ฐ ์๋๋ค. ์ฆ ์กฐ๊ฑด๋ถ ํ๋ฅ ๋ฐ๋ํจ์๋ $D_a$์ฐจ์์ ๋ณ์๋ฅผ ๊ฐ์ง๋ ์ค์นผ๋ผํจ์๊ฐ ๋๋ค. ๋ฒ ์ด์ฆ์ ๋ฆฌ์ ์ํด
$$ p(\mathbf{x}_a \mid \mathbf{x}_b) = \frac{p(\mathbf{x}_a , \mathbf{x}_b)}{p(\mathbf{x}_b)} \tag{1} $$์กฐ๊ฑด๋ถ ํ๋ฅ ๋ฐ๋ํจ์๋ ๊ฒฐํฉ ํ๋ฅ ๋ฐ๋ํจ์ $p(\mathbf{x}_a ,\mathbf{x}_b)$๋ฅผ $p(\mathbf{x}_b)$๋ก ๋๋ ๊ฒ์ด๋ค.
์ฒซ์งธ $p(\mathbf{x}_a \mid \mathbf{x}_b)$๊ฐ ์ ๊ทํ๋ ๊ฐ์ฐ์์์ด ๋๋์ง ์๊ฐํด๋ณด์. $p(\mathbf{x}_a,\mathbf{x}_b)$๋ ์ด์ผ๊ธฐํ๊ฒ์ฒ๋ผ ๋ค๋ณ์ ์ ๊ท๋ถํฌํจ์์ด๋ฏ๋ก ์ง์ํจ์ ๋ถ๋ถ ์(2.70)์ ๋ค ์ ๋ฆฌํด์ $\mathbf{x}_a$๋ฅผ ์ ์ธํ ๋๋จธ์ง ๋ถ๋ถ์ ๋ณ๋์ ์ง์ํญ์ ๊ณฑ์ผ๋ก ์ฐ๋ฉด
$$ p(\mathbf{x}_a , \mathbf{x}_b) = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} \exp(\color{RoyalBlue}{\textit{remainder}}) \cdot \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a}) \tag{2} $$์ฒ๋ผ ๋๋ค. ์ฃผ๋ณํ๋ฅ ๋ถํฌ $p(\mathbf{x}_b)$์ ์(3)๊ณผ ๊ฐ๋ค.
$$ p(\mathbf{x}_b) = \int p(\mathbf{x}_a , \mathbf{x}_b) \text{d}\mathbf{x}_a \tag{3} $$์(2)์ ์(3)์ ์ด์ฉํด์ ์(1)์ ์ ๊ฐํด๋ณด๋ฉด
$$ \begin{align} p(\mathbf{x}_a \mid \mathbf{x}_b) &= \frac{p(\mathbf{x}_a , \mathbf{x}_b)}{p(\mathbf{x}_b)} \\[5pt] &= \frac{p(\mathbf{x}_a , \mathbf{x}_b)}{\int p(\mathbf{x}_a , \mathbf{x}_b) \text{d}\mathbf{x}_a} \\[5pt] &= \frac{\dfrac{1}{(2 \pi)^{D/2}}\dfrac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp(\color{RoyalBlue}{\textit{remainder}}) \cdot \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a}) }{\int \dfrac{1}{(2 \pi)^{D/2}}\dfrac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp(\color{RoyalBlue}{\textit{remainder}}) \cdot \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a})\text{d}\mathbf{x}_a } \\[5pt] &= \frac{\dfrac{1}{(2 \pi)^{D/2}}\dfrac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp(\color{RoyalBlue}{\textit{remainder}}) \cdot \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a}) }{\dfrac{1}{(2 \pi)^{D/2}}\dfrac{1}{|\boldsymbol{\Sigma}|^{1/2}} \exp(\color{RoyalBlue}{\textit{remainder}}) \int \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a})\text{d}\mathbf{x}_a } \\[5pt] &= \frac{\exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a})}{\int \exp(\color{Orchid}{\textit{quadratic and linear terms of }\mathbf{x}_a})\text{d}\mathbf{x}_a } \end{align} \tag{4} $$๊ฐ ๋๋๋ฐ ์ ์์ ์ง์ํญ์ 2์ฐจ์์ด ์๋ ํจ์๋ฅผ ์ ๋ถํด์ ๋๋๊ณ ์๋ ํํ๊ฐ ๋๋ค. ๋ฐ๋ผ์ $p(\mathbf{x}_a \mid \mathbf{x}_b) $์ ์ ๋ถํ๋ฉด 1๋๋ ๊ฒ์ ์ ์ ์๋ค. $p(\mathbf{x}_a \mid \mathbf{x}_b) $์ $\mathbf{x}_a$์ ๋ํ 2์ฐจ์์ ์ง์ํญ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ ์ ๋ถํ๋ฉด 1์ด ๋๋ ํจ์์ธ๋ฐ ์ด๋ ๊ณง ์ ๊ท๋ถํฌ ํจ์์์ ์๋ฏธํ๋ค.
๋์งธ๋ก $p(\mathbf{x}_a \mid \mathbf{x}_b)$์ ์์ ํ ๋ชจ์ต์ ๊ตฌํ๊ธฐ ์ํด์๋ ์(3)์ ๊ณ์ฐํด์ผ ํ๋๋ฐ ์ค์ ์(3)์ ์ ๋ถํด์ ๋๋๋๊ฒ์ ์ฝ์ง ์๋ค. ํ์ง๋ง ์ด์ $p(\mathbf{x}_a \mid \mathbf{x}_b)$๊ฐ ์ ๊ท๋ถํฌ์ธ๊ฒ์ ์๊ณ ์๊ธฐ ๋๋ฌธ์ ํ๊ท ๊ณผ ๊ณต๋ถ์ฐํ๋ ฌ๋ง ์๋ฉด ๋๋ค. ๊ทธ๋์ ์ ๋ถํ๊ณ ๋๋๋ ๊ณ์ฐ์ ์ง์ ํ์ง ์๊ณ ์ง์ํญ ๋ถ๋ถ์ ์ผ๋ฐ์ ์ธ ๋ค๋ณ์ ์ ๊ท๋ถํฌํจ์๋ฅผ ์ ๊ฐํ๊ฒ๊ณผ ๊ณ์ ๋น๊ตํ๋ ๋ฐฉ๋ฒ์ ํตํด ํ๊ท ๊ณผ ๊ณต๋ถ์ฐ ํ๋ ฌ๋ง ์์๋ด๋ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ค. ๊ทธ ๊ณผ์ ์ด (2.71)~(2.75)๊น์ง ๊ณผ์ ์ด๋ค.
์ง๊ธ๊น์ง ์ด์ผ๊ธฐํ ๋ด์ฉ์ ๊ทธ๋ฆผ์ ํตํด ์ง๊ด์ ์ผ๋ก ์ดํดํ๊ธฐ ์ํด ์๋ ์คํ์ฝ๋๋ก ๊ทธ๋ฆผ์ ๊ทธ๋ ค๋ดค๋ค.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams["figure.figsize"] = (15, 15)
delta = 0.05
x = np.arange(-5.0, 5.0, delta)
y = np.arange(-5.0, 5.0, delta)
xx, yy = np.meshgrid(x, y)
given_y = -2
given_yv = np.ones(yy.shape[0])*given_y #๊ฐ์ y๊ฐ
np.random.seed(14)
MU = np.random.rand(2)
MU[1] *= -1
M = np.random.rand(4).reshape(2,2)
COV = (M + M.T)/2
COV[0,1] += 0.6
COV[1,0] += 0.6
COV[1,1] += 0.6
# p(x,y)
Z = mlab.bivariate_normal(xx, yy, sigmax=np.sqrt(COV[0,0]),
sigmay=np.sqrt(COV[1,1]),
mux=MU[0],
muy=MU[1],
sigmaxy=COV[0,1])
# p(x, y=-2)
# y = -2๋ก ๊ฐ์ ์ ๋ถ ๋ง๋ค์ด ๋ ์ฌ๊ธฐ์ Z2๋ NxN์ธ๋ฐ ํ์ด ์๋ก ๋ค ๊ฐ์
# ์ฆ ํํ์ p(x, y=-2)๊ฐ์ด ๋ค ๋ด๊ฒจ์์
Z2 = mlab.bivariate_normal(xx, given_yv, sigmax=np.sqrt(COV[0,0]),
sigmay=np.sqrt(COV[1,1]),
mux=MU[0],
muy=MU[1],
sigmaxy=COV[0,1])
# Marginal distribution p(x), p(y)
Nx = 1/np.sqrt(2*np.pi*COV[0,0]) * np.exp(-1/(2*COV[0,0]) * (x - MU[0])**2 )
Ny = 1/np.sqrt(2*np.pi*COV[1,1]) * np.exp(-1/(2*COV[1,1]) * (y - MU[1])**2 )
# p(y = given_y)
N_given_y = 1/np.sqrt(2*np.pi*COV[1,1]) * np.exp(-1/(2*COV[1,1]) * (given_y - MU[1])**2 )
# conditional dist. p(x | y=-2)
Zx_given_y = Z2 / N_given_y
fig = plt.figure()
#์ข์๋จ
ax1 = fig.add_subplot(2, 2, 1)
CS = ax1.contour(xx, yy, Z)
ax1.plot(x, given_yv, color=style_colors[1])
ax1.set_xlabel(r'$x-axis$', fontsize=15)
ax1.set_ylabel(r'$y-axis$', fontsize=15)
ax1.axis('square')
#์ฐ์๋จ
ax2 = fig.add_subplot(2, 2, 2, sharex=ax1, sharey=ax1)
rs = np.random.RandomState(10)
x1, x2 = rs.multivariate_normal(MU, COV, 500).T
ax2.scatter(x1, x2, color=style_colors[4], s=80, edgecolors="#FFFFFF", linewidth=1, alpha=0.7)
#์ขํ๋จ
ax3 = fig.add_subplot(2, 2, 3, projection='3d')
ax3.plot_wireframe(xx, yy, Z, rstride=15, cstride=0, alpha=0.3)#, colors="#348ABD")
ax3.plot_surface(xx, yy, Z, rcount=150, antialiased=True, alpha=0.3)
ax3.plot(x, given_yv, Z2[0], alpha=0.8, color=style_colors[1]) #p(x,y=const)
ax3.contour(xx, yy, Z, zdir='z', offset=-0.01, alpha=0.2)
ax3.plot(x, ax2.get_ylim()[1].repeat(x.shape), Nx, color=style_colors[0])
ax3.plot(ax2.get_xlim()[0].repeat(y.shape), y, Ny, color=style_colors[2])
ax3.set_xlabel(r'$x-axis$ ', fontsize=15)
ax3.set_ylabel(r'$y-axis$', fontsize=15)
ax3.set_zlabel(r'$p(x,y)-axis$', fontsize=15)
ax3.text(1.7, ax2.get_ylim()[1], 0.3, r'$p(x)$', color=style_colors[0], zdir='x', fontsize=15)
ax3.text(ax2.get_xlim()[0], 1.5, 0.3, r'$p(y)$', color=style_colors[2], zdir='y', fontsize=15)
#์ฐํ๋จ #ax3.set_ylim(ax2.get_zlim())
ax4 = fig.add_subplot(2, 2, 4)
ax4.plot(x, Nx, label=r"$p(x)$", color=style_colors[0])
ax4.plot(y, Ny, label=r"$p(y)$", color=style_colors[2])
ax4.plot(x, Z2[0], label=r"$p(x,y={})$".format(given_y), color=style_colors[1])
ax4.plot(x, Zx_given_y[0], label=r"$p(x \mid y={})$".format(given_y), color=style_colors[3])
ax4.plot(given_y, N_given_y, 'ro')
ax4.text(-5, 0.25, "Marginal likelihood", color='black', fontdict={ 'size': 12, })
ax4.arrow(-2, 0.2, -1, 0.04, head_width=0.001, head_length=0.02, fc='k', ec='k')
legend = ax4.legend(loc='upper right',fontsize=15)
plt.show()
print('mean of p(x, y)')
print(MU)
print('\n')
print('cov of p(x, y)')
print(COV)
print('\n')
print("p(y={})={:f}".format(given_y, N_given_y))
print("Integration p(x) = {:f}".format(np.trapz(Nx, x=x)))
print("Integration p(y) = {:f}".format(np.trapz(Ny, x=x)))
print("Integration p(x,y={}) = {:f}".format(given_y, np.trapz(Z2[0], x=x)))
print("Integration p(x|y={}) = p(x,y={})/p(y={}) = {:f}".format(given_y, given_y, given_y, np.trapz(Zx_given_y[0], x=x)))
mean of p(x, y) [ 0.51394334 -0.77316505] cov of p(x, y) [[ 0.87042769 0.75889144] [ 0.75889144 1.55760374]] p(y=-2)=0.197174 Integration p(x) = 0.999999 Integration p(y) = 0.999644 Integration p(x,y=-2) = 0.197174 Integration p(x|y=-2) = p(x,y=-2)/p(y=-2) = 1.000000
์ ๊ทธ๋ฆผ์ ํ๋ฆฐํธ ์ ๋ณด์ ๋์จ ํ๊ท ๋ฒกํฐ์ ๊ณต๋ถ์ฐํ๋ ฌ๋ก ์ ์๋๋ 2๋ณ์ ์ ๊ท๋ถํฌ๋ฅผ ์ฌ์ฉํ์ฌ ๊ทธ๋ ค์ง๊ฒ์ด๋ค.
$$ \boldsymbol{\mu} = (0.51394334, -0.77316505)^{\text{T}} $$$$ \boldsymbol{\Sigma} = \begin{bmatrix} 0.87042769 & 0.75889144 \\ 0.75889144 & 1.55760374 \end{bmatrix} $$์คํ์์๋ ๊ทธ๋ฆผ์ ๊ทธ๋ฆฌ๊ธฐ์ํด $D=2$๋ก ๋์์ผ๋ฉฐ $\mathbf{x}_a$, $\mathbf{x}_b$๋ $x$, $y$๋ก ์ค์นผ๋ผ๊ฐ ๋๋ค.
๊ณต๋ถ์ฐ ํ๋ ฌ์ ์ฃผ๋๊ฐ์์๋ฅผ ์ ์ธํ ์์๊ฐ 0์ด ์๋๋ผ์ ๋ฑ๊ณ ์ ์ด $x$, $y$์ถ์ ์ ๋ ฌ๋์ง ์๊ณ ๋นํ์ด์ ธ ์๋๊ฒ์ ํ์ธํ ์ ์๋ค. ์ด ํจ์์์ $y$=-2๋ก ๊ณ ์ ํ ๋นจ๊ฐ์ ์ ์ ๋ฐ๋ผ ๊ทธ๋ํ๋ฅผ ์ ํํ๋ฉด ๋๋ฒ์งธ ๊ทธ๋ฆผ์์ ๋ณด์ด๋ ๋นจ๊ฐ์ ์ข ๋ชจ์ ๊ทธ๋ํ $p(x, y=-2)$๊ฐ ๋๋ค. ์ธ๋ฒ์งธ ๊ทธ๋ฆผ์์ ์ข ๋ ์ ํํ๊ฒ ๋นจ๊ฐ์ ๊ทธ๋ํ๋ฅผ ํ์ธํ ์ ์๋ค. ์ด ํจ์๋ $p(x \mid y=-2)$์ด ์๋๋ผ $p(x , y=-2)$์ด๋ค. ๊ฒฐํฉ ํ๋ฅ ๋ฐ๋ํจ์์์ ํ๋์ ๋ณ์๋ง ํน์ ์์๋ก ๊ณ ์ , ๋ค์๋งํด ์ฃผ์ด์ง ๊ฒ์ด๊ธฐ ๋๋ฌธ์ด๋ค. $p(x \mid y=-2)$์ด ๋๋ ค๋ฉด ๋ฒ ์ด์ฆ์ ๋ฆฌ์ ์ํด ์ด ๊ทธ๋ํ๋ฅผ $p(y=-2)$๋ก ๋๋์ด์ผ ํ๋ค. ์ธ๋ฒ์งธ ๊ทธ๋ฆผ์ ๋นจ๊ฐ์ ๊ทธ๋ํ๋ฅผ ๋นจ๊ฐ์ ์ ๊ฐ์ผ๋ก ๋๋๋ฉด ๋ น์๊ทธ๋ํ๊ฐ ๋๊ณ ํ๋ก๊ทธ๋จ ์ถ๋ ฅ์ ํ์ธํด๋ณด๋ฉด ์ด ๋ น์ ๊ทธ๋ํ์ ์ ๋ถ์ 1์ด ๋์ด ํ๋ฅ ๋ฐ๋ํจ์์์ ์ ์ ์๋ค. ์กฐ๊ฑด๋ถ ํ๋ฅ ๋ฐ๋ํจ์๊ฐ ๋๋ ๊ฒ์ด๋ค.
๋ง์ฝ ๊ณต๋ถ์ฐ ํ๋ ฌ์ด ์ฃผ๋๊ฐ ํ๋ ฌ์ด๋ฉด $p(x , y)$์ $x$, $y$ ์ถ์ ์ ๋ ฌ๋๊ณ $p(x , y)=p(x)p(y)$์ด๋ค. ์ด ๊ฒฝ์ฐ๋ $p(x) = p(x \mid y=-2)$์ด ๋์ด ๋ ํ๋ฅ ๋ถํฌ๋ ๋ ๋ฆฝ์ด๋ผ๋ ๊ฒฐ๋ก ๊ณผ ํฉ์นํ๊ฒ ๋๋ค.
๊ณ์ ๋น๊ต๋ฅผ ํด์ $p(x \mid y)$์ ํ๊ท ๋ฒกํฐ์ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ๊ตฌํ๊ธฐ ์ํด ๋ณดํต์ ๋ค๋ณ์ ์ ๊ท๋ถํฌ์ ์ง์ํจ์๋ถ๋ถ์ ์ ๊ฐํด๋ณด๋ฉด
$$ -\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^{\text{T}}\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu}) = -\frac{1}{2}\mathbf{x}^{\text{T}}\boldsymbol{\Sigma}^{-1}\mathbf{x} + \mathbf{x}^{\text{T}}\boldsymbol{\Sigma}^{-1}\boldsymbol{\mu} + \text{const} \tag{2.71} $$์ด ๋๋ฏ๋ก ์ด์ ์(2.70)์ ๋น๊ตํ๋ฉด ํ๊ท ๋ฒกํฐ์ ๊ณต๋ถ์ฐํ๋ ฌ์ ๊ตฌํ ์ ์๋ค.
์(5)์ ๊ฒฐํฉ ํ๋ฅ ๋ฐ๋ํจ์ $p(\mathbf{x})$์ ์ง์ํจ์ ๋ถ๋ถ์ ์ ๊ฐํ ์(2.70)์ ์์ ํ ์ ๊ฐํ ๊ฒ์ด๋ค. ๋ถํ์ $\mathbf{x}_a$์ ๋ํ 2์ฐจํญ์ ์(2.71)์ 2์ฐจํญ๊ณผ ๋น๊ตํ์ฌ
$$ \boldsymbol{\Sigma}_{a|b} = \boldsymbol{\Lambda}_{aa}^{-1} \tag{2.73} $$์ ๋ฐ๋ก ๋ณด์ผ ์ ์๋ค. ๊ทธ๋ฆฌ๊ณ ํ๋์ 1์ฐจํญ๋ง ๋ชจ์ผ๋ฉด
$$ \begin{align} &\color{RoyalBlue}{\mathbf{x}_a^{\text{T}} \left(\frac{1}{2} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a +\frac{1}{2} \boldsymbol{\Lambda}_{aa}^{\text{T}} \boldsymbol{\mu}_a -\frac{1}{2} \boldsymbol{\Lambda}_{ab} \mathbf{x}_b +\frac{1}{2} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b -\frac{1}{2} \boldsymbol{\Lambda}_{ba}^{\text{T}} \mathbf{x}_b { +\frac{1}{2} \boldsymbol{\Lambda}_{ba}^{\text{T}} \boldsymbol{\mu}_b } \right)} \\[5pt] &= \mathbf{x}_a^{\text{T}} \left(\boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a -\frac{1}{2}(\boldsymbol{\Lambda}_{ab}+\boldsymbol{\Lambda}_{ba}^{\text{T}}) \mathbf{x}_b +\frac{1}{2}(\boldsymbol{\Lambda}_{ab}+\boldsymbol{\Lambda}_{ba}^{\text{T}})\boldsymbol{\mu}_b \right) \qquad \because \boldsymbol{\Lambda}_{aa}=\boldsymbol{\Lambda}_{aa}^{\text{T}} \\[5pt] &= \mathbf{x}_a^{\text{T}} \left(\boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a -\frac{1}{2}(\boldsymbol{\Lambda}_{ab}+\boldsymbol{\Lambda}_{ba}^{\text{T}})(\mathbf{x}_b -\boldsymbol{\mu}_b) \right) \qquad \because \boldsymbol{\Lambda}_{ba}^{\text{T}}=\boldsymbol{\Lambda}_{ab} \\[5pt] &= \mathbf{x}_a^{\text{T}} \left\{ \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a - \boldsymbol{\Lambda}_{ab}(\mathbf{x}_b -\boldsymbol{\mu}_b) \right\} \end{align} \tag{2.74} $$์ด ๋๊ณ ์ด ์(2.74)๋ฅผ ์(2.71)ํ๊ณ ๋น๊ตํ๋ฉด ์(2.75)๋ฅผ ๋ณด์ผ ์ ์๋ค.
$$ \boldsymbol{\mu}_{a|b} = \boldsymbol{\Sigma}_{a|b} \left\{ \boldsymbol{\Lambda}_{aa}\boldsymbol{\mu}_a - \boldsymbol{\Lambda}_{ab}(\mathbf{x}_b-\boldsymbol{\mu}_b) \right\} = \boldsymbol{\mu}_{a} - \boldsymbol{\Lambda}_{aa}^{-1} \boldsymbol{\Lambda}_{ab}(\mathbf{x}_b - \boldsymbol{\mu}_{b}) \tag{2.75} $$์(2.75)๋ฅผ ๋ณด๋ฉด ํ๊ท ๋ฒกํฐ๊ฐ $\mathbf{x}_a$์ ์์กดํ์ง ์๊ณ $\mathbf{x}_b$์๋ง ์ ํ์ ์ผ๋ก ์์กดํ๋ ๊ฒ์ ์ ์ ์๋ค. ์ด๋ ๊ทธ๋ฆผ์ผ๋ก๋ ํ์ธํ ์ ์๋ค. ์ ๊ทธ๋ฆผ์์ ๋ น์ ๊ทธ๋ํ๋ ๋นจ๊ฐ์ ๊ทธ๋ํ๋ฅผ ์ค์ผ์ผํ๊ฒ์ด๋ผ ํ๊ท ์ด ๋ณํ์ง ์๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋นจ๊ฐ์ ๊ทธ๋ํ๋ฅผ $p(x , y)$๋ก ๋ถํฐ ์๋ผ๋ผ ๋ ์ด๋ ์์น์์ ์๋ผ๋ด๋๊ฐ ํ๋ ๊ฒ์ $y$์ ์์น์ ์ํด ๊ฒฐ์ ๋๋ค. ๋๋ฌธ์ $p(x \mid y)$์ ๋ชจ๋mode ์์น๋ $y$์ถ์์ ์ด๋๋ฅผ ์ ํํ์ฌ ์๋ฅด๋๊ฐ์๋ง ์์กดํ๋ค๋ ๊ฒ์ ์ง๊ด์ ์ผ๋ก ์ ์ ์๋ค. ์กฐ๊ฑด๋ถ ํ๋ฅ๋ถํฌ์ ํ๊ท ์ด ์กฐ๊ฑด์ผ๋ก ์ฃผ์ด์ง ํ๋ฅ ๋ณ์ $y$์ ์ ํ๊ด๊ณ์ ์๊ณ , ๊ณต๋ถ์ฐ์ด $x$์ ๋ ๋ฆฝ์ผ๋ ์ด๋ฐ ๊ฒฝ์ฐ๋ฅผ ์ ํ ๊ฐ์ฐ์์ ๋ชจ๋ธlinear gaussian model์ด๋ผํ๋ค. ์ด๋ ๊ฒ ๊ตฌ์ฑ๋ $p(x)$, $p(x \mid y)$๋ฅผ ์ ๋ $p(y)$, $p(y \mid x)$๋ฅผ ๊ตฌํ๋ ๋ด์ฉ์ด 2.3.3์ ์ ๋์จ๋ค.
์(2.73), (2.75)๋ ์ ๋ฐ๋ ํ๋ ฌ๋ก ํํ๋๋๋ฐ ์ด๋ฅผ ๊ณต๋ถ์ฐ ํ๋ ฌ๋ก ํํํ๋ ค๋ฉด ํ๋ ฌ์ ๋ํ ๋ช๊ฐ์ง ์ ๋ฆฌ๊ฐ ํ์ํ๋ค. ์ฐจ๋ก๋๋ก ์ดํด๋ณธ๋ค.
์ ์ฒ๋ผ ํ๋ ฌ๋ก ๋ถํด๋ ํ๋ ฌ์ ์ญํ๋ ฌ์ ๊ตฌํ๊ธฐ ์ํด ์๋ค์ ์ ๋นํ ํ๋ ฌ์ ๊ณฑํด์ ๋๊ฐํ๋ ฌ๋ก ๋ง๋ ๋ค. ์๋ํ๋ฉด ๋๊ฐํ๋ ฌ์ ์ญํ๋ ฌ์ ์ฃผ๋๊ฐ ์์์ ์ญ์๋ฅผ ์ทจํจ์ผ๋ก ์ฝ๊ฒ ๋ง๋ค ์ ์๊ธฐ ๋๋ฌธ์ด๋ค.[1],[2]
์ด์ $\mathbf{W}$์ ์ญํ๋ ฌ์ ๊ตฌํ๋๊ฒ ๋ง์ผ๋ก ์ฃผ์ด์ง ํ๋ ฌ์ ์ญํ๋ ฌ์ ๊ตฌํ ์ ์๊ฒ ๋๋ค.
$$ (\mathbf{XYZ})^{-1} = \mathbf{W}^{-1} \\[5pt] \mathbf{Z}^{-1} \mathbf{Y}^{-1} \mathbf{X}^{-1} = \mathbf{W}^{-1} \\[5pt] \mathbf{Y}^{-1} = \mathbf{Z}\mathbf{W}^{-1}\mathbf{X} $$๋ฐ๋ผ์
$$ \begin{align} \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix}^{-1}&= \begin{bmatrix} \mathbf{I} & \mathbf{0} \\ -\mathbf{D}^{-1}\mathbf{C} & \mathbf{I} \end{bmatrix} \begin{bmatrix} (\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1} & \mathbf{0} \\ \mathbf{0} & \mathbf{D}^{-1} \end{bmatrix} \begin{bmatrix} \mathbf{I} & -\mathbf{B}\mathbf{D}^{-1} \\ \mathbf{0} & \mathbf{I} \end{bmatrix} \\[5pt] &=\begin{bmatrix} (\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1} & \mathbf{0} \\ -\mathbf{D}^{-1}\mathbf{C}(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1} & \mathbf{D}^{-1} \end{bmatrix} \begin{bmatrix} \mathbf{I} & -\mathbf{B}\mathbf{D}^{-1} \\ \mathbf{0} & \mathbf{I} \end{bmatrix}\\[5pt] &=\begin{bmatrix} \color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}} & \color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}}(-\mathbf{B}\mathbf{D}^{-1}) \\ -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}} & -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}}(-\mathbf{B}\mathbf{D}^{-1})+\mathbf{D}^{-1} \end{bmatrix} \\[5pt] &=\begin{bmatrix} \color{RoyalBlue}{\mathbf{M}} & -\color{RoyalBlue}{\mathbf{M}}\mathbf{B}\mathbf{D}^{-1} \\ -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{\mathbf{M}} & \mathbf{D}^{-1}+\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{\mathbf{M}}\mathbf{B}\mathbf{D}^{-1} \end{bmatrix} \end{align} \tag{2.76} $$์ฝ๊ฐ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก๋ ๊ฐ์ ๋ ผ๋ฆฌ๋ฅผ ์ ๊ฐํ ์ ์๋ค. ๋ค์ ๋ฐ๋ณตํด๋ณธ๋ค.
์ด์ $\mathbf{W}$์ ์ญํ๋ ฌ์ ๊ตฌํ๋๊ฒ ๋ง์ผ๋ก ์ฃผ์ด์ง ํ๋ ฌ์ ์ญํ๋ ฌ์ ๊ตฌํ ์ ์๊ฒ ๋๋ค.
$$ (\mathbf{XYZ})^{-1} = \mathbf{W}^{-1} \\[5pt] \mathbf{Z}^{-1} \mathbf{Y}^{-1} \mathbf{X}^{-1} = \mathbf{W}^{-1} \\[5pt] \mathbf{Y}^{-1} = \mathbf{Z}\mathbf{W}^{-1}\mathbf{X} $$๋ฐ๋ผ์
$$ \begin{align} \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix}^{-1}&= \begin{bmatrix} \mathbf{I} & -\mathbf{A}^{-1}\mathbf{B} \\ \mathbf{0} & \mathbf{I} \end{bmatrix} \begin{bmatrix} \mathbf{A}^{-1} & \mathbf{0} \\ \mathbf{0} & (-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} \end{bmatrix} \begin{bmatrix} \mathbf{I} & \mathbf{0} \\ -\mathbf{C}\mathbf{A}^{-1} & \mathbf{I} \end{bmatrix} \\[5pt] &=\begin{bmatrix} \mathbf{A}^{-1} & -\mathbf{A}^{-1}\mathbf{B}(-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} \\ \mathbf{0} & (-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} \end{bmatrix} \begin{bmatrix} \mathbf{I} & \mathbf{0} \\ -\mathbf{C}\mathbf{A}^{-1} & \mathbf{I} \end{bmatrix} \\[5pt] &=\begin{bmatrix} \mathbf{A}^{-1}-\mathbf{A}^{-1}\mathbf{B}(-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1}(-\mathbf{C}\mathbf{A}^{-1}) & -\mathbf{A}^{-1}\mathbf{B}(-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} \\ -\mathbf{C}\mathbf{A}^{-1}(-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} & (-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}+\mathbf{D})^{-1} \end{bmatrix} \\[5pt] &=\begin{bmatrix} \mathbf{A}^{-1}+\mathbf{A}^{-1}\mathbf{B}\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}}\mathbf{C}\mathbf{A}^{-1} & -\mathbf{A}^{-1}\mathbf{B}\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}} \\ -\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}}\mathbf{C}\mathbf{A}^{-1} & \color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}} \end{bmatrix} \end{align} \tag{2.76-1} $$ํนํ ์๊น๋ก ํ์๋ ๋ถ๋ถ์ ์ญํ๋ ฌ์ ์๋ ํ๋ ฌ์ ์์ด ๋ณด์ํ๋ ฌSchur complement [3]์ด๋ผ ํ๋ค.
์ ๋ ๊ฒฐ๊ณผ ์(2.76), (2.76-1)์ ๋น๊ตํ๋๊ฒ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ด ์์ด ๋ณด์ํ๋ ฌ๊ฐ์ ๊ด๊ณ๋ฅผ ๋ณด์ผ ์ ์๋ค.
$$ (\mathbf{A}+\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1} = \mathbf{A}^{-1}-\mathbf{A}^{-1}\mathbf{B}(\mathbf{D}+\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}\mathbf{C}\mathbf{A}^{-1} $$๋ ์์ ๊ฐ๊ฒ ๋๊ณ
$$ \begin{align} \boldsymbol{\Sigma}^{-1}&= \begin{bmatrix} \color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}} & \color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}}(-\mathbf{B}\mathbf{D}^{-1}) \\ -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}} & -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}}(-\mathbf{B}\mathbf{D}^{-1})+\mathbf{D}^{-1} \end{bmatrix} \\[5pt] &=\begin{bmatrix} \mathbf{A}^{-1}+\mathbf{A}^{-1}\mathbf{B}\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}}\mathbf{C}\mathbf{A}^{-1} & -\mathbf{A}^{-1}\mathbf{B}\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}} \\ -\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}}\mathbf{C}\mathbf{A}^{-1} & \color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}} \end{bmatrix}\\[5pt] &= \begin{bmatrix} \boldsymbol{\Lambda}_{aa} & \boldsymbol{\Lambda}_{ab} \\ \boldsymbol{\Lambda}_{ba} & \boldsymbol{\Lambda}_{bb} \end{bmatrix} \end{align} $$๊ฐ ์์๋ฅผ ๋น๊ตํ์ฌ ๋ค์์ ์ป๋๋ค.
$$ \boldsymbol{\Lambda}_{aa} = \color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}} = \mathbf{A}^{-1}+\mathbf{A}^{-1}\mathbf{B}\color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}}\mathbf{C}\mathbf{A}^{-1} $$$$ \boldsymbol{\Lambda}_{bb} = -\mathbf{D}^{-1}\mathbf{C}\color{RoyalBlue}{(\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1}}(-\mathbf{B}\mathbf{D}^{-1})+\mathbf{D}^{-1} = \color{RoyalBlue}{(\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B})^{-1}} $$๋ถ๋ถ ํ๋ ฌ $\mathbf{A}$, $\mathbf{B}$, $\mathbf{C}$, $\mathbf{D}$๊ฐ ๊ฐ๊ฐ n x n, n x m, m x n, m x n์ธ ํ๋ ฌ $\mathbf{M}$์ ๋ํด ๋ค์์ฒ๋ผ ์์ด ๋ณด์ํ๋ ฌ์ ํฌํจํ๋ ํ๋ ฌ๋ก ๋ถํด๊ฐ ๊ฐ๋ฅํ๋ค.
$$ \mathbf{M} = \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix}=\begin{bmatrix} \mathbf{A} & \mathbf{0} \\ \mathbf{C} & \mathbf{I}_m \end{bmatrix} \begin{bmatrix} \mathbf{I}_n & \mathbf{A}^{-1}\mathbf{B} \\ \mathbf{0} & \color{RoyalBlue}{\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}} \end{bmatrix} = \begin{bmatrix} \mathbf{I}_n & \mathbf{B} \\ \mathbf{0} & \mathbf{D} \end{bmatrix} \begin{bmatrix} \color{RoyalBlue}{\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C}} & \mathbf{0} \\ \mathbf{D}^{-1}\mathbf{C} & \mathbf{I}_m \end{bmatrix} $$๊ทธ๋ฆฌ๊ณ ํ๋ ฌ์์ ๋ํ
$$\det(\mathbf{AB}) = \det(\mathbf{A})\det(\mathbf{B})$$$$ \det\left( \begin{bmatrix} \mathbf{B} & \mathbf{0} \\ \mathbf{C} & \mathbf{D} \end{bmatrix} \right) = \det\left( \begin{bmatrix} \mathbf{B} & \mathbf{C} \\ \mathbf{0} & \mathbf{D} \end{bmatrix} \right) =\det(\mathbf{B})\det(\mathbf{D}) $$์ ๋ ์์ ์ ์ฉํ๋ฉด ๋ค์์ ๋ณด์ผ ์ ์๋ค.
$$ \det( \mathbf{M} ) = \det\left( \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix} \right) = \det(\mathbf{D}) \det(\color{RoyalBlue}{\mathbf{A}-\mathbf{B}\mathbf{D}^{-1}\mathbf{C}}) = \det( \mathbf{A})\det(\color{RoyalBlue}{\mathbf{D}-\mathbf{C}\mathbf{A}^{-1}\mathbf{B}}) $$์ ๊ฒฐ๊ณผ๋ค์ ์ด์ฉํด์ ๊ฒฐํฉ ์ ๊ทํ๋ฅ ๋ถํฌ์ ๋ํ ์ฃผ๋ณ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ตฌํ๊ฒ ๋๋ค.
์ด์ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ๋ก๋ฅผ ๋ค์๊ณผ ๊ฐ์ด $\mathbf{x}_b$์ ๋ํด ์ ๋ถํ์ฌ $\mathbf{x}_a$์ ๋ํด ์ฃผ๋ณํ ์ํค๋ ๊ณผ์ ์ ์์ ๋ณธ๋ค.
$$ p(\mathbf{x}_a) = \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b \tag{2.83} $$PRML์ฑ ์์๋ $p(\mathbf{x}_a)$๋ ์ ๊ท๋ถํฌ๋ผ๋ ์ฌ์ค์ ์์ ํ๊ณ ์์ ์ ๊ณฑ ํ ํฌ๋์ ์ด์ฉํด์ ํ๊ท ๊ณผ ๊ณต๋ถ์ฐ๋ง์ ๊ตฌํ๊ณ ์๋ค. ์ฌ๊ธฐ์๋ $p(\mathbf{x}_a)$๊ฐ ์ ๋๋ก ์ ๊ทํ๋ ๊ฐ์ฐ์์์ด๋ผ๋ ๊ฒ์ ์ง์ ์ ์ผ๋ก ๋จ๊ณ๋ณ๋ก ํ์ธ ํด๋ณธ๋ค. ์์ด ๋ง์ด ๊ธธ๊ณ ๋ณต์กํ๋ค.
์์ ์ ๋ฆฌํ ์(2.70)์ ์ด์ฉํ์ฌ ์ ๋ถ์์ ์ง์ ํจ์ ๋ถ๋ถ์ ์ ๊ฐํ๋ฉด ์์ ๊ฐ๋ค. ์ ๋ถ๋ณ์๋ $\mathbf{x}_b$์ด๋ฏ๋ก $\mathbf{x}_b$์ ๋ํ ํญ๋ง ๋ค์ ์ ์ด๋ณด๋ฉด
$$ \begin{align} &\color{RoyalBlue}{ -\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \mathbf{x}_b } \color{RoyalBlue}{ +\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \mathbf{x}_b } \color{RoyalBlue}{ -\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ba}^{\text{T}} \mathbf{x}_b } \color{RoyalBlue}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{RoyalBlue}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } \color{RoyalBlue}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{RoyalBlue}{ +\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } \\[5pt] =& \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ab}^{\text{T}} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ab}^{\text{T}} \boldsymbol{\mu}_a } \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb}^{\text{T}} \boldsymbol{\mu}_b } \\[5pt] =& \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ +\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \quad \because \boldsymbol{\Lambda}_{ab}^{\text{T}}=\boldsymbol{\Lambda}_{ba}, \quad \boldsymbol{\Lambda}_{bb}^{\text{T}}=\boldsymbol{\Lambda}_{bb} \\[5pt] =& \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } +\mathbf{x}_b^{\text{T}} \left( \color{Black}{ -\frac{1}{2} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Black}{ -\frac{1}{2} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\frac{1}{2} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Black}{ +\frac{1}{2} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ +\frac{1}{2} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \right) \\[5pt] =& \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } +\mathbf{x}_b^{\text{T}} \left( \color{Black}{ \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ -\boldsymbol{\Lambda}_{ba} \mathbf{x}_a } \color{Black}{ +\boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \right) \\[5pt] =& \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } +\mathbf{x}_b^{\text{T}} \left( \color{Black}{ \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ -\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)} \right) \end{align} $$์ด๊ณ , $\mathbf{x}_b$์ ์๊ด์๋ 9๊ฐํญ์ ์ง์๋ฒ์น์ ์ํด ์ง์ํญ์ ๊ณฑํ๊ธฐ๋ก ๋ฐ๊ฟ ์ ๋ถ๋ฐ์ผ๋ก ๋นผ๋ด๋ฉด ๊ฒฐ๊ตญ ์ ๋ถ์์ ๋ค์์ฒ๋ผ ๋๋ค.
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} \exp (\color{Black}{\textit{remainder}}) \int \exp \left\{ \color{Black}{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b } +\mathbf{x}_b^{\text{T}} \left( \color{Black}{ \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \color{Black}{ -\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)} \right) \right\} \text{d} \mathbf{x}_b \tag{1} $$์ ์์์ remainder๋ $\mathbf{x}_b$์ ์๊ด์๋ ํญ๋ค์ ๋ํ๋ธ๋ค. ์ด์ ์ง์ํจ์ ๋ถ๋ถ์ ์ ๋ถ์ ์ํด ์์ ์ฝ๊ฐ ๋ณ๊ฒฝํ๋ค.
$$ \mathbf{m} = \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b -\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a) \tag{2.85} $$$\mathbf{x}_b$์ 1์ฐจํญ ๋ถ๋ถ์ ์(2.85)์ฒ๋ผ ๊ฐ๋จํ ์นํํ๋ฉด ์ ๋ถ์์ ๋ค์์ฒ๋ผ๋๋ค.
$$ \int \exp \left\{ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b +\mathbf{x}_b^{\text{T}} \mathbf{m} \right\} \text{d} \mathbf{x}_b \tag{2} $$์ด๋ฅผ $\mathbf{x}_b$์ ์์ ์ ๊ณฑ์๊ณผ ๋น๊ตํ์ฌ ์์ ๋ณ๊ฒฝํ๋ค.
์ ์์ ์(2)์ ๋น๊ตํ๋ฉด $\mathbf{m} = \boldsymbol{\Lambda}_{bb}\mathbf{k}$ ์ด๊ณ , $\mathbf{k}=\boldsymbol{\Lambda}_{bb}^{-1}\mathbf{m}$์ด ๋๋ค. ์๋ณ์ $\frac{1}{2}\mathbf{k}^{\text{T}}\boldsymbol{\Lambda}_{bb}\mathbf{k}$๋ฅผ ๋ํ๊ณ $\mathbf{k}=\boldsymbol{\Lambda}_{bb}^{-1}\mathbf{m}$์ ๋์ ํ๋ฉด ์(2.84)๋ฅผ ์ ๋ํ ์ ์๋ค.
$$ -\frac{1}{2} \mathbf{x}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \mathbf{x}_b+\mathbf{x}_b^{\text{T}} \mathbf{m} = -\frac{1}{2}(\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} )^{\text{T}} \boldsymbol{\Lambda}_{bb} (\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m}) + \frac{1}{2} \mathbf{m}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} \tag{2.84} $$์ ์ด๋ฐ์ง์ ํ๋ํ๋ฉด ์ง์ํจ์ ์์ ์๋ ํญ์ $\mathbf{x}_b$์ ์์ ์ ๊ณฑ๊ผด๋ก ๋ฐ๊พธ๊ธฐ ์ํด์์ด๋ค. ์ป์ด์ง ๊ฒฐ๊ณผ๋ฅผ ์ด์ฉํ์ฌ ์(1)์ ๋ค์ ์จ๋ณด๋ฉด
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} \exp (\color{Black}{\textit{remainder}}) \int \exp \left\{ -\frac{1}{2}(\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} )^{\text{T}} \boldsymbol{\Lambda}_{bb} (\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m}) + \frac{1}{2} \mathbf{m}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} \right\} \text{d} \mathbf{x}_b $$์ด ๋๋๋ฐ ์(2.85)์ $\mathbf{m}$์ $\mathbf{x}_b$์ ์๊ด์๋ ํญ์ด๋ฏ๋ก
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} \exp (\color{Black}{\textit{remainder}}) \exp \left\{\frac{1}{2} \mathbf{m}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} \right\} \int \exp \left\{ -\frac{1}{2}(\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} )^{\text{T}} \boldsymbol{\Lambda}_{bb} (\mathbf{x}_b - \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m}) \right\} \text{d} \mathbf{x}_b $$๊ฐ ๋๋ค. ์ด์ ๋จ์ ์ ๋ถํญ์ $\mathbf{x}_b$์ ์์ ์ ๊ณฑ๊ผด์ด ๋์ด ์ ๊ทํ๋์ง ์์ ๊ฐ์ฐ์์(๋ณ์๊ฐ $\mathbf{x}_b$, ํ๊ท ๋ฒกํฐ๊ฐ $\boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m}$, ๊ณต๋ถ์ฐํ๋ ฌ์ด $\boldsymbol{\Lambda}_{bb}^{-1}$์ธ)์ด ๋๊ณ ์ด๋ฅผ ์ ๋ถํ๋ฉด ์ ๊ทํ ์์๊ฐ ๋๊ธฐ ๋๋ฌธ์ ์ ๋ถ๊ฒฐ๊ณผ๋
$$ (2\pi)^{D_{b}/2}\left\vert \boldsymbol{\Lambda}_{bb}^{-1} \right\vert^{1/2} $$์ด ๋จ์ ์ฝ๊ฒ ์ ์ ์๋ค. ๋ฐ๋ผ์ ์(1)์ ์ ๋ถ ํ ์๋์ฒ๋ผ ๋๋ค.
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} (2\pi)^{D_{b}/2}\left\vert \boldsymbol{\Lambda}_{bb}^{-1} \right\vert^{1/2} \exp (\color{Black}{\textit{remainder}}) \exp \left\{ \color{RoyalBlue}{\frac{1}{2} \mathbf{m}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} } \right\} \tag{3} $$์ฌ๊ธฐ์
$$ \textit{remainder} = \color{Orchid}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \mathbf{x}_a} \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa}^{\text{T}} \boldsymbol{\mu}_a } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ba}^{\text{T}} \boldsymbol{\mu}_b } \\ \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } $$์ด์ ๊ณฑํด์ง ์ง์ํจ์๋ค์ ํ๋์ ์ง์ํจ์๋ก ๋ง๋ค๋ฉด ์ง์ํจ์๋
$$ \exp \left\{ \color{RoyalBlue}{\frac{1}{2} \mathbf{m}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \mathbf{m} } \color{Orchid}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \mathbf{x}_a} \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa}^{\text{T}} \boldsymbol{\mu}_a } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b } \color{Orchid}{ +\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ba}^{\text{T}} \boldsymbol{\mu}_b } \\ \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \right\} $$๊ฐ ๋๋ค. ํ๋์์์ ์๋๋๋ก ์ฐ๋ฉด ์ง์ํจ์์์ ํญ์ ๋ค์๊ณผ ๊ฐ๋ค.
$$ \color{RoyalBlue}{\frac{1}{2} \left[\boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b - \boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)\right]^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \left[\boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b - \boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)\right] } \color{Orchid}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \mathbf{x}_a} \color{Orchid}{+\mathbf{x}_a^{\text{T}}(\boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a + \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b )} \\ \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a } \color{ForestGreen}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b } \color{ForestGreen}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a } \color{ForestGreen}{ -\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b } \tag{4} $$์ด์ ํ๋๋ถ๋ถ์ ์ ๊ฐํด์ ์ ๋ฆฌํ๋ฉด
$$ \begin{align} &\color{RoyalBlue}{\frac{1}{2} \left[ \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b-\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)\right]^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-1} \left[\boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b-\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_a)\right] } \\[5pt] =& \color{Black}{\frac{1}{2} \left[ \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} -( \mathbf{x}_a^{\text{T}} - \boldsymbol{\mu}_a^{\text{T}})\boldsymbol{\Lambda}_{ab} \right] \boldsymbol{\Lambda}_{bb}^{-1} \left[\boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b-\boldsymbol{\Lambda}_{ba} ( \mathbf{x}_a - \boldsymbol{\mu}_b)\right] } \\[5pt] =& \frac{1}{2} \left[ (\boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\Lambda}_{bb}^{-1}- \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{\text{T}}+ \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} ) (\boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b- \boldsymbol{\Lambda}_{ba} \mathbf{x}_a + \boldsymbol{\Lambda}_{ba}\boldsymbol{\mu}_a ) \right] \\[5pt] =& \frac{1}{2} \left[ \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b - \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b + \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b - \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a + \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a - \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a + \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a - \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a + \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a \right] \\[5pt] =& \color{ForestGreen}{\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{bb} \boldsymbol{\mu}_b} \color{Orchid}{-\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b} \color{ForestGreen}{+\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b} \color{Orchid}{-\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ba}^{\text{T}} \boldsymbol{\mu}_b} \color{Orchid}{+\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \mathbf{x}_a} \color{Orchid}{-\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ba}^{\text{T}} \boldsymbol{\Lambda}_{bb}^{-\text{T}} \boldsymbol{\Lambda}_{ab}^{\text{T}} \boldsymbol{\mu}_a} \color{ForestGreen}{+\frac{1}{2} \boldsymbol{\mu}_b^{\text{T}} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a} \color{Orchid}{-\frac{1}{2} \mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a} \color{Gray}{+\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a} \end{align} $$๊ฐ ๋๋ค. ์ด๋ก์ํญ์ ์(4)์ ์ด๋ก์ํญ๊ณผ ํจ๊ป ๋ค ์ฌ๋ผ์ง๋ค. ์ ๋ฆฌํ๊ณ ์(4)๋ฅผ ๋ค์ ์จ๋ณด๋ฉด
์ด๋ค. ์ฌ๊ธฐ์ ํ๋์์ $\mathbf{x}_a$๋ํ 2์ฐจ์, ๋ถํ์์ $\mathbf{x}_a$์ ๋ํ 1์ฐจ์์ผ๋ก ๊ตฌ๋ถํ์๋ค. ๊ด๋ จ์๋ ํญ๋ค๋ผ๋ฆฌ ๋ฌต์ด ์ฃผ๊ณ , ์ ๊ฐํด์ ์ ๋ฆฌํ๋ฉด
$$ \begin{align} eq. (4) = &\color{RoyalBlue}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \mathbf{x}_a} \color{Orchid}{+\mathbf{x}_a^{\text{T}}(\boldsymbol{\Lambda}_{aa} \boldsymbol{\mu}_a + \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b )} \color{Orchid}{-\mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\mu}_b} \color{Orchid}{-\mathbf{x}_a^{\text{T}} \boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba} \boldsymbol{\mu}_a} \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \boldsymbol{\mu}_a } \\[5pt] =&\color{RoyalBlue}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \mathbf{x}_a} \color{Orchid}{+\mathbf{x}_a^{\text{T}}(\boldsymbol{\Lambda}_{aa} -\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \boldsymbol{\mu}_a } \quad \because \boldsymbol{\Lambda}_{bb} \text{ is sym.} \tag{2.87} \end{align} $$์ด ๋๋ค. ์ด ์์ด ์(2.87)์ด๋ฉฐ ์ ๋ถํ ์ง์ํจ์์ ์ง์๋ถ์ ํด๋นํ๋ ์์ด๋ค. ์ง๊ธ๊น์ง ๊ณ์ฐ์ ์ ๋ฆฌํ๊ธฐ ์ํด ์(3)์ ์ ์ฒด ๋ชจ์ต์ ์จ๋ณด๋ฉด
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} (2\pi)^{D_{b}/2}\left\vert \boldsymbol{\Lambda}_{bb}^{-1} \right\vert^{1/2} \exp \left\{ \color{RoyalBlue}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \mathbf{x}_a} \color{Orchid}{+\mathbf{x}_a^{\text{T}}(\boldsymbol{\Lambda}_{aa} -\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba}) \boldsymbol{\mu}_a } \right\} \tag{5} $$์(5)์์ ์(2.76)์ ์ํด $\boldsymbol{\Sigma}_{aa} = (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba})^{-1}$ ์ด๋ฏ๋ก $\boldsymbol{\Sigma}_{aa}^{-1} = (\boldsymbol{\Lambda}_{aa}-\boldsymbol{\Lambda}_{ab} \boldsymbol{\Lambda}_{bb}^{-1} \boldsymbol{\Lambda}_{ba})$์ด๊ณ ์ด๋ฅผ ๋์ ํ๋ฉด
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} (2\pi)^{D_{b}/2}\left\vert \boldsymbol{\Lambda}_{bb}^{-1} \right\vert^{1/2} \exp \left\{ \color{RoyalBlue}{-\frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \mathbf{x}_a} \color{Orchid}{+\mathbf{x}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a } \color{Gray}{ -\frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a } \right\} \tag{6} $$๋ก ๊ฐ๋จํ ํ ์ ์๊ฒ ๋๋ค. ์ด์ ๋ค์ ์ง์ํจ์์์ $\mathbf{x}_a$์ ์์ ์ ๊ณฑ๊ผด๋ก ๋ฐ๊พผ๋ค. ์ผ๋ฐ์ ์ธ ์์ ์ ๊ณฑ๊ผด์ ๋ชจ์ต์
$$ -\frac{1}{2}(\mathbf{x}_a - \boldsymbol{\mu}_a)^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} (\mathbf{x}_a - \boldsymbol{\mu}_a) = - \frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \mathbf{x}_a + \mathbf{x}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a - \frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a $$์ด๋ฏ๋ก
$$ -\frac{1}{2}\mathbf{x}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \mathbf{x}_a + \mathbf{x}_a^{\text{T}}\boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a = -\frac{1}{2}(\mathbf{x}_a - \boldsymbol{\mu}_a)^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} (\mathbf{x}_a - \boldsymbol{\mu}_a) + \frac{1}{2} \boldsymbol{\mu}_a^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} \boldsymbol{\mu}_a $$๊ฐ ๋๊ณ ์ด๋ฅผ ์(6)์ ๋์ ํ๋ฉด
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2 \pi)^{D/2}}\frac{1}{\left\vert\boldsymbol{\Sigma}\right\vert^{1/2}} (2\pi)^{D_{b}/2}\left\vert \boldsymbol{\Lambda}_{bb}^{-1} \right\vert^{1/2} \exp \left\{ -\frac{1}{2}(\mathbf{x}_a - \boldsymbol{\mu}_a)^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} (\mathbf{x}_a - \boldsymbol{\mu}_a) \right\} \tag{7} $$๊ฐ ๋์ด ์ง์ํจ์ํญ์ด $\mathbf{x}_a$์ ๋ํ ์์ ์ ๊ณฑ๊ผด๋ก ์์ ํ ์ ๋ฆฌ ๋๋ค. ์ด์ ๋จ์๊ฒ์ ์์์๋ ์ ๊ทํ ์์ํญ์ด๋ค. $2\pi$์ ๊ด๋ จ๋ ํญ์
$$ \frac{(2\pi)^{D_{b}/2}}{(2 \pi)^{D/2}} = (2\pi)^{\frac{D_b - D}{2}} = (2\pi)^{\frac{-D_a}{2}} = \frac{1}{(2\pi)^{D_{a}/2}} $$๋ก ์ ๋ฆฌ๋๋ค.
ํํธ ์ฐ๋๋ฒ๋ฆฌ ํ๋ ฌ ๊ณต์woodbury matrix identity์ ์ํด $\boldsymbol{\Lambda}_{bb}^{-1} = \boldsymbol{\Sigma}_{bb} - \boldsymbol{\Sigma}_{ba}\boldsymbol{\Sigma}_{aa}^{-1}\boldsymbol{\Sigma}_{ab}$์ด๊ณ , ๋ถ๋ถํ๋ ฌ๋ก ๋๋์ด์ง ๋์นญํ๋ ฌ์ ํ๋ ฌ์determinant of a partitioned symmetric matrix์ ์ํด $ \left\vert \boldsymbol{\Sigma} \right\vert = \left\vert \boldsymbol{\Sigma}_{aa} \right\vert \, \left\vert \boldsymbol{\Sigma}_{bb} - \boldsymbol{\Sigma}_{ba}\boldsymbol{\Sigma}_{aa}^{-1}\boldsymbol{\Sigma}_{ab} \right\vert $์์ ์๊ณ ์์ผ๋ฏ๋ก ๊ณต๋ถ์ฐํ๋ ฌ์ ๊ด๋ จ๋ ํญ์
$$ \left(\frac{\left\vert \boldsymbol{\Lambda}_{bb}^{-1}\right\vert}{\left\vert\boldsymbol{\Sigma}\right\vert}\right)^{1/2} =\left( \frac{\left\vert \boldsymbol{\Sigma}_{bb} - \boldsymbol{\Sigma}_{ba}\boldsymbol{\Sigma}_{aa}^{-1}\boldsymbol{\Sigma}_{ab} \right\vert}{\left\vert \boldsymbol{\Sigma}_{aa} \right\vert \, \left\vert \boldsymbol{\Sigma}_{bb} - \boldsymbol{\Sigma}_{ba}\boldsymbol{\Sigma}_{aa}^{-1}\boldsymbol{\Sigma}_{ab} \right\vert} \right)^{1/2} =\frac{1}{\left\vert \boldsymbol{\Sigma}_{aa}\right\vert^{1/2}} $$์ด ๋๋ค. ์ด ๊ฒฐ๊ณผ๋ฅผ ์ด์ฉํ์ฌ ์(7)์ ์ ๋ฆฌํ๋ฉด
$$ \int p(\mathbf{x}_a, \mathbf{x}_b) \text{d} \mathbf{x}_b = \frac{1}{(2\pi)^{D_{a}/2}} \frac{1}{\left\vert \boldsymbol{\Sigma}_{aa}\right\vert^{1/2}} \exp \left\{ -\frac{1}{2}(\mathbf{x}_a - \boldsymbol{\mu}_a)^{\text{T}} \boldsymbol{\Sigma}_{aa}^{-1} (\mathbf{x}_a - \boldsymbol{\mu}_a) \right\} \tag{8} $$๊ฐ ๋์ด ๋๋์ด ์ต์ข ์ ์ผ๋ก ์ฃผ๋ณ ํ๋ฅ ๋ถํฌ๋ ์ ๊ทํ๋ ๊ฐ์ฐ์์์ด๋ผ๋ ๊ฒ์ ํ์ธํ ์ ์๋ค.
์ง๊ธ๊น์ง ๋ด์ฉ์ ์ ๋ฆฌํ๋ฉด ์๋์ ๊ฐ๋ค.
์กฐ๊ฑด๋ถ ํ๋ฅ ๋ถํฌ $p(\mathbf{y} \mid \mathbf{x})$์ ํ๊ท ์ด ์ฃผ๋ณ ํ๋ฅ ๋ถํฌ $p(\mathbf{x})$์ ํ๊ท ์ ๋ํ ์ ํํจ์๋ก ์ฃผ์ด์ง ๋ชจ๋ธ์ ๋ํด์ $p(\mathbf{y})$์ $p(\mathbf{x} \mid \mathbf{y})$๋ฅผ ๊ตฌํด๋ณธ๋ค. ๋ฒ ์ด์ง์ ๊ด์ ์์ ๋ค์ ๋งํ๋ฉด ์ฌ์ ํ๋ฅ prior $p(\mathbf{x})$์ ๊ฐ๋ฅ๋likelihood $p(\mathbf{y} \mid \mathbf{x})$๊ฐ ์ฃผ์ด์ก์ ๋ ์ฌํํ๋ฅ posterior $p(\mathbf{x} \mid \mathbf{y})$์ ์ฆ๊ฑฐ์ ์ฃผ๋ณํ๋ฅ marginal $p(\mathbf{y})$๋ฅผ ๊ตฌํ๋ ๊ฒ์ด๋ค.
$$ p(\mathbf{x}) = \mathcal{N} \left(\mathbf{x} \mid \boldsymbol{\mu}, \boldsymbol{\Lambda}^{-1} \right) \tag{2.99} $$$$ p(\mathbf{y} \mid \mathbf{x}) = \mathcal{N} \left(\mathbf{y} \mid \mathbf{Ax}+\mathbf{b}, \mathbf{L}^{-1} \right) \tag{2.100} $$๋ชฉ์ ๋ฌ์ฑ์ ์ํ ๊ธฐ๋ณธ ์ ๋ต์ ์(2.99), (2.100)์ผ๋ก ๋ถํฐ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ $p(\mathbf{x}, \mathbf{y})$๋ฅผ ๊ตฌํ ๋ค์ 2.3.2์ ์ ๊ฒฐ๊ณผ๋ฅผ ์ด์ฉํ๋ ๊ฒ์ด๋ค. ์ ์ ์์ ํ๊ฒ๊ณผ ๋ฐ๋๋ก ์ด๋ฒ์๋ ๋ ํ๋ฅ ๋ณ์ $\mathbf{x}$, $\mathbf{y}$๋ฅผ ํฉํ์ฌ ์ฐจ์์ด ๋ ๋์ ๋ฒกํฐ ๋ณ์ $\mathbf{z}$๋ฅผ ์ ์ํ๊ณ $\mathbf{z}$์ ๋ํ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ตฌํ๋ ๊ฒ์ด๋ค.
$$ \mathbf{z} = \begin{pmatrix} \mathbf{x} \\ \mathbf{y} \end{pmatrix} \tag{2.101} $$์ฑ ์์๋ ๋ค์๊ณผ ๊ฐ์ด ์ด์ผ๊ธฐํ๋ฉด์ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ $p(\mathbf{z})$๊ฐ ์ ๊ท๋ถํฌ๋ผ๊ณ ์ด์ผ๊ธฐํ๋ค.
we see that this is a quadratic function of the components of $\mathbf{z}$, and hence $p(\mathbf{z})$ is Gaussian distribution.
PRML p.91
๊ฒฐ๋ก ์ ์ผ๋ก๋ $p(\mathbf{z})$๊ฐ ์ ๊ทํ๋ ๊ฐ์ฐ์์ ์ฆ ์ ๊ท๋ถํฌ๊ฐ ๋ง๋ค. ์ฑ ์์ ์ธ๊ธํ๋ Gaussian์ด๋ผ๋ ์ฉ์ด๋ unnormalized Gaussian๋ผ๋ ์ฉ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ผ๋ก ๋ด์ ์ ๊ทํ๋ ์ข ๋ชจ์ ํจ์๋ฅผ ์ด์ผ๊ธฐํ๋๊ฒ์ด๋ค. ํ์ง๋ง ์ง์ํจ์์ ์ง์ํญ์ด ์ด์ฐจํจ์๋ผ๋ ์ฌ์ค๋ง์ผ๋ก ์ ๊ทํ๋ ๊ฐ์ฐ์์์ด๋ผ๊ณ ๊ฒฐ๋ก ๋ด๋ฆด ์ ์๋ค.
์์ ์ ์์๋ ์ฑ ์์ ์ง๋ฉด๊ด๊ณ์ ์ด๋ฅผ ๋๊น์ง ๋ณด์ด์ง ์๊ณ ์ ๊ท๋ถํฌ๋ผ๋ ๊ฐ์ ํ์ ํ๊ท ๊ณผ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ์ฐพ๋ ์์ผ๋ก ์ค๋ช ์ ํ์๋ค. ๊ทธ๋์ ์ด ๋ฌธ์์์ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ $p(\mathbf{x}, \mathbf{y})$๊ฐ ์ ๊ท๋ถํฌ์ผ ๋ $p(\mathbf{x})$์ $p(\mathbf{y} \mid \mathbf{x})$๊ฐ ์ ๊ท๋ถํฌ๊ฐ ๋จ์ ๋ณด์๋ค. ์ฌ๊ธฐ์๋ $p(\mathbf{x})$์ $p(\mathbf{y} \mid \mathbf{x})$๊ฐ ์ ๊ท๋ถํฌ๋ก ์ฃผ์ด์ก์๋ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ $p(\mathbf{x}, \mathbf{y})$๊ฐ ์ ๊ทํ๋ ์ข ๋ชจ์ ํจ์ ์ธ์ง๋ฅผ ์๊ณ ์ถ์ ๊ฒ์ด๋ค. ํ์ธ์ ์ํด์๋ ์(2.99)์ ์(2.100)์ ๊ณฑํ์ฌ ์์ ์ ๋ฆฌํ์ฌ์ผ ํ๋ค.
์์ ์ ๋ฆฌํ๋ ๊ณผ์ ์์ ์ง์ํจ์์ ์ง์ ๋ถ๋ถ์ ์์ ์ ๊ณฑ๊ผด๋ก ๊ณ ์น๋ ๋ณด์์ผ๋ก ์๊ฒจ๋๋ ํญ๋ค์ด ํ๋ฅ ๋ณ์์ ๋ํ ์์ํญ๋ค๊ณผ ์์๊ฐ ๋๋ฆฌ๋ผ๋ ๊ฒ์ ์์ํ ์ ์๋ค. ๊ทธ๋ฌ๋ฉด ๋จ์ ๊ณผ์ ์ ์(2.99)์ ์(2.100)์ ์ ๊ทํ ์์๋ค์ ๊ณฑ์ด ๊ฒฐํฉ ํ๋ฅ ๋ถํฌํจ์์ ์ ๊ทํ ์์๊ฐ ๋๋๋ ํ๋ ๊ฒ์ด๋ค. ์ฌ๊ธฐ์๋ ๊ทธ๊ฒ๋ง ํ์ธ ํด๋ณธ๋ค.
$$ \begin{align} p(\mathbf{x}, \mathbf{y}) &= p(\mathbf{x}) p(\mathbf{y} \mid \mathbf{x}) \\[5pt] &= \frac{1}{(2\pi)^{M/2}} \frac{1}{\left\vert \boldsymbol{\Lambda}^{-1} \right\vert^{1/2} } \exp \left\{ -\frac{1}{2} \left( \mathbf{x} - \boldsymbol{\mu} \right)^{\text{T}} \boldsymbol{\Lambda} \left( \mathbf{x} - \boldsymbol{\mu} \right) \right\} \frac{1}{(2\pi)^{D/2}} \frac{1}{\left\vert \mathbf{L}^{-1} \right\vert^{1/2} } \exp \left\{ -\frac{1}{2} \left( \mathbf{y} - \mathbf{Ax}-\mathbf{b} \right)^{\text{T}} \mathbf{L} \left( \mathbf{y} - \mathbf{y}-\mathbf{Ax}-\mathbf{b} \right) \right\} \\[5pt] &= \frac{1}{(2\pi)^{(M+D)/2}} \frac{1}{ \left( \left\vert \boldsymbol{\Lambda}^{-1} \right\vert \left\vert \mathbf{L}^{-1} \right\vert \right)^{1/2} } \exp \left\{ -\frac{1}{2} \left( \mathbf{x} - \boldsymbol{\mu} \right)^{\text{T}} \boldsymbol{\Lambda} \left( \mathbf{x} - \boldsymbol{\mu} \right) \right\} \exp \left\{ -\frac{1}{2} \left( \mathbf{y} - \mathbf{Ax}-\mathbf{b} \right)^{\text{T}} \mathbf{L} \left( \mathbf{y} - \mathbf{y}-\mathbf{Ax}-\mathbf{b} \right) \right\} \end{align} \tag{9} $$$\mathbf{x}$, $\mathbf{y}$์ ์ฐจ์์ ๊ฐ๊ฐ $M$, $D$๋ผ ๋๋ฉด $\mathbf{z}$์ ์ฐจ์์ $M+D$์ด๋ฏ๋ก ์ ๊ทํ ์์์ค์ ๋ถ๋ชจ๊ฐ $2 \pi$์ธ ๋ถ๋ถ์ $\mathbf{z}$์ ์ ๊ท๋ถํฌ ์ ๊ทํ ์์์ ์ผ์นํ๋ค. ๋จ์ ๊ฒ์ $\mathbf{z}$์ ๋ํ ํ๋ฅ ๋ฐ๋ํจ์์ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ํ๋ ฌ์์ด $\left\vert \boldsymbol{\Lambda}^{-1} \right\vert \left\vert \mathbf{L}^{-1} \right\vert$ ์ธ๊ฐ๋ฅผ ๋ณด์ด๋ฉด ๋๋ค. ๊ทธ๋ฌ๊ธฐ ์ํด์๋ ์ฐ์ ๊ณต๋ถ์ฐ ํ๋ ฌ๋ถํฐ ๊ตฌํด์ผ ํ๋ค. ์ง์ํจ์ ๋ถ๋ถ์ ๋ค ์ ๊ฐํด์ ์ ์ผ๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
$$ \color{RoyalBlue}{-\frac{1}{2} \mathbf{x}^{\text{T}} \boldsymbol{\Lambda} \mathbf{x} } \color{OrangeRed}{+\frac{1}{2} \mathbf{x}^{\text{T}} \boldsymbol{\Lambda} \boldsymbol{\mu} } \color{OrangeRed}{+\frac{1}{2} \boldsymbol{\mu}^{\text{T}} \boldsymbol{\Lambda} \mathbf{x} } \color{Black}{-\frac{1}{2} \boldsymbol{\mu}^{\text{T}} \boldsymbol{\Lambda} \boldsymbol{\mu} } \\ \color{RoyalBlue}{-\frac{1}{2} \mathbf{y}^{\text{T}} \mathbf{L} \mathbf{y}} \color{RoyalBlue}{+\frac{1}{2} \mathbf{y}^{\text{T}} \mathbf{L} \mathbf{A} \mathbf{x} } \color{OrangeRed}{+\frac{1}{2} \mathbf{y}^{\text{T}} \mathbf{L} \mathbf{b}} \\ \color{RoyalBlue}{+\frac{1}{2}\mathbf{x}^{\text{T}}\mathbf{A}^{\text{T}} \mathbf{L} \mathbf{y}} \color{RoyalBlue}{-\frac{1}{2} \mathbf{x}^{\text{T}}\mathbf{A}^{\text{T}} \mathbf{L}\mathbf{A}\mathbf{x}} \color{OrangeRed}{-\frac{1}{2} \mathbf{x}^{\text{T}}\mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b}} \\ \color{OrangeRed}{+\frac{1}{2} \mathbf{b}^{\text{T}}\mathbf{L}\mathbf{y}} \color{OrangeRed}{-\frac{1}{2} \mathbf{b}^{\text{T}}\mathbf{L}\mathbf{A}\mathbf{x}} \color{Black}{-\frac{1}{2} \mathbf{b}^{\text{T}}\mathbf{L} \mathbf{b}} \tag{10} $$์(10)์์ $\mathbf{x}$, $\mathbf{y}$์ ๋ํ 2์ฐจํญ๋ค๋ง ๋ชจ์์ ์ ๋ฆฌํ๋ค.
$$ \color{RoyalBlue}{-\frac{1}{2} \mathbf{x}^{\text{T}} \left( \boldsymbol{\Lambda} + \mathbf{A}^{\text{T}}\boldsymbol{\Lambda}\mathbf{A} \right)\mathbf{x} -\frac{1}{2} \mathbf{y}^{\text{T}} \mathbf{L} \mathbf{y} +\frac{1}{2} \mathbf{y}^{\text{T}} \mathbf{L}\mathbf{A} \mathbf{x} +\frac{1}{2} \mathbf{x}^{\text{T}} \mathbf{A}^{\text{T}}\mathbf{L} \mathbf{y}} \\ = -\frac{1}{2} \begin{pmatrix} \mathbf{x} \\ \mathbf{y} \end{pmatrix}^{\text{T}} \underbrace{\begin{pmatrix} \boldsymbol{\Lambda} + \mathbf{A}^{\text{T}}\boldsymbol{\Lambda}\mathbf{A} & -\mathbf{A}^{\text{T}}\mathbf{L} \\ -\mathbf{L}\mathbf{A} & \mathbf{L} \end{pmatrix}}_{\text{prcision matrix for } \mathbf{z}} \begin{pmatrix} \mathbf{x} \\ \mathbf{y} \end{pmatrix} = -\frac{1}{2} \mathbf{z}^{\text{T}} \mathbf{R} \mathbf{z} \tag{2.103} $$์ด์ฐจํญ์ ๊ณ์ ํ๋ ฌ์ด ์ ๋ฐ๋ ํ๋ ฌ์ด ๋๋ฏ๋ก ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ์ ์ ๋ฐ๋ ํ๋ ฌ์ ์(2.104)๊ฐ ๋๋ค.
$$ \mathbf{R} = \begin{pmatrix} \boldsymbol{\Lambda} + \mathbf{A}^{\text{T}}\mathbf{L}\mathbf{A} & -\mathbf{A}^{\text{T}}\mathbf{L} \\ -\mathbf{L}\mathbf{A} & \mathbf{L} \end{pmatrix} \tag{2.104} $$๋ถํ ๋ ํ๋ ฌ์ ์ญํ๋ ฌ์ ๊ตฌํ ์ ์์ผ๋ฏ๋ก ๋ค์์ฒ๋ผ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ์ ๊ณต๋ถ์ฐ ํ๋ ฌ๋ ๊ตฌํ ์ ์๋ค.
$$ \text{cov}[\mathbf{z}] = \mathbf{R}^{-1} = \begin{pmatrix} \boldsymbol{\Lambda}^{-1} & \boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \\ \mathbf{A}\boldsymbol{\Lambda}^{-1} & \mathbf{L}^{-1}+\mathbf{A}\boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \end{pmatrix} \tag{2.105} $$์ด์ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ๊ตฌํ์ผ๋ฏ๋ก ๊ณต๋ถ์ฐ ํ๋ ฌ๊ณผ ๊ด๋ จ๋ ์ ๊ทํ ์์์ ์ดํด๋ณธ๋ค. ์(2.105)๋ก ๋ถํฐ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ํ๋ ฌ์์ ๋์นญํ๋ ฌ์ ํ๋ ฌ์ ๊ณต์์ ์ํด ๋ค์๊ณผ ๊ฐ๋ค.
$$ \left\vert \mathbf{R}^{-1} \right\vert = \det \left( \begin{bmatrix} \boldsymbol{\Lambda}^{-1} & \boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \\ \mathbf{A}\boldsymbol{\Lambda}^{-1} & \mathbf{L}^{-1}+\mathbf{A}\boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \end{bmatrix} \right) =\left\vert \boldsymbol{\Lambda}^{-1} \right\vert \left\vert \mathbf{L}^{-1}+\mathbf{A}\boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} - \mathbf{A}\boldsymbol{\Lambda}^{-1} \boldsymbol{\Lambda} \boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \right\vert =\left\vert \boldsymbol{\Lambda}^{-1} \right\vert \left\vert \mathbf{L}^{-1} \right\vert \tag{11} $$๋ฐ๋ผ์ ์(9)์ ๋๋จธ์ง ์ ๊ทํ ๊ณ์๋ ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ์ ๊ณต๋ถ์ฐํ๋ ฌ๊ณผ ์ผ์นํ๋ ๊ฒ์ ํ์ธํ์๋ค.
๋ง์ง๋ง์ผ๋ก ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ์ ํ๊ท ๋ฒกํฐ๋ฅผ ๊ตฌํ๊ธฐ ์ํด ์(10)์์ $\mathbf{x}$, $\mathbf{y}$์ ๋ํ 1์ฐจํญ๋ง ๋ชจ์ ๋ณด๋ฉด
$$ \color{OrangeRed}{\mathbf{x}^{\text{T}} \boldsymbol{\Lambda}\boldsymbol{\mu} + \mathbf{y}^{\text{T}}\mathbf{L}\mathbf{b}-\mathbf{x}^{\text{T}}\mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b}} = \begin{pmatrix} \mathbf{x} \\ \mathbf{y} \end{pmatrix}^{\text{T}} \begin{pmatrix} \boldsymbol{\Lambda}\boldsymbol{\mu} - \mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b} \\ \mathbf{L} \mathbf{b} \end{pmatrix} \tag{2.106} $$์ด๊ณ ์(2.71)์ ์ํด
$$ \begin{pmatrix} \mathbf{x} \\ \mathbf{y} \end{pmatrix}^{\text{T}} \begin{pmatrix} \boldsymbol{\Lambda}\boldsymbol{\mu} - \mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b} \\ \mathbf{L} \mathbf{b} \end{pmatrix} = \mathbf{z}^{\text{T}} \begin{pmatrix} \boldsymbol{\Lambda}\boldsymbol{\mu} - \mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b} \\ \mathbf{L} \mathbf{b} \end{pmatrix} = \mathbf{z}^{\text{T}} \mathbf{R} \mathbb{E}[\mathbf{z}] $$์ด๋ฏ๋ก
$$ \mathbb{E}[\mathbf{z}] = \mathbf{R}^{-1} \begin{pmatrix} \boldsymbol{\Lambda}\boldsymbol{\mu} - \mathbf{A}^{\text{T}}\mathbf{L} \mathbf{b} \\ \mathbf{L} \mathbf{b} \end{pmatrix} \tag{2.107} $$์(2.107)์ ์ ๋ฆฌํ๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
์ด๊ฒ์ผ๋ก ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ๋ ์ ๊ทํ๋ ๊ฐ์ฐ์์์ด๊ณ ๊ทธ๋ ํ๊ท ๊ณผ ๊ณต๋ถ์ฐ ํ๋ ฌ์ ์(2.108), (2.105)์ ๊ฐ์์ ๋ณด์๋ค. ์ ๋ฆฌํ๋ฉด ๊ฒฐํฉ ํ๋ฅ ๋ถํฌ $p(\mathbf{x}, \mathbf{y})$๋ ์(12)๊ฐ ๋๋ค.
$$ p(\mathbf{x}, \mathbf{y}) = \mathcal{N} \left( \mathbf{z} \mid \begin{pmatrix} \boldsymbol{\mu} \\ \mathbf{A}\boldsymbol{\mu} + \mathbf{b} \end{pmatrix},\begin{pmatrix} \boldsymbol{\Lambda}^{-1} & \boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \\ \mathbf{A}\boldsymbol{\Lambda}^{-1} & \mathbf{L}^{-1}+\mathbf{A}\boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}} \end{pmatrix} \right) \tag{12} $$์(12)์ ์(2.98)๋ก ๋ถํฐ $p(\mathbf{y})$๋ฅผ ๋ฐ๋ก ๊ตฌํ ์ ์๋ค.
$$ p(\mathbf{y}) = \mathcal{N} \left(\mathbf{y} \mid \mathbf{A}\boldsymbol{\mu}+\mathbf{b}, \mathbf{L}^{-1}+\mathbf{A}\boldsymbol{\Lambda}^{-1}\mathbf{A}^{\text{T}}\right) $$์(12)๋ฅผ ์ด์ฉํ์ฌ $p(\mathbf{x} \mid \mathbf{y})$๋ฅผ ๊ตฌํด๋ณด๋ฉด ์(2.96)์ผ๋ก ๋ถํฐ ๊ณต๋ถ์ฐ ํ๋ ฌ์
$$ \boldsymbol{\Sigma} = \left(\boldsymbol{\Lambda}+\mathbf{A}^{\text{T}}\mathbf{L}\mathbf{A} \right)^{-1} \tag{2.112} $$์์ ์ ์ ์๊ณ , ์(2.75)์ ๋น๊ตํ๋ฉด ํ๊ท ๋ฒกํฐ๋
๊ฐ ๋๋ ๊ฒ์ ํ์ธํ ์ ์๋ค. ์ด๊ฒ์ผ๋ก $p(\mathbf{y})$, $p(\mathbf{x} \mid \mathbf{y})$๋ฅผ ๋ชจ๋ ๊ตฌํ์๋ค. ๊ฒฐ๊ณผ๋ฅผ ์๋์ฒ๋ผ ๊ฐ๋จํ ์ ๋ฆฌํ ์ ์๋ค.
%%html
<link href='https://fonts.googleapis.com/earlyaccess/nanummyeongjo.css' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/earlyaccess/nanumgothiccoding.css' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/earlyaccess/notosanskr.css' rel='stylesheet' type='text/css'>
<style>
h1, h2 { font-family: 'Noto Sans KR'; }
h3, h4 { font-family: 'Noto Sans KR'; color:#0000B2; }
p { font-family: 'Georgia','Nanum Myeongjo'; font-size: 12pt; line-height: 200%; text-indent: 10px; }
li { font-family: 'Georgia','Nanum Myeongjo'; font-size: 12pt; line-height: 200%; }
li > p { text-indent: 0px; }
/* blockquote > p { font-family: 'Georgia','Nanum Myeongjo' !important; font-size: 12pt !important; } */
sup { font-family: 'Georgia'; font-size: 9pt; }
code, pre { font-family: 'Nanum Gothic Coding' !important; }
.code-body { font-family: 'Nanum Gothic Coding'; }
.ns { font-family: 'Noto Sans KR'; font-size: 15pt;}
.summary {font-family: 'Georgia'; font-size: 12pt; line-height: 200%;
border-left:3px solid #FF0000;padding-left:20px;margin-top:10px; }
</style>