# 核岭回归

核岭回归（KRR）是一种非线性回归方法，它在核诱导的特征空间中求解带L2正则化的最小二乘问题，为连续目标变量产生闭式预测器。<sup>[1](https://scikit-learn.org/stable/modules/kernel_ridge.html)</sup> 它将岭回归——带L2惩罚的线性最小二乘估计器——与核技巧相结合，因此对于非线性核，所学到的函数在特征空间中是线性的，但在原始输入中是非线性的。<sup>[1](https://scikit-learn.org/stable/modules/kernel_ridge.html)</sup> KRR用于中小规模的监督回归问题，包括分子性质预测、医疗数据建模和基因组预测。<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 岭回归（带L2正则化的最小二乘）与核技巧的结合<sup>[1](https://scikit-learn.org/stable/modules/kernel_ridge.html)</sup> |
| 闭式解 | \( \alpha^{*} = (K + \lambda I)^{-1} y \)，其中 \( K \) 是 n × n 核矩阵<sup>[3](https://web2.qatar.cmu.edu/~gdicaro/10315-Fall19/additional/welling-notes-on-kernel-ridge.pdf)</sup> |
| 精确计算代价 | 对于 n 个训练样本，时间为 \( O(n^{3}) \)，内存为 \( O(n^{2}) \)<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup> |
| 稀疏性 | 核展开通常是完全稠密的，不同于支持向量回归<sup>[5](http://theoval.cmp.uea.ac.uk/publications/pdf/npl2002a.pdf)</sup> |
| 与GPR的关系 | KRR估计与克里金（高斯过程回归）的后验均值一致；GPR额外输出不确定性<sup>[6](https://arxiv.org/html/2311.01762v2)</sup><sup> • </sup><sup>[7](https://scikit-learn.org/stable/auto_examples/gaussian_process/plot_compare_gpr_krr.html)</sup> |
| 典型核 | RBF、拉普拉斯核、Matérn-5/2、高斯核<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup> |
| 近似方法 | Nyström方法和随机特征将代价降至 \( O(n^{3/2}) \)，代价是额外的误差<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup> |

## 工作原理

KRR被表述为再生核希尔伯特空间（RKHS）中的正则化经验风险最小化，RKHS是与所选核相关联的函数空间。该估计器最小化平方误差之和加上 \( \lambda \cdot \|f\|_{\mathcal{H}}^{2} \)，其中 \( \lambda > 0 \) 调节拟合数据与模型复杂度之间的权衡。<sup>[8](https://mlweb.loria.fr/book/en/kernelridgeregression.html)</sup>

根据表示定理，解具有形式 \( f = \sum_{i=1}^{n} \alpha_{i} \cdot K(\mathbf{x}_{i}, \cdot) \)，这将无限维问题约化为关于系数 \( \alpha \) 的有限问题。<sup>[8](https://mlweb.loria.fr/book/en/kernelridgeregression.html)</sup> 对偶目标为 \( \|\mathbf{y} - \mathbf{K} \cdot \boldsymbol{\alpha}\|_2^2 + \lambda \cdot \boldsymbol{\alpha}^{T} \cdot \mathbf{K} \cdot \boldsymbol{\alpha} \)，将其梯度设为零得到闭式解 \( \alpha^{*} = (K + \lambda I)^{-1} y \)。<sup>[8](https://mlweb.loria.fr/book/en/kernelridgeregression.html)</sup><sup> • </sup><sup>[3](https://web2.qatar.cmu.edu/~gdicaro/10315-Fall19/additional/welling-notes-on-kernel-ridge.pdf)</sup> 预测则为 \( \hat{f}(x) = \sum_{i=1}^{n} \alpha_{i} \cdot k(x, x_{i}) \)，在 \( \lambda > 0 \) 时是唯一的。<sup>[9](https://ar5iv.labs.arxiv.org/html/1807.02582)</sup>

核技巧正是使其非线性的关键：核函数表示特征空间中的点积，因此算法在该空间中运作而无需计算其中的坐标。<sup>[10](https://media.wix.com/ugd/5256f1_27f0134dd65d4b528c5833b054ba2669.pdf)</sup> 正则化是必要的，因为从有限噪声样本中估计函数是一个不适定的逆问题；\( \lambda \) 越大，估计器越平滑。<sup>[9](https://ar5iv.labs.arxiv.org/html/1807.02582)</sup>

## 操作流程

实践者的工作流程包含三个决策。第一，选择核及其超参数；已发表的实验使用径向基函数核、拉普拉斯核和Matérn-5/2核，<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup> 而高斯核在分子性质预测中很常见。<sup>[11](https://mrupp.info/Data/2019strkghr_jchemphys.pdf)</sup>

第二，通过交叉验证或留一法估计来选择正则化参数 \( \lambda \)。<sup>[12](https://teazrq.github.io/stat542/notes/KernelRidge.pdf)</sup><sup> • </sup><sup>[3](https://web2.qatar.cmu.edu/~gdicaro/10315-Fall19/additional/welling-notes-on-kernel-ridge.pdf)</sup> KRR具有闭式的留一法评分，\( g_{\mathrm{LOO}}(\lambda) = \|H^{-1} \cdot (y - K \cdot \alpha)\|^{2} \)，其中 \( H = I_{n} - \mathrm{diag}(K \cdot (K + \lambda I_{n})^{-1}) \)，不过朴素计算它需要 \( (K + \lambda I_{n}) \) 的逆，代价为 \( O(n^{3}) \)。<sup>[13](https://www.ms.k.u-tokyo.ac.jp/sugi/2009/LargeScaleKernel.pdf)</sup>

第三，求解线性系统 \( (K + \lambda I_{n}) \cdot \alpha = y \)，通常通过Cholesky分解配合前向-后向替换，代价为 \( O(n^{3}) \)，或通过共轭梯度法，r 次迭代的代价为 \( O(r \cdot n^{2}) \)。<sup>[13](https://www.ms.k.u-tokyo.ac.jp/sugi/2009/LargeScaleKernel.pdf)</sup> 所有训练样本都必须存储，因为预测时要对每个训练点评估核函数。<sup>[12](https://teazrq.github.io/stat542/notes/KernelRidge.pdf)</sup>

## 起源

KRR采用的岭估计器由阿瑟·E·霍尔和罗伯特·W·肯纳德在《岭回归：非正交问题的有偏估计》（《技术计量学》，1970年）中提出；该1970年的论文指出，阿瑟·E·霍尔于1962年首次提出这一想法，用于控制预测向量非正交时最小二乘估计的不稳定性，并给出了闭式解 \( (X' \cdot X + k \cdot I)^{-1} \cdot X' \cdot Y \)，其中 \( k \geq 0 \)。<sup>[14](https://doi.org/10.1080/00401706.1970.10488634)</sup><sup> • </sup><sup>[15](https://homepages.math.uic.edu/~lreyzin/papers/ridge.pdf)</sup>

核化形式在一篇论文中被报道，该论文描述了最小二乘和岭回归的对偶版本，允许使用核函数，应用于ANOVA增强的无限节点样条，并在波士顿房价数据集上进行了评估；该论文指出该方法与万普尼克在支持向量机中使用的核方法密切相关。<sup>[10](https://media.wix.com/ugd/5256f1_27f0134dd65d4b528c5833b054ba2669.pdf)</sup> 一篇关于核方法的历史综述还记录了平行的一条统计学路线，其中正定核被用于时间序列分析、回归估计和逆问题求解。<sup>[16](https://www-ai.cs.tu-dortmund.de/de/LEHRE/FACHPROJEKT/SS14/Papers/kernelmethods.pdf)</sup> 后来，神经网络切核重新激发了对核方法的兴趣，由阿瑟·雅科、弗兰克·加布里埃尔和克莱芒·翁勒于2018年提出（HAL），尽管NTK计算复杂且由于内存限制通常需要大型计算集群。<sup>[17](https://arxiv.org/pdf/2301.11414v2.pdf)</sup>

## 变体

由于精确求解器的时间复杂度为 \( O(n^{3}) \)、内存复杂度为 \( O(n^{2}) \)，<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup><sup> • </sup><sup>[18](https://web.stanford.edu/~pilanci/papers/YangPilWai17.pdf)</sup> 若干近似方法族牺牲精度以降低计算代价：

- Nyström方法从 m 个采样列近似核矩阵，在 \( O(m^{2} \cdot n) \) 时间内计算 K 的平方根，对于固定的 m 这是 n 的线性函数。<sup>[19](https://www.di.ens.fr/~fbach/learning_theory_class/lecture6.pdf)</sup>
- 随机特征通过采样 \( v_{i} \) 上的经验平均来近似形式为 \( k(x,x') = \int \phi(x,v) \cdot \phi(x',v)\,d\mu(v) \) 的核，给出具有 \( m \ll n \) 个特征的显式特征映射。<sup>[19](https://www.di.ens.fr/~fbach/learning_theory_class/lecture6.pdf)</sup> Nyström方法和随机特征展开将代价降至 \( O(n^{3/2}) \)，但引入额外的误差项，往往降低经验性能。<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup>
- 随机草图从核矩阵的 m 维草图近似KRR，具有最优性保证。<sup>[18](https://web.stanford.edu/~pilanci/papers/YangPilWai17.pdf)</sup>
- 降秩KRR（RRKRR）产生与常规KRR功能上等价的最优稀疏核展开，在[Motorcycle](https://www.edgepedia.org/zh/motorcycle)和波士顿房价基准上优于稀疏最小二乘SVM，并且至多存储核矩阵的 \( |S| \) 列。<sup>[5](http://theoval.cmp.uea.ac.uk/publications/pdf/npl2002a.pdf)</sup>
- 诱导点方法如Falkon用 k 个中心求解受限问题；在近期大规模求解器评估中它们被作为基线进行比较。<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup>

近期工作直接针对 \( O(n^{3}) \) 瓶颈。ASkotch是一种可扩展的加速迭代求解器，用于完整KRR，建立在草图-投影方法和Nyström近似之上，可证明地在无条件数假设下获得线性收敛，并在23个大规模KRR问题上优于EigenPro 2.0、EigenPro 3.0、PCG和Falkon，通常 \( n \geq 10^{5} \)。<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup> 随机预条件器加速共轭梯度法：RPCholesky预条件在特征值充分快速衰减下以 \( O(n^{2}) \) 次运算求解固定精度的全数据KRR，而KRILL预条件用于具有 \( k \ll n \) 个中心的受限KRR，代价为 \( O((n+k^{2}) \cdot k\log k) \) 次运算且无特征值衰减假设，目标范围为 \( 10^{4} \leq n \leq 10^{7} \)。<sup>[20](https://link.springer.com/article/10.1007/s10444-026-10360-1)</sup> 核梯度下降（KGD）在 T 次迭代中以 \( O(T \cdot n^{2}) \) 次运算求解KRR，当 \( T < n \) 时比 \( O(n^{3}) \) 的闭式求解更便宜。<sup>[6](https://arxiv.org/html/2311.01762v2)</sup> 一个基于傅里叶/NUFFT的框架以 \( O(n\log n) \) 时间和内存实现精确核岭回归，并具有GPU加速。<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup>

## 应用

KRR被列为量子化学机器学习（QM/ML）中的热门选择之一，其中将核技巧应用于岭回归以闭式形式产生回归系数 \( \alpha \)。<sup>[21](https://pure.mpg.de/rest/items/item_2175859/component/file_2186290/content)</sup> 一个典型应用建模分子结构与HOMO能量之间的关系，通过高斯核等核函数将训练样本映射到高维空间。<sup>[11](https://mrupp.info/Data/2019strkghr_jchemphys.pdf)</sup> KRR也应用于医疗保健领域，以及更近期地应用于科学机器学习。<sup>[2](https://www.jmlr.org/papers/v27/25-0385.html)</sup> 在临床统计学中，KRR是一种用于高维临床数据模式识别的回归方法。<sup>[22](https://link.springer.com/book/10.1007/978-3-031-10717-7)</sup> 在基因组预测中，RKHS回归（KRR型估计器）已被应用于水稻性状，交叉验证运行时间取决于性状和设置。<sup>[23](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2016.00145/full)</sup>

## 局限与替代方案

主要局限是规模：求解 n × n 系统的时间代价为 \( O(n^{3}) \)、内存代价为 \( O(n^{2}) \)，<sup>[4](https://ar5iv.labs.arxiv.org/html/2509.02649)</sup> 而实践中标准的直接Cholesky方法将KRR限制在约 \( n \leq 10^{4} \) 个数据点。<sup>[20](https://link.springer.com/article/10.1007/s10444-026-10360-1)</sup> 该问题也是病态的，因为核矩阵通常具有非常小的特征值。<sup>[19](https://www.di.ens.fr/~fbach/learning_theory_class/lecture6.pdf)</sup> \( \lambda \) 太小会导致过拟合；正则化控制估计器的平滑度。<sup>[9](https://ar5iv.labs.arxiv.org/html/1807.02582)</sup>

与支持向量回归相比，KRR使用平方误差损失而SVR使用 \( \epsilon \)-不敏感损失，两者都带L2正则化。KRR拟合是闭式的，对于中等规模数据集通常更快，但其非稀疏模型——没有支持向量的概念<sup>[3](https://web2.qatar.cmu.edu/~gdicaro/10315-Fall19/additional/welling-notes-on-kernel-ridge.pdf)</sup>——在预测时更慢。在scikit-learn对含噪正弦数据集的基准测试中，拟合KRR比用网格搜索拟合SVR快约七倍，而SVR——使用100个训练点中约三分之一作为支持向量——在预测100,000个目标时更快；对于约1000个样本以下的训练集，KRR拟合更快，而SVR在超过该规模后扩展性更好。<sup>[1](https://scikit-learn.org/stable/modules/kernel_ridge.html)</sup>

与[高斯过程回归](https://www.edgepedia.org/zh/gaussian-process-regression)相比，KRR和GPR产生接近的预测结果，但GPR额外输出不确定性（标准差或协方差），预测时代价更高。<sup>[7](https://scikit-learn.org/stable/auto_examples/gaussian_process/plot_compare_gpr_krr.html)</sup> KRR估计与克里金（即高斯过程回归）的后验均值一致。<sup>[6](https://arxiv.org/html/2311.01762v2)</sup>

## References

1. [1.3. Kernel ridge regression, scikit-learn documentation](https://scikit-learn.org/stable/modules/kernel_ridge.html)
2. [Have ASkotch: A Neat Solution for Large-Scale Kernel Ridge Regression](https://www.jmlr.org/papers/v27/25-0385.html)
3. [Notes on Kernel Ridge Regression (Max Welling)](https://web2.qatar.cmu.edu/~gdicaro/10315-Fall19/additional/welling-notes-on-kernel-ridge.pdf)
4. [Fast kernel methods: Sobolev, physics-Informed, and additive models](https://ar5iv.labs.arxiv.org/html/2509.02649)
5. [Reduced Rank Kernel Ridge Regression](http://theoval.cmp.uea.ac.uk/publications/pdf/npl2002a.pdf)
6. [Solving Kernel Ridge Regression with Gradient Descent for a Non-Constant Kernel](https://arxiv.org/html/2311.01762v2)
7. [Comparison of kernel ridge and Gaussian process regression, scikit-learn example](https://scikit-learn.org/stable/auto_examples/gaussian_process/plot_compare_gpr_krr.html)
8. [Kernel ridge regression (book chapter)](https://mlweb.loria.fr/book/en/kernelridgeregression.html)
9. [Gaussian Processes and Kernel Methods: A Review on Connections and Equivalences](https://ar5iv.labs.arxiv.org/html/1807.02582)
10. [Dual Ridge Regression with kernels and ANOVA splines (Boston Housing experiments)](https://media.wix.com/ugd/5256f1_27f0134dd65d4b528c5833b054ba2669.pdf)
11. [Chemical diversity in molecular orbital energy predictions with kernel ridge regression](https://mrupp.info/Data/2019strkghr_jchemphys.pdf)
12. [STAT 542: Statistical Learning, RKHS and Kernel Ridge Regression](https://teazrq.github.io/stat542/notes/KernelRidge.pdf)
13. [Recent Advances and Trends in Large-scale Kernel Methods](https://www.ms.k.u-tokyo.ac.jp/sugi/2009/LargeScaleKernel.pdf)
14. [Arthur E. Hoerl, Robert W. Kennard (1970). Ridge Regression: Biased Estimation for Nonorthogonal Problems. Technometrics.](https://doi.org/10.1080/00401706.1970.10488634)
15. [Ridge Regression: Biased Estimation for Nonorthogonal Problems (Hoerl & Kennard)](https://homepages.math.uic.edu/~lreyzin/papers/ridge.pdf)
16. [Kernel Methods in Machine Learning (Hofmann, Schölkopf, Smola)](https://www-ai.cs.tu-dortmund.de/de/LEHRE/FACHPROJEKT/SS14/Papers/kernelmethods.pdf)
17. [A Simple Algorithm For Scaling Up Kernel Methods](https://arxiv.org/pdf/2301.11414v2.pdf)
18. [Randomized sketches for kernels: Fast and optimal nonparametric regression](https://web.stanford.edu/~pilanci/papers/YangPilWai17.pdf)
19. [Learning theory from first principles, lecture 6](https://www.di.ens.fr/~fbach/learning_theory_class/lecture6.pdf)
20. [Robust, randomized preconditioning for kernel ridge regression](https://link.springer.com/article/10.1007/s10444-026-10360-1)
21. [Machine learning of molecular properties (QM/ML review, Max Planck repository copy)](https://pure.mpg.de/rest/items/item_2175859/component/file_2186290/content)
22. [Kernel Ridge Regression in Clinical Research](https://link.springer.com/book/10.1007/978-3-031-10717-7)
23. [A Unified and Comprehensible View of Parametric and Kernel Methods for Genomic Prediction with Application to Rice](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2016.00145/full)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Machine learning methods › Supervised, unsupervised, and semi-supervised learning › Kernel methods and support vector machines

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/kernel-ridge-regression

English original: https://www.edgepedia.org/kernel-ridge-regression
