Continuous Least-squared Method
์ํ๊ณผ ๋ณต์์ ๊ณต์ ์ํด ์กธ์ ๋ง์ง๋ง ํ๊ธฐ์ โ์์นํด์๊ฐ๋ก โ ์์ ์ ๋ฃ๊ฒ ๋์์ต๋๋ค. ์ํ๊ณผ ์กธ์ ์ํ๋ ๊ฒธ์ฌ๊ฒธ์ฌ ์ค๋นํ ๊ฒธ ํ์ดํ ํด๋ด ์๋ค!! ์ ์ฒด ํฌ์คํธ๋ โNumerical Analysisโ์์ ํ์ธํ ์ ์์ต๋๋ค.
๋ค์ด๊ฐ๋ฉฐ
์ด์ ํฌ์คํธ์์ $n$๊ฐ ๋ฐ์ดํฐ ๋ ธ๋ $\left\{ (x_i, y_i) \right\}$๊ฐ ์ฃผ์ด์ก์ ๋, Least-square Method๋ฅผ ์ํํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด์์ต๋๋ค.
์ด๋ฒ ํฌ์คํธ์์๋ ๋ฐ์ดํฐ ๋ ธ๋๊ฐ ์ ํํ ๊ฐฏ์๊ฐ ์๋๋ผ ๊ตฌ๊ฐ $(a, b) \subseteq \mathbb{R}$๋ก ์ฃผ์ด์ง๋๋ค. ์ด ๊ตฌ๊ฐ ์์์ Least-square Method๋ฅผ ์ํํ๋ ๊ฒ์ โContinuous LSโ(์ดํ CLS)๋ผ๊ณ ํฉ๋๋ค!
Introduction
CLS์ ๋ชฉํ๋ ์ด๋ค ํจ์ $f(x)$๋ฅผ ํจ์ ์งํฉ $\left\{ \phi_0(x), \phi_1(x), \dots, \phi_n(x) \right\}$์ ์ ํ ๊ฒฐํฉ์ผ๋ก ๊ทผ์ฌํ๋ ๊ฒ ์ ๋๋ค. ๋ณดํต์ ์ด ํจ์ ์งํฉ์ ๋คํญ ํจ์์ ์งํฉ $\left\{ 1, x, x^2, \dots, \right\}$ ์ ๋๋ค.
\[f(x) \approx \sum_{j=0}^n c_j \phi_j(x)\]์ด๋, ๊ณ์ $c_j$๋ ์๋์ ์ ๊ณฑ ์ค์ฐจ์ ์ ๋ถ์ ์ต์ํ ํ๋ ๊ณ์๋ฅผ ์ฌ์ฉํฉ๋๋ค.
\[SSE(\mathbf{c}) = \int_a^b \left(f(x) - \sum_{j=0}^n c_j \phi_j(x) \right)^2 w(x) \, dx\]์ด๋, $w(x)$๋ ๊ฐ์ค์น ํจ์์ธ๋ฐ, ๋ณดํต $w(x) = 1$๋ก ๋๊ณ ํ๋๋ค.
Normal Equation
์ต์ SSE๋ฅผ ์ป๊ธฐ ์ํด, ์ ๋ถ์์ ๊ฐ ๊ณ์ $c_i$์ ๋ํด ํธ๋ฏธ๋ถํ ๊ฐ์ 0์ผ๋ก ๋๊ณ ๋ฐฉ์ ์์ ๊ตฌ์ฑํฉ๋๋ค.
\[\begin{aligned} \frac{\partial SSE}{\partial c_i} &= \int_a^b \left(f(x) - \sum_{j=0}^n c_j \phi_j(x) \right)^2 \, dx \\ &= 2 \int_a^b \left(f(x) - \sum_{j=0}^n c_j \phi_j(x) \right) \left(- c_i \phi_i(x)\right) \, dx = 0 \end{aligned}\]์ด์ ์ด ๋ฑ์์ ์ ๋ฆฌํ๋ฉด,
\[\int_a^b \left(f(x) - \sum_{j=0}^n c_j \phi_j(x) \right) \cdot \phi_i(x) \, dx = 0\]์ข์ฐ๋ฅผ ๋ง์ถฐ์ฃผ๋ฉด,
\[\int_a^b f(x) \cdot \phi_i(x) \, dx = \int_a^b \left(\sum_{j=0}^n c_j \phi_j(x)\right) \cdot \phi_i(x) \, dx\]๊ทธ๋ฆฌ๊ณ ์ฌ๊ธฐ์์ ์์ ์ข๋ ๋ค๋ฌ์ด์ฃผ๋ฉด,
\[\int_a^b f(x) \cdot \phi_i(x) \, dx = \sum_{j=0}^n c_j \cdot \left(\int_a^b \phi_j(x) \cdot \phi_i(x) \, dx\right)\]์ข/์ฐ๋ณ์ ์๋ฏธ๋ฅผ ์ดํด๋ณด๋ฉด,
- ์ข๋ณ
- $f(x)$์ ๊ธฐ์ ํจ์ $\phi_i(x)$์ ๋ด์
- ์ฐ๋ณ
- ๊ณ์ $c_j$์ ๊ธฐ์ ํจ์๋ค ์ฌ์ด์ ๋ด์ ์ผ๋ก ๋ง๋ค์ด์ง ์ ํ ์์คํ
์ฐ๋ณ์ด ์ ์ ํ ์์คํ ์ด๋๋ฉด,
\[\sum_{j=0}^n c_j \cdot \left(\int_a^b \phi_j(x) \cdot \phi_j(x) \, dx\right) = \begin{bmatrix} c_0 \\ c_1 \\ \vdots \\ c_n \end{bmatrix} \begin{bmatrix} \int_a^b \phi_0(x) \cdot \phi_i(x) \, dx \\ \int_a^b \phi_1(x) \cdot \phi_i(x) \, dx \\ \vdots \\ \int_a^b \phi_n(x) \cdot \phi_i(x) \, dx \end{bmatrix}\]์ด๊ฒ ์ด๊ฑธ ํ๋ ฌ ํํ๋ก ์ ๋ฆฌํ๋ฉด,
\[X \theta = \mathbf{y}\]- $X_{ij} = \int_a^b \phi_i(x) \phi_j(x) \, dx$
- $\theta_i = \int_a^b f(x) \phi_i(x) \, dx$
- $\mathbf{y} = [c_0, c_1, \dots, c_n]^T$
์ง๊ด์ ์ผ๋ก ์ ์ ์๋ ์ฑ์ง์ ๊ธฐ์ ํ๋ ฌ์ ๋ด์ ์ผ๋ก ๋ง๋ค์ด์ง๋ ํ๋ ฌ $X$๋ ํญ์ โ๋์นญ ํ๋ ฌโ์ ๋๋ค. (ํจ์) ๋ด์ ์ ๋์นญ์ ์ธ ์ฑ์ง์ ๊ฐ์ง๊ณ ์๊ธฐ ๋๋ฌธ์ ๋๋ค.
Example
์์ ๋ฅผ ํตํด ์ต์ํด์ ธ๋ด ์๋ค. $f(x) = e^x$๋ฅผ $[0, 1]$ ๊ตฌ๊ฐ์์ 1์ฐจ ๋คํญ์์ผ๋ก ๊ทผ์ฌํด๋ณด๊ฒ ์ต๋๋ค. ์ฆ, $\tilde{f}(x) = c_0 + c_1 x$. ๊ฐ์ค์น๋ ๊ฐ์ฅ ๋จ์ํ $w(x) = 1$๋ก ํ๊ฒ ์ต๋๋ค.
๊ฐ์ฅ ๋จผ์ ๊ธฐ์ ํจ์๋ก ๋ง๋๋ ํ๋ ฌ์ ๊ณ์ฐํฉ๋๋ค.
\[X_{ij} = \int_0^1 \phi_i(x) \phi_j(x) \, dx\] \[X = \begin{bmatrix} \int_0^1 1 \cdot 1 \, dx & \int_0^1 1 \cdot x \, dx \\ \int_0^1 1 \cdot 1 \, dx & \int_0^1 x \cdot x \, dx \end{bmatrix} = \begin{bmatrix} 1 & 1/2 \\ 1/2 & 1/3 \end{bmatrix}\]๊ธฐ์ ํจ์์ ์๋ณธ ํจ์์ ๋ด์ ์ธ ๋ฒกํฐ $\theta$๋ ๊ตฌํด๋ด ์๋ค.
\[\theta_i = \int_0^1 f(x) \phi_i(x) \, dx\] \[\theta = \begin{bmatrix} \int_0^1 e^x \cdot 1 \, dx \\ \int_0^1 e^x \cdot x \, dx \end{bmatrix} = \begin{bmatrix} e - 1 \\ 1 \end{bmatrix}\]์ด์ ์ ํ ์์คํ ์ ๋ง๋ค์ด๋ด ์๋ค.
\[\begin{bmatrix} 1 & 1/2 \\ 1/2 & 1/3 \end{bmatrix} \begin{bmatrix} c_0 \\ c_1 \end{bmatrix} = \begin{bmatrix} e - 1 \\ 1 \end{bmatrix}\]์์คํ ์ ๊ธฐ์กด์ ์ด์ฐ LS ๋ฐฉ์์ผ๋ก ํ์ด๋ด๋ฉด ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ฉด ๊ณ์๋ $c_0 = 6e-8$, $c_1 = -6e+14$๋ก ๋์ค๊ณ , ํจ์ $f(x) = e^x$์ ๊ตฌ๊ฐ $[0, 1]$์์์ ๊ทผ์ฌํ 1์ฐจ ํจ์๋
\[f(x) \approx (-6e+14) x + (6e-8)\]