2021-1ν•™κΈ°, λŒ€ν•™μ—μ„œ β€˜ν†΅κ³„μ  λ°μ΄ν„°λ§ˆμ΄λ‹β€™ μˆ˜μ—…μ„ λ“£κ³  κ³΅λΆ€ν•œ λ°”λ₯Ό μ •λ¦¬ν•œ κΈ€μž…λ‹ˆλ‹€. 지적은 μ–Έμ œλ‚˜ ν™˜μ˜μž…λ‹ˆλ‹€ :)

7 minute read

2021-1ν•™κΈ°, λŒ€ν•™μ—μ„œ β€˜ν†΅κ³„μ  λ°μ΄ν„°λ§ˆμ΄λ‹β€™ μˆ˜μ—…μ„ λ“£κ³  κ³΅λΆ€ν•œ λ°”λ₯Ό μ •λ¦¬ν•œ κΈ€μž…λ‹ˆλ‹€. 지적은 μ–Έμ œλ‚˜ ν™˜μ˜μž…λ‹ˆλ‹€ :)

Set-up


formulas.

1. $\displaystyle UU^T = \sum^n_{i=1} \mathbf{u}_i \mathbf{u}_i^T$, where $U = \left( \mathbf{u}_1, \dots, \mathbf{u}_n \right) \in \mathbb{R}^{n \times n}$

2. $\displaystyle UDU^T = \sum^n_{i=1} d_i \mathbf{u}_i \mathbf{u}_i^T$, where $D = \text{diag}(d_i)$

행렬곱을 ν‘œν˜„ν•˜λŠ” μœ μš©ν•œ λ°©μ‹μ΄λ‹ˆ μ΅μˆ™ν•΄μ§€λ©΄ μ’‹λ‹€! μ•žμœΌλ‘œ λ‚˜μ˜€λŠ” λ‚΄μš©μ—μ„œ 자주 λ“±μž₯ν•œλ‹€!


Definition. Orthogonal Matrix

An <orthogonal matrix> $U$ is a matrix such that $UU^T = U^TU = I_n$.


Spectral Decomposition


Theorem. Spectral Decomposition; Eigen Decomposition

For a real symmetric matrix $A \in \mathbb{R}^{n\times n}$, there exists a diagonal matrix $D = \text{diag}(d_1, \dots, d_n)$ and an orthogonal matrix $U$ s.t. $A = UDU^T$.

즉, λͺ¨λ“  symmetric matrixλŠ” $UDU^T$의 ν˜•νƒœλ‘œ decompose κ°€λŠ₯함을 λ§ν•œλ‹€!


Note.

  • Each $d_i$ is an real eigenvalue of $A$.
  • $\mathbf{u}_i$ is the eigenvector associated with $d_i$, where $U = \left( \mathbf{u}_1, \dots, \mathbf{u}_n \right)$.
  • $\displaystyle A = UDU^T = \sum^n_{i=1} d_i \mathbf{u}_i \mathbf{u}_i^T$

<Spectral Decomposition>은 κΈ°ν•˜ν•™μ  이해가 μˆ˜λ°˜λ˜μ–΄μ•Ό ν•œλ‹€.

λ¨Όμ €, orthogonal matrix $U$에 λŒ€ν•΄ $U$λŠ” μ„ ν˜•λ³€ν™˜μ—μ„œ μΌμ’…μ˜ rotation matrix의 역할을 ν•œλ‹€.

\[\mathbf{x} \longrightarrow U \mathbf{x}\]

이제 $A\mathbf{x}$λ₯Ό ν•΄μ„ν•˜κΈ° μœ„ν•΄ $UDU^T\mathbf{x}$λ₯Ό λ‹¨κ³„λ³„λ‘œ ν•΄μ„ν•΄λ³΄μž.

1. $U^T \mathbf{x}$; νšŒμ „μ„ 톡해 μ’Œν‘œμΆ• λ³€ν™˜

$U^T$λŠ” νšŒμ „ λ³€ν™˜μ„ μˆ˜ν–‰ν•œλ‹€. λ”°λΌμ„œ, $e_1$, $e_2$ μ’Œν‘œκ³„ μœ„μ— 있던 $\mathbf{x}$λ₯Ό $u_1$, $u_2$ μ’Œν‘œκ³„λ‘œ νšŒμ „ λ³€ν™˜ν•œλ‹€.

μ΄λ•Œ, $u_1$, $u_2$λŠ” $U^T$의 각 μ—΄μœΌλ‘œμ¨ $A$의 eigen vector이닀.

