1. 程式人生 > 其它 >PRML-公式推導 - 1.90,3.40

PRML-公式推導 - 1.90,3.40

https://biggerhao.github.io/blog/2018/03/PRML-1-90/

原文回顧

\(在上文中,我們已經推匯出了 (y(\mathbf{x})\) 的最優解是給定 \(\mathbf{x}\) 的 \(t\) 的條件期望。 \[ y(\mathbf{x}) = \frac{\int tp(\mathbf{x}, t) \mathrm{d}t}{p(\mathbf{x})} = \int tp(t|\mathbf{x}) \mathrm{d}t = \mathbb{E}_t[t|\mathbf{x}] \tag{1.89} \] 而期望損失的定義如下 \[ \mathbb{E}[L] = \int \int \{ y(\mathbf{x})-t \}^2 p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t \tag{1.87}\]\)


公式推導

\(對式 (1.87) 中的平方項進行如下的替換 \begin{align*} \{ y(\mathbf{x})-t \}^2 &= \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] + \mathbb{E}[t|\mathbf{x}] -t \}^2 \\ &= \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \}^2 + 2 \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \{ \mathbb{E}[t|\mathbf{x}] - t \} + \{ \mathbb{E}[t|\mathbf{x}] - t\}^2 \end{align*}\)

從而可得
\(\begin{align*} \mathbb{E}[L] &= \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \}^2 p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t + 2 \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \{ \mathbb{E}[t|\mathbf{x}] - t \} p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t \\ &+ \int\int \{ \mathbb{E}[t|\mathbf{x}] - t\}^2 p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t \end{align*}\)

其中
\(\begin{align*} &\int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \{ \mathbb{E}[t|\mathbf{x}] - t \} p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t \\ =& \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \mathbb{E}[t|\mathbf{x}] p(\mathbf{x},t) \mathrm{d}t\mathrm{d}\mathbf{x} - \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} t p(\mathbf{x},t) \mathrm{d}t \mathrm{d}\mathbf{x} \\ =& \int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \mathbb{E}[t|\mathbf{x}] p(\mathbf{x}) \mathrm{d}\mathbf{x} - \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} t p(t|\mathbf{x})p(\mathbf{x}) \mathrm{d}t \mathrm{d}\mathbf{x} \\ =& \int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \mathbb{E}[t|\mathbf{x}] p(\mathbf{x}) \mathrm{d}\mathbf{x} - \int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \} \mathbb{E}[t|\mathbf{x}] p(\mathbf{x}) \mathrm{d}\mathbf{x} \\ =& 0 \end{align*}\)
\(注意當(\mathbf{x})給定時,(\mathbb{E}[t|\mathbf{x}]) 的值是確定的,因此在對 (t) 進行積分時,(\mathbb{E}[t|\mathbf{x}]) 相當於常數.\)

\(從而有\)
\(\begin{align*} \mathbb{E}[L] &= \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \}^2 p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t + \int\int \{ \mathbb{E}[t|\mathbf{x}] - t\}^2 p(\mathbf{x},t) \mathrm{d}\mathbf{x} \mathrm{d}t \\ &= \int\int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \}^2 p(\mathbf{x},t) \mathrm{d}t \mathrm{d}\mathbf{x} + \int\int \{ \mathbb{E}[t|\mathbf{x}] - t\}^2 p(t|\mathbf{x})p(\mathbf{x}) \mathrm{d}t \mathrm{d}{\mathbf{x}} \ \\ &= \int \{ y(\mathbf{x}) - \mathbb{E}[t|\mathbf{x}] \}^2 p(\mathbf{x}) \mathrm{d}\mathbf{x} + \int \mathrm{var}[t|\mathbf{x}]p(\mathbf{x}) \mathrm{d}\mathbf{x} \end{align*}\)

\(其中(以下省略了 (\mathbb{E}) 右下角的角標 (t)\)
\(\begin{align*} \mathrm{var}[t|\mathbf{x}] =& \mathbb{E} [(t- \mathbb{E}[t|\mathbf{x}])^2| \mathbf{x}] \\ =& \int (t- \mathbb{E}[t|\mathbf{x}])^2 p(t|\mathbf{x}) \mathrm{d}t \end{align*}\)
\(注意原書中式 (1.90) 等號右側的第二項是錯誤的,在對 (\mathbf{x}) 的被積函式中不可能出現未知的 (t),這一錯誤在官方的勘誤表中已經作出了修正。\)

公式3.40推導類似