PRML Exercise 2.38

永井 忠一 2020.5.17


平方完成

\( -A\mu^2 + 2B\mu + C = -A(\mu - \frac{B}{A})^2 + \frac{B^2}{A} + C\)\[ \begin{align} \therefore \exp(-A\mu^2 + 2B\mu + C) &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 + \frac{B^2}{A} + C \right\} \\ &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 \right\} \cdot \exp\left( \frac{B^2}{A} + C \right) \end{align} \]

\( \mu \) が含まれないところ(\( \exp\left( \frac{B^2}{A} + C \right) \))は、最終的に正規化係数に吸収されてしまうので、計算する必要はない\[ \begin{align} \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 + \frac{B^2}{A} + C \right\} &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 + \mathrm{const.} \right\} \\ &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 \right\} \cdot \exp(\mathrm{const.}) \\ &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 \right\} \times \mathrm{const.} \end{align} \]

考えていた事後分布の式を再掲載\[ p(\mu|\mathbf x) \propto \exp \left\{ -\left( \frac{N}{2\sigma^2} + \frac{1}{2\sigma^2_0} \right)\mu^2 + 2\left( \frac{\sum_n x_n}{2\sigma^2} + \frac{\mu_0}{2\sigma^2_0} \right)\mu + \mathrm{const.} \right\} \]

\( A = \frac{N}{2\sigma^2} + \frac{1}{2\sigma^2_0},\ B = \frac{\sum_nx_n}{2\sigma^2} + \frac{\mu_0}{2\sigma^2_0} \) とおき、平方完成する\[ \begin{align} p(\mu|\mathbf x) &\propto \exp\left( -A\mu^2 + 2B\mu + \mathrm{const.} \right) \\ &= \exp\left\{ -A\left( \mu-\frac{B}{A} \right)^2 \right\} \times \mathrm{const.} \end{align} \]

【知識】ガウス分布 

\[ ~ \mathcal N(\mu|m, S^2) = \frac{1}{\sqrt{2\pi S^2}}\exp\left\{ -\frac{1}{2S^2}(\mu - m)^2 \right\} \]

式を見比べてあてはめると、確率分布は\[ \begin{align} p(\mu|\mathbf x) &= \mathrm{const.} \times \exp\left\{ -A\left( \mu - \frac{B}{A} \right)^2 \right\} \\ &= \frac{1}{\sqrt{2\pi\left(\frac{2}{A}\right)}}\exp\left\{ -\frac{1}{2\left( \frac{2}{A} \right)}\left( \mu - \frac{B}{A} \right)^2 \right\} \\ &= \mathcal N\left(\mu|\frac{B}{A}, \frac{2}{A} \right) = \mathcal N\left(\mu|\mu_N, \sigma^2_N \right) \end{align} \]となる

教科書


© 2020 Tadakazu Nagai