그리고 $U^T \mathbf{x}$λ₯Ό 계산해보면,

\[U^T \mathbf{x} = \left(u_1, u_2 \right) \cdot \mathbf{x} = \begin{pmatrix} (\mathbf{x}^T u_1) \cdot u_1 \\ (\mathbf{x}^T u_2) \cdot u_2 \end{pmatrix}\]

κ°€ 되고, 이것은 $\mathbf{x}$λ₯Ό $u_1$, $u_2$ μΆ•μœΌλ‘œ <projection>ν•œ 것과 κ°™λ‹€.

2. $D \left( U^T \mathbf{x} \right)$; 슀칼라 곱

$D$λŠ” diagnomal matrix이기 λ•Œλ¬Έμ— $u_1$, $u_2$ λ°©ν–₯의 벑터에 λŒ€ν•œ 슀칼라 곱을 ν•˜λŠ” 역할이닀.

3. $U \left( D U^T \mathbf{x} \right)$; μ›λž˜μ˜ μ’Œν‘œμΆ•μœΌλ‘œ μ—­-νšŒμ „

λ§ˆμ§€λ§‰μœΌλ‘œ μ²˜μŒμ— κ³±ν•œ $U^T$의 μ—­-νšŒμ „ λ³€ν™˜μΈ $U$λ₯Ό μ μš©ν•΄ λ‹€μ‹œ $e_1$, $e_2$의 μ’Œν‘œκ³„λ‘œ 되돌렀 μ€€λ‹€.

κ·Έλž˜μ„œ 식을 μ •λ¦¬ν•˜λ©΄, μ•„λž˜μ™€ κ°™λ‹€.

\[UDU^T \mathbf{x} = UD \begin{pmatrix} u_1^T \mathbf{x} \\ \vdots \\ u_n^T \mathbf{x} \end{pmatrix} = U \begin{pmatrix} d_1 u_1^T \mathbf{x} \\ \vdots \\ d_n u_n^T \mathbf{x} \end{pmatrix} = d_1 u_1 u_1^T \mathbf{x} + \cdots + d_n u_n u_n^T \mathbf{x}\]

Singular Value Decomposition

<Sepctral Theorem>은 λŒ€μΉ­ 행렬에 λŒ€ν•΄μ„œ κΈ°μˆ ν•œ μ •λ¦¬μ˜€λ‹€. 이것을 일반적인 ν˜•νƒœμ˜ ν–‰λ ¬λ‘œ μΌλ°˜ν™”ν•œ 것이 λ°”λ‘œ <νŠΉμ΄κ°’ λΆ„ν•΄ Singular Value Decomposition>이닀. 😎


Theorem. Singular Value Decomposition

For any $n \times p$ matrix $A$, there exist matrices $U \in \mathbb{R}^{n\times n}$, $D \in \mathbb{R}^{n\times p}$, and $V \in \mathbb{R}^{p\times p}$ s.t.

\[A = UDV^T\]

where

  • $D = \text{diag}(d_1, \dots, d_p)$ with $d_i \ge 0$
    • $d_j$s are called <singular value> of $A$.
  • $U$ is an orthogonal matrix from $AA^T = U(\Sigma\Sigma^T)U^T$
  • $V$ is an orthogonal matrix from $A^T A = V(\Sigma^T \Sigma)V^T$

Low Rank Approximation

SVDλ₯Ό 잘 μ΄μš©ν•˜λ©΄, ν–‰λ ¬ $A$에 λŒ€ν•œ <Low Rank Approximation> $A_k$λ₯Ό μœ λ„ν•  수 μžˆλ‹€.

Let $A = UDV^T$ and assume that $n \gg p$, then

\[A = \begin{bmatrix} \vert & & \vert \\ \mathbf{u}_1 & \cdots & \mathbf{u}_n \\ \vert & & \vert \\ \end{bmatrix} \begin{bmatrix} d_1 & & \\ & \ddots \\ & & d_p \\ & O & \end{bmatrix} \begin{bmatrix} - & \mathbf{v}_1^T & - \\ & \vdots & \\ - & \mathbf{v}_p^T & - \\ \end{bmatrix} = d_1 \mathbf{u}_1 \mathbf{v}_1^T + \cdots + d_p \mathbf{u}_p \mathbf{v}_p^T\]

μ΄λ•Œ, ν‘œκΈ°μ˜ 편의λ₯Ό μœ„ν•΄ singular value $d_i$에 λŒ€ν•΄ descending order둜 ν‘œκΈ°λ₯Ό ν•œλ‹€.

