# 广义交叉验证

**广义交叉验证**（Generalized cross-validation，GCV）是线性统计模型和反问题中用于选择正则化参数或平滑参数的一种准则。它是留一交叉验证的一种旋转不变近似，只需对全数据做一次拟合即可计算，无需为每个留出点重新训练模型。该方法由彼得·克雷文（Peter Craven）和威斯康星大学麦迪逊分校统计学家格蕾丝·瓦赫巴（Grace Wahba）在1979年一篇关于用样条函数平滑含噪数据的论文中提出；同年，斯坦福大学的吉恩·戈卢布（Gene Golub）、橡树岭国家实验室的迈克尔·希思（Michael Heath）和瓦赫巴对岭回归情形作了分析。<sup>[1](https://pages.stat.wisc.edu/~wahba/stat860public/pdf1/craven.wahba.pdf)</sup><sup> • </sup><sup>[2](https://www.tandfonline.com/doi/abs/10.1080/00401706.1979.10489751)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 克雷文和瓦赫巴，《用样条函数平滑含噪数据》，《Numerische Mathematik》第31卷，377–403页（1979年）<sup>[1](https://pages.stat.wisc.edu/~wahba/stat860public/pdf1/craven.wahba.pdf)</sup> |
| 岭回归形式 | 戈卢布、希思和瓦赫巴，《Technometrics》第21卷第2期，1979年；GCV 是艾伦的 PRESS（普通交叉验证）的旋转不变版本<sup>[2](https://www.tandfonline.com/doi/abs/10.1080/00401706.1979.10489751)</sup> |
| 准则 | \( Q_{\mathrm{GCV}}(\lambda) = \frac{\frac{1}{n}\sum_{j=1}^{n}(y_j - \hat{f}_{\lambda}(t_j))^2}{\left(1 - \frac{1}{n}\mathrm{trace}(S_\lambda)\right)^2} \)，其中 \( S_\lambda \) 是平滑（帽子）矩阵<sup>[3](https://www.richardpmann.com/MATH5824/5_smoothingparameter.html)</sup> |
| 分母的作用 | 将帽子矩阵的每个对角元素 \( s_{jj} \) 替换为它们的平均值 \( \mathrm{edf}_\lambda / n \)，即每个观测的有效自由度<sup>[3](https://www.richardpmann.com/MATH5824/5_smoothingparameter.html)</sup> |
| 噪声要求 | 与莫罗佐夫偏差原理不同，GCV 不需要噪声水平的估计；它只使用数据<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9684479/)</sup> |
| 主要失效模式 | 在相关误差或相关样本下不相合；对于规模大于 1 的惩罚估计量有限集成也不相合<sup>[5](https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-842X.1989.tb00510.x)</sup><sup> • </sup><sup>[6](https://arxiv.org/abs/2408.04607)</sup><sup> • </sup><sup>[7](https://arxiv.org/abs/2310.01374)</sup> |
| 软件使用 | R 的 mgcv 包中的平滑度选择准则；出于向后兼容，它仍是 `gam` 的默认方法<sup>[8](https://stat.ethz.ch/R-manual/R-devel/library/mgcv/help/gam.html)</sup> |

## 准则如何构建

对于线性平滑器，拟合值可写成 \( \hat{f}_\lambda = S_\lambda y \)，其中 \( S_\lambda \) 是把观测数据映射为拟合值的帽子矩阵或平滑矩阵。普通留一交叉验证（OCV）衡量拟合对每个被留出点的预测效果。一个矩阵恒等式（舍曼-莫里森-伍德伯里公式）使 OCV 无需任何重新训练即可精确计算，且只使用平滑矩阵的对角元素 \( S_{ii} \)：<sup>[9](https://edf-lab.github.io/tam/math/core/05_gcv_theory.html)</sup>

\[ Q_{\mathrm{OCV}}(\lambda) = \frac{1}{n} \sum_{j=1}^{n} \left( \frac{y_j - \hat{f}_{\lambda}(t_j)}{1 - s_{jj}} \right)^2. \]

戈卢布、希思和瓦赫巴表明，这种 OCV 准则不是旋转不变的，并且当设计不平衡时可能变得不稳定，例如某个 \( S_{ii} \) 接近 1 时。GCV 通过将每个 \( s_{jj} \) 替换为对角元素的平均值来修正这一点；该平均值等于 \( \mathrm{trace}(S_\lambda)/n \)，即拟合的有效自由度除以观测数：<sup>[2](https://www.tandfonline.com/doi/abs/10.1080/00401706.1979.10489751)</sup><sup> • </sup><sup>[9](https://edf-lab.github.io/tam/math/core/05_gcv_theory.html)</sup><sup> • </sup><sup>[3](https://www.richardpmann.com/MATH5824/5_smoothingparameter.html)</sup>

平滑参数 \(\lambda\) 的 GCV 得分，是将残差平方 \(y_j - \hat{f}_{\lambda}(t_j)\) 在 \(j = 1, \dots, n\) 上求和并按 \(1/n\) 缩放后的均值，除以 \(\left( 1 - \frac{1}{n} \mathrm{trace}(S_\lambda) \right)^2\)。

分子是全数据拟合的均方残差；分母通过有效自由度 \( \mathrm{edf}_\lambda = \mathrm{trace}(S_\lambda) \) 惩罚模型复杂度。因此，在 \(\lambda\) 上最小化该得分可在拟合与平滑之间取得平衡。每次评估得分需要一次线性求解和一次迹计算，这使得对 \(\lambda\) 进行网格搜索或数值搜索比反复重新拟合更便宜。<sup>[3](https://www.richardpmann.com/MATH5824/5_smoothingparameter.html)</sup>

**计算成本。** 直接评估需要计算一个 \( n \times n \) 平滑矩阵的迹，名义上是 \( \mathcal{O}(n^3) \) 操作。实践中，迹可从用于求解正则化系统的特征分解中廉价地计算出来；对于网格上的平滑等结构化问题，得分可化为特征值求和，完全不需要矩阵运算。<sup>[9](https://edf-lab.github.io/tam/math/core/05_gcv_theory.html)</sup><sup> • </sup><sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC4008475/)</sup>

## 与其他参数选择规则的关系

GCV 属于一类经典规则，用于在吉洪诺夫正则化和样条平滑中选择正则化参数 \( \lambda \)。莫罗佐夫偏差原理寻找一个 \( \lambda \)，使残差大小与数据中的噪声水平相匹配，因此需要 \( \|e\| \) 的估计。L 曲线法选取解范数对残差范数的双对数图的拐角。GCV 则从留一交叉验证定义其准则，除数据本身外不需要任何其他信息。<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC9684479/)</sup>

比较研究并未产生普遍优胜者。在同一个逆传热问题上比较五种方法（最大似然、OCV、GCV、L 曲线和偏差原理）时，偏差原理给出了正则化参数的最佳估计，OCV 和 GCV 通常位列第二和第三；最大似然方法稳定，但总是估计出比解析解更小的正则化参数。<sup>[11](https://www.tandfonline.com/doi/abs/10.1080/10407790601128592)</sup> 在矩形板上的逆力确定中，高噪声水平下 L 曲线法优于 OCV 或 GCV，但在低噪声下过度正则化，低估了力；而当矩阵条件数较高时，OCV 胜过 GCV，这使得在该研究中 OCV 是两种交叉验证规则里整体上更可靠的一种。<sup>[12](https://www.sciencedirect.com/science/article/pii/S0022460X0700226X)</sup>

最近一项基准测试以已知真实解选出的理想 \( \lambda \)为参照给各规则打分，说明了这种权衡。在 1% 噪声下进行二十四次抽样时，GCV 的吉洪诺夫误差中位数为理想值的 1.034 倍，偏差原理为 1.041 倍，L 曲线为 1.444 倍；在 1% 和 0.1% 噪声下，GCV 分别落在理想 \( \lambda \) 的 0.71 和 0.89 倍处，而偏差原理选出的参数则分别为理想值的 2.2 倍和 3.0 倍。同一篇文章指出，在低于百分之十的每个噪声水平上，交叉验证与理想值相差不超过 2%。<sup>[13](https://www.numerical-linear-algebra.com/essays/the-rule-that-is-wrong-in-the-right-direction/)</sup><sup> • </sup><sup>[14](https://www.numerical-linear-algebra.com/essays/choosing-without-knowing/)</sup>

## 已知失效模式

**相关误差。** 标准准则假设误差独立且具有共同未知方差。迪格尔和哈钦森通过模拟表明，在存在自相关误差时，使 GCV 最小的平滑样条是不相合估计量；即使忽略中等程度的自相关，也可能严重影响交叉验证拟合；将准则推广到自相关误差序列的扩展已被提出。<sup>[5](https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-842X.1989.tb00510.x)</sup>

**相关样本。** 在训练点任意相关的高维岭回归中，阿塔纳索夫、扎瓦托内-韦思和佩赫莱万表明，GCV 估计量无法正确预测样本外风险。当噪声残差与数据点具有相同相关结构时，他们称为 CorrGCV 的修正估计量可高效计算、无偏，并在高维极限下集中。<sup>[6](https://arxiv.org/abs/2408.04607)</sup>

**有限集成。** GCV 通过对训练误差平方施加标量乘性自由度调整，来估计样本外预测风险的平方。对于惩罚最小二乘估计量的集成，这对任何规模大于 1 的有限集成都是不相合的；修正估计量 CGCV 加入加性标量修正，在保持 GCV 计算优势的同时恢复相合性。<sup>[7](https://arxiv.org/abs/2310.01374)</sup>

## 相合性理论

两项近期结果进一步明确了 GCV 何时可信。扬和基里林严格证明了留一 GCV 作为反问题参数选择规则的相合性，证明 GCV 选出的指标以高概率对多项式病态紧算子达到非渐近、阶最优误差界；值得注意的是，未知真实解无需满足其他启发式规则通常要求的自相似条件。<sup>[15](https://arxiv.org/abs/2506.14558)</sup> 对于高维误设定线性模型，申奎表明，如果设定误差的二阶矩收敛到零，那么即使候选集包含零和负调优参数，GCV 仍是样本外预测风险的一致相合估计量，因此由 GCV 调优的岭回归渐近地在候选者中达到最小预测风险；模拟显示，在模型设定正确与不正确时，其性能与最优调优岭回归相似，且优于 Lasso。<sup>[16](https://arxiv.org/abs/2601.13955)</sup>

## 应用

GCV 是惩罚回归软件中的标准平滑度选择准则。在 R 的 mgcv 包中，`gam` 使用 GCV 准则及其他选项（UBRE、AIC、REML）求解平滑参数估计问题；尽管实践中常推荐 REML，GCV 出于向后兼容仍是默认方法。<sup>[8](https://stat.ethz.ch/R-manual/R-devel/library/mgcv/help/gam.html)</sup> R 函数 `smooth.spline` 将 GCV 作为默认调优选项。<sup>[17](https://doi.org/10.3390%2Fstats4030042)</sup>

在成像中，基于 GCV 和基于 SURE 的方法已被开发用于在加性、可能为复高斯噪声下，非线性迭代图像恢复和 MRI 重建中自动选择正则化参数。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC3411925/)</sup> 在神经影像中，由 GCV 选择平滑度的平滑样条为 fMRI 时间序列提供了最优平滑器。<sup>[19](https://pubmed.ncbi.nlm.nih.gov/12725770/)</sup> 扩展不断出现，包括针对保真项和正则项分别用 p 范数和 q 范数定义、且 \( 0 < p, q \le 2 \) 的 \( \ell^p \)-\( \ell^q \) 最小化问题的基于 GCV 的自动参数选择。<sup>[20](https://link.springer.com/article/10.1007/s11075-021-01087-9)</sup>

## References

1. [Peter Craven and Grace Wahba (1979). Smoothing noisy data with spline functions: estimating the correct degree of smoothing by the method of generalized cross-validation. Numerische Mathematik 31, 377–403.](https://pages.stat.wisc.edu/~wahba/stat860public/pdf1/craven.wahba.pdf)
2. [Gene H. Golub, Michael Heath, and Grace Wahba (1979). Generalized Cross-Validation as a Method for Choosing a Good Ridge Parameter. Technometrics 21(2).](https://www.tandfonline.com/doi/abs/10.1080/00401706.1979.10489751)
3. [MATH5824, Section 5: Choosing the Smoothing Parameter (Richard Mann, University of Leeds).](https://www.richardpmann.com/MATH5824/5_smoothingparameter.html)
4. [Span of regularization for solution of inverse problems with application to magnetic resonance relaxometry of the brain. PMC9684479.](https://pmc.ncbi.nlm.nih.gov/articles/PMC9684479/)
5. [P. J. Diggle and M. F. Hutchinson (1989). On spline smoothing with autocorrelated errors. Australian Journal of Statistics.](https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1467-842X.1989.tb00510.x)
6. [Alexander Atanasov, Jacob A. Zavatone-Veth, and Cengiz Pehlevan (2024). Risk and cross validation in ridge regression with correlated samples. arXiv:2408.04607.](https://arxiv.org/abs/2408.04607)
7. [Corrected generalized cross-validation for finite ensembles of penalized estimators. arXiv:2310.01374.](https://arxiv.org/abs/2310.01374)
8. [gam: Generalized additive models with integrated smoothness estimation, mgcv documentation.](https://stat.ethz.ch/R-manual/R-devel/library/mgcv/help/gam.html)
9. [Hyperparameter Optimization: Generalized Cross-Validation (GCV), TAM documentation.](https://edf-lab.github.io/tam/math/core/05_gcv_theory.html)
10. [Robust smoothing of gridded data in one and higher dimensions with missing values. PMC4008475.](https://pmc.ncbi.nlm.nih.gov/articles/PMC4008475/)
11. [Optimal Numerical Methods for Choosing an Optimal Regularization Parameter. Numerical Heat Transfer, Part B, Vol 51, No 6.](https://www.tandfonline.com/doi/abs/10.1080/10407790601128592)
12. [Comparison of methods for parameter selection in Tikhonov regularization with application to inverse force determination. Journal of Sound and Vibration.](https://www.sciencedirect.com/science/article/pii/S0022460X0700226X)
13. [The rule that is wrong in the right direction. Numerical Linear Algebra essays.](https://www.numerical-linear-algebra.com/essays/the-rule-that-is-wrong-in-the-right-direction/)
14. [Choosing without knowing. Numerical Linear Algebra essays.](https://www.numerical-linear-algebra.com/essays/choosing-without-knowing/)
15. [Tim Jahn and Mikhail Kirilin (2025). Convergence of generalized cross-validation with applications to ill-posed integral equations. arXiv:2506.14558.](https://arxiv.org/abs/2506.14558)
16. [Akira Shinkyu (2026). Uniform Consistency of Generalized Cross-Validation for Ridge Regression in High-Dimensional Misspecified Linear Models. arXiv:2601.13955.](https://arxiv.org/abs/2601.13955)
17. [Cross-Validation, Information Theory, or Maximum Likelihood? A Comparison of Tuning Methods for Penalized Splines. Stats 4(3).](https://doi.org/10.3390%2Fstats4030042)
18. [Regularization Parameter Selection for Nonlinear Iterative Image Restoration and MRI Reconstruction Using GCV and SURE-Based Methods. PMC3411925.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3411925/)
19. [Optimal spline smoothing of fMRI time series by generalized cross-validation. PubMed 12725770.](https://pubmed.ncbi.nlm.nih.gov/12725770/)
20. [Generalized cross validation for ℓp–ℓq minimization. Numerical Algorithms.](https://link.springer.com/article/10.1007/s11075-021-01087-9)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistical inference, estimation, sampling, and testing › Estimation theory and estimator families › Robust statistics and resampling › Cross-validation and statistical model assessment

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/generalized-cross-validation

English original: https://www.edgepedia.org/generalized-cross-validation
