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推导类似

考虑式(3.37)的第一项的被积函数,对于一个特定的数据集\(D\),它的形式为:

\[\{y(x;D)−h(x)\}^2 \tag{3.38} \]

展开有

\[\begin{array}{c} \left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]+\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}^{2} \\ =\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}^{2}+\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}^{2} \\ \quad+2\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\} \end{array} \tag{3.39}\]

再在\(D\)上求期望

其中3.39中的
第一项求期望后
\(\mathbb{E}_{\mathcal{D}}[\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}^{2}],也就是下面的方差项\)
第二项求期望后
\(\mathbb{E}_{\mathcal{D}}[\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}^{2}],因为h(x)和D无关,所以这一项不动,仍然=\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}^{2}\)
第三项求期望后
\(\mathbb{E}_{\mathcal{D}}[2\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}]=0\)
\(其中\mathbb{E}_{\mathcal{D}}[2\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}]=2\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]=0\)

\[\begin{array}{l} \mathbb{E}_{\mathcal{D}}\left[\{y(\boldsymbol{x} ; \mathcal{D})-h(\boldsymbol{x})\}^{2}\right] \\ =\underbrace{\left\{\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]-h(\boldsymbol{x})\right\}^{2}}_{(\text {偏置 })^{2}}+\underbrace{\mathbb{E}_{\mathcal{D}}\left[\left\{y(\boldsymbol{x} ; \mathcal{D})-\mathbb{E}_{\mathcal{D}}[y(\boldsymbol{x} ; \mathcal{D})]\right\}^{2}\right]}_{\text {方差 }} \end{array} \tag{3.40} \]

posted @ 2022-03-19 15:57  筷点雪糕侠  阅读(186)  评论(0编辑  收藏  举报