\[\text{where} \quad d_1 \ge d_2 \cdots \ge d_p\]

μ£Όλͺ©ν•  점은 μ‹μ˜ μš°λ³€μ˜ $\mathbf{u}_i \mathbf{v}_i^T$은 rank-1 matrixλΌλŠ” 점이닀. 즉, SVDλ₯Ό ν•˜κ²Œ 되면 ν–‰λ ¬ $A$λ₯Ό rank-1의 matrix둜 λΆ„ν•΄ν•œ 것이 λœλ‹€.

이제 μœ„μ˜ κ²°κ³Όλ₯Ό 가지고 Approximation $A_k$λ₯Ό μœ λ„ν•  수 μžˆλ‹€.

\[A_k = \begin{bmatrix} \vert & & \vert \\ \mathbf{u}_1 & \cdots & \mathbf{u}_k \\ \vert & & \vert \\ \end{bmatrix} \begin{bmatrix} d_1 & & \\ & \ddots & \\ & & d_k \\ & O & \end{bmatrix} \begin{bmatrix} - & \mathbf{v}_1^T & - \\ & \vdots & \\ - & \mathbf{v}_k^T & - \\ \end{bmatrix} = d_1 \mathbf{u}_1 \mathbf{v}_1^T + \cdots + d_k \mathbf{u}_k \mathbf{v}_k^T\]

즉, $A_k$λŠ” $A$λ₯Ό SVD둜 λΆ„ν•΄ν•΄ ν‘œν˜„ν•œ κ²ƒμ—μ„œ μ•žμ˜ $k$개의 rank-1 matrixλ₯Ό λͺ¨μ€ 것이닀! μš°λ¦¬κ°€ $d_i$λ₯Ό λ‚΄λ¦Όμ°¨μˆœμœΌλ‘œ μ •λ ¬ν•΄ ν‘œν˜„ν–ˆκΈ° λ•Œλ¬Έμ—, λ’€λ‘œ 갈수둝 μž‘μ€ $d_j$λ₯Ό μ–»κ²Œ λ˜μ–΄ μžˆλ‹€. κ·Έλž˜μ„œ $A_k$λŠ” μ•žμ˜ $k$개 $d_i$λ§Œμ„ 선택해 $A$λ₯Ό κ·Όμ‚¬ν•œ 것이닀!

μ΄λ•Œ, <Low Rank Approximation>의 errorλŠ” μ•„λž˜μ™€ 같이 <Frobenius norm>으둜 μ •μ˜ν•œλ‹€.

\[\begin{aligned} \| A - A_k \|^2_F &= \text{tr}\left( (A-A_k)^T (A-A_k) \right) \\ &= d_{k+1}^2 + d_{k+2}^2 + \cdots + d_p^2 \end{aligned}\]

κ·Έλž˜μ„œ, λ§Œμ•½ λ’·λΆ€λΆ„μ˜ $d_{k+1}, \cdots d_p$의 크기가 μž‘λ‹€λ©΄, Low Rank ApproxλŠ” μΆ©λΆ„νžˆ μ •ν™•ν•œ 근사λ₯Ό μˆ˜ν–‰ν•¨μ„ 보μž₯ν•  수 μžˆλ‹€!!

ps. 이런 Low Rank ApproxλŠ” 생각보닀 자주 μ‚¬μš©λ˜λŠ” 기법이라고 ν•œλ‹€.

ps. Netflix의 μΆ”μ²œ μ•Œκ³ λ¦¬μ¦˜ Contestμ—μ„œ 이 SVDλ₯Ό ν™œμš©ν•΄ Low Rank Approxλ₯Ό ν•˜λŠ” μΆ”μ²œ μ•Œκ³ λ¦¬μ¦˜μ„ κ΅¬ν˜„ν•œ νŒ€μ΄ μš°μŠΉμ„ μ°¨μ§€ν–ˆλ‹€κ³  ν•œλ‹€.


μ§€κΈˆκΉŒμ§€ 행렬을 λΆ„ν•΄ν•˜λŠ” 두 가지 방법인 <Spectral Decomposition>κ³Ό <Singular Value Decomposition>λ₯Ό μ‚΄νŽ΄λ΄€λ‹€. 이 두 κ°œλ…μ€ μ΄μ–΄μ§€λŠ” λ‚΄μš©μΈ ν–‰λ ¬μ˜ <Nonnegative Definite>, <Positive Definite>λ₯Ό μ •μ˜ν•  λ•Œ 바탕이 λœλ‹€.

πŸ‘‰ Supp-1: Linear Algebra - 4