Chapter 7. Model Assessment and Selection
前面章节介绍了各种模型,本章讲解如何选择模型,重点是如何评估一个模型的好坏。
引入损失函数 $L(Y,\hat{f}(x))$, 通常有 \begin{align} L(Y,\hat{f}(x)) = \begin{cases}(Y -\hat{f}(x))^2 & \textrm{squared error} \\ \left|Y-\hat{f}(x)\right| & \textrm{absolute error.}\end{cases} \end{align} 定义 test error, or generalization error 为在一个独立测试样本上的误差 \begin{align} \textrm{Err}_{T} = E\left[L(Y,\hat{f}(X)) \big| T\right] \end{align} 在所有测试样本上做平均,得到 expected prediction error or expected test error \begin{align} \textrm{Err} = E[L(Y,\hat{f}(X))] = E[\textrm{Err}_{T}] \end{align} 基于训练数据,模型也会有一定的误差,定义为 training error, \begin{align} \overline{\textrm{err}} = \frac{1}{N}\sum_{i=1}^N[L(y_i,\hat{f}(x_i))] \end{align}
如果数据足够,通常会将数据以2:1:1的比例分为训练、验证、和测试三部分,训练产生的各个模型,通过验证数据选择最佳的 (model selection),最后用测试数据评估所选择的模型 (model assessment)。常用的验证分析方法有 AIC、BIC、MDL、SRM。在数据量不足的情况下,引入 Cross-Validation 和 Bootstrap。
引入 optimism 及其 expection, \begin{align} \text{op} \equiv & \text{Err}_{\text{in}} - \overline{\text{err}} \\ \omega \equiv & E_{\mathbf{y}}(\text{op}) \end{align} For squared error, 0-1, and other loss function, \begin{align} \omega = \frac{2}{N} \sum_{i=1}^{N}\text{Cov}(\hat{y}_i,y_i) \end{align} If $\hat{y}$ is obtained by a linear fit with $d$ inputs or basis functions, \begin{align} \omega = 2\frac{d}{N}\sigma_{\epsilon}^2 \end{align}
Bootstrap 有个 overfit 的问题,因为训练的数据与测试的数据可能重合,当 $N \rightarrow \infty$ 的时候,重合概率为 $\lim_{N\rightarrow \infty} 1+\left(1-\frac{1}{N}\right)^N \approx 1- e^{-1} = 0.632$。这个正是 switching network 中的 blocking probability。
本章讨论的内容很基础,也很有意思,深挖的话是一个很长的历史故事,写起来应该很精彩。但是最近实在是太懒了,而且可以预见,之后 AI 用到的无非是 Cross-validation 或者 bootstrap。这两个试用于数据集小的情况,非常好用,但是说不清楚道理。Bootstrap 的内涵,以后再说吧。