asadoughi / stat-learning

Notes and exercise attempts for "An Introduction to Statistical Learning"
http://asadoughi.github.io/stat-learning
2.12k stars 1.62k forks source link

Chapter 4 - Exercise 3 #80

Closed eugene123tw closed 2 years ago

eugene123tw commented 7 years ago

The answer you gave is rather misleading.
And the $\delta_{k}(x)$ is not correct compare to (4.23).
The answer should be simplified.


Since we have
\begin{gather} $f{k}(x) = \frac{1}{(2 \pi)^{1/2}\sigma{k}} e^{-\frac{1}{2}(x-\mu{k})^{T}\sigma{k}^{-1}(x-\mu_{k})}$ \end{gather}

For $\delta_{k}(x)$,

\begin{align} \delta{k}(x) &= \log \big( f{k}(x)\pi{k} \big) \
&= -\log (2 \pi)^{1/2} - \log \sigma
{k} - \frac{1}{2}(x-\mu{k})^{T} \sigma{k}^{-1}(x-\mu{k}) + \log \pi{k} \
&= - \log \sigma{k}-\frac{1}{2}(x-\mu{k})^{T}\sigma{k}^{-1}(x-\mu{k}) + \log \pi{k} + c \
&= - \log \sigma
{k} + \log \pi{k} -\frac{1}{2}\sigma{k}^{-1}(x-\mu_{k})^{2}
\end{align}

$c$ can be cancelled due to it is merely a constant for all $K$ functions. The above formula will generate an quadratic term $x^{2}$.