파이썬을 이용하여 커널법 배우기/선형 주성분 분석 이론 문서 원본 보기
←
파이썬을 이용하여 커널법 배우기/선형 주성분 분석 이론
둘러보기로 이동
검색으로 이동
문서 편집 권한이 없습니다. 다음 이유를 확인해주세요:
요청한 명령은 다음 권한을 가진 사용자에게 제한됩니다:
사용자
.
문서의 원본을 보거나 복사할 수 있습니다.
<math>d</math> 차원 벡터 샘플 집합 <math>\mathbf{X} = [\mathbf{x}_1, \ldots, \mathbf{x}_l]^\top \in \Re^{d \times l}</math> 가 있다고 하자. 이 샘플 집합과의 거리의 합이 가장 적은 하나의 벡터를 <math>\mathbf{x}_0</math> 라 하면, 이는 제곱오차(squared-error) 척도 <math>J_0 (\mathbf{x}_0)</math> 를 최소화하는 값이다. :<math>J_0 (\mathbf{x}_0) = \sum_{k=1}^{l} || \mathbf{x}_0 - \mathbf{x}_k||^2</math> 이 문제의 최적값은 샘플의 평균 값 <math>\mathbf{m}</math> 으로 구할 수 있는데 (즉 <math>\mathbf{x}_0 = \mathbf{m}</math> ), :<math>\mathbf{m} = \frac{1}{l}\sum_{k=1}^{l}\mathbf{x}_k</math> 다음과 같이 쉽게 증명할 수 있다. :<math> \begin{align} J_0 (\mathbf{x}_0) & = \sum_{k=1}^{l} || (\mathbf{x}_0 - \mathbf{m}) - (\mathbf{x}_k - \mathbf{m})||^2 \\ & = \sum_{k=1}^{l} ||\mathbf{x}_0 - \mathbf{m}||^2 - 2(\mathbf{x}_0 - \mathbf{m})^\top \sum_{k=1}^{l} (\mathbf{x}_k - \mathbf{m}) + \sum_{k=1}^{l} ||\mathbf{x}_k - \mathbf{m}||^2 \\ & = \sum_{k=1}^{l} ||\mathbf{x}_0 - \mathbf{m}||^2 + \underbrace{ \sum_{k=1}^{l} ||\mathbf{x}_k - \mathbf{m}||^2} _{\text{independent of } \mathbf{x}_0}. \end{align} </math> <math>\mathbf{v}</math> 를 특정 방향을 나타내는 단위 벡터라 하자. 샘플 <math>\mathbf{x}_i</math> 는 샘플 평균 <math>\mathbf{m}</math> 에서 <math>\mathbf{v}</math> 방향으로 <math>a_i</math> 만큼 이동했다고 표현할 수 있다. :<math> \mathbf{x}_i = \mathbf{m} + a_i \mathbf{v} </math> 만약 이 값을 만족시키는 최적의 <math>a_i</math> 집합은 앞에서와 마찬가지로 제곱오차 척도를 최소화하는 값으로 구할 수 있다. :<math> \begin{align} J_1 (a_1,\ldots,a_l, \mathbf{v}) & = \sum_{k=1}^{l} || ( \mathbf{m} + a_k \mathbf{v}) - \mathbf{x}_k||^2 \\ & =\sum_{k=1}^{l} || a_k \mathbf{v} - (\mathbf{x}_k - \mathbf{m})||^2 \\ & =\sum_{k=1}^{l} a_k^2 || \mathbf{v}||^2 -2 \sum_{k=1}^{l} a_k \mathbf{v}^\top (\mathbf{x}_k - \mathbf{m}) +\underbrace{ \sum_{k=1}^{l} ||\mathbf{x}_k - \mathbf{m}||^2} _{\text{independent of } J_1} \end{align} </math> 위 식을 <math>a_i</math> 에 대해서 편미분 수행하고, <math>||\mathbf{v}||^2 = 1</math> 이란 사실을 통해 다음 식을 얻을 수 있다. :<math> \frac{\partial}{\partial a_i} J_1 (a_1,\ldots,a_l, \mathbf{v}) = 2 a_i - 2 \mathbf{v}^\top (\mathbf{x}_i - \mathbf{m}) </math> 목적함수 <math>J_1</math> 을 최소화하는 값은 식 위식이 0인 경우이다. 따라서 최적의 값을 다음과 같다. :<math> a_i = \mathbf{v}^\top (\mathbf{x}_i - \mathbf{m}) </math> 공분산 행렬 <math>\mathbf{C}</math> 를 다음과 같이 정의하고, :<math> \mathbf{C} = \sum_{k=1}^{l}(\mathbf{x}_k - \mathbf{m})(\mathbf{x}_k - \mathbf{m})^\top </math> 식 ()과 ()를 식 ()에 대입하면 다음 식을 얻을 수 있다. :<math> \begin{align} J_1 (\mathbf{v}) & = \sum_{k=1}^{l} a_k^2 -2 \sum_{k=1}^{l} a_k^2 \\ & = - \sum_{k=1}^{l}\mathbf{v}^\top (\mathbf{x}_k - \mathbf{m}) (\mathbf{x}_k - \mathbf{m})^\top \mathbf{v}\\ & = -\mathbf{v}^\top \mathbf{C} \mathbf{v} \end{align} </math> 이제 위 식의 최소화 문제는 <math>\mathbf{v}^\top \mathbf{C} \mathbf{v}</math> 의 최대화 문제로 해결 가능하다. 라그랑제 승수(Lagrange multipliers) <math>\lambda</math> 를 이용하여 다음 식을 나타내고, :<math> L(\lambda, \mathbf{v}) = \mathbf{v}^\top \mathbf{C} \mathbf{v} - \lambda(\mathbf{v}^\top \mathbf{v} - 1) </math> <math>\mathbf{v}^\top \mathbf{C} \mathbf{v}</math> 최대화 문제는 위 식을 <math>\mathbf{v}</math> 로 미분하여 얻을 수 있다. :<math> \frac{\partial L}{\partial \mathbf{v}} = 2 \mathbf{C}\mathbf{v} - 2 \lambda \mathbf{v} </math> 위 식을 0으로 설정하면, <math>J_1</math> 최소화 문제는 공분산 행렬 <math>\mathbf{C}</math> 의 고유값 문제로 해결 가능하다. :<math> \mathbf{C}\mathbf{v} = \lambda \mathbf{v} </math> 실제로 <math>\mathbf{v}^\top \mathbf{C} \mathbf{v}=\lambda \mathbf{v}^\top \mathbf{v}=\lambda</math> 이기 때문에 가장 큰 고유값에 대응하는 고유벡터가 최적의 값이 된다. 또한 고유값의 내림차순에 대응하는 고유벡터 몇개를 취함으로써 목적함수 <math>J_1</math> 을 더욱 만족시킬 수 있다. 여기서 선택된 고유벡터를 주성분(principal components)라 한다. 주성분 즉, <math>q</math> 개의 선택된 고유값을 <math>\mathbf{V} = [\mathbf{v}_1, \ldots, \mathbf{v}_q] \in \Re^{d \times q}</math> 라 하면, 이 주성분으로 특징 샘플 <math>\mathbf{y} \in \Re^{d}</math> 을 사상하면 <math>P_V (\mathbf{y})</math>를 얻을 수 있다. :<math> P_V (\mathbf{y}) = \mathbf{V}^\top (\mathbf{y} - \mathbf{m}) \in \Re^{q} </math> 또한 원래 샘플 복원은 다음과 같이 수행한다. :<math> \mathbf{y}' = \mathbf{V}\mathbf{V}^\top (\mathbf{y} -\mathbf{m}) + \mathbf{m} </math> 여기서 <math>\mathbf{y}'</math> 는 복원된 샘플을 의미한다. [[분류:파이썬을 이용하여 커널법 배우기|선형 주성분 분석 이론]]
파이썬을 이용하여 커널법 배우기/선형 주성분 분석 이론
문서로 돌아갑니다.
둘러보기 메뉴
개인 도구
로그인
이름공간
문서
토론
한국어
보기
읽기
원본 보기
역사 보기
더 보기
검색
둘러보기
대문
최근 바뀜
임의의 문서로
미디어위키 도움말
특수 문서 목록
도구
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보