# 核主成分分析

**核主成分分析**（kernel PCA，KPCA）是主成分分析的一种非线性扩展，它通过[核技巧](https://www.edgepedia.org/zh/kernel-trick)在由核函数隐式定义的高维特征空间中执行PCA，从而无需显式计算数据的映射。该方法由[伯恩哈德·舍尔科普夫](https://www.edgepedia.org/zh/bernhard-scholkopf)、亚历山大·斯莫拉和克劳斯-罗伯特·米勒在1998年的论文《非线性成分分析作为核特征值问题》（*Nonlinear Component Analysis as a Kernel Eigenvalue Problem*）中提出，发表于《神经计算》（*Neural Computation*）10(5)，第1299–1319页。<sup>[1](https://pure.korea.ac.kr/en/publications/nonlinear-component-analysis-as-a-kernel-eigenvalue-problem/)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 舍尔科普夫、斯莫拉和米勒，《神经计算》10(5):1299–1319，1998年7月；DOI 10.1162/089976698300017467<sup>[1](https://pure.korea.ac.kr/en/publications/nonlinear-component-analysis-as-a-kernel-eigenvalue-problem/)</sup> |
| 核心思想 | 在与输入空间通过非线性映射Φ相关联的特征空间中计算PCA，用核函数代替点积，使得映射永远无需显式求值<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup> |
| 算法 | 计算n × n核矩阵K，求解特征值问题\( M\lambda\alpha = K^2\alpha \)（等价于\( K\alpha = M\lambda\alpha \)），以\( \lambda(\alpha \cdot \alpha) = 1 \)归一化，并将测试点投影为\( \sum_i \alpha_i k(x_i, x) \)<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup> |
| 特征空间中心化 | 通过修正核\( \tilde{K} = K - \mathbf{1}_n K - K \mathbf{1}_n + \mathbf{1}_n K \mathbf{1}_n \)隐式完成中心化<sup>[3](https://www.tahabouhsine.com/awesome-kernels/kernel-learning/kernel-pca-1998)</sup> |
| 主要成本 | n × n核矩阵的特征分解，随着数据集增大，它在计算和内存中占主导地位<sup>[4](https://link.springer.com/article/10.1007/s10462-022-10297-z)</sup> |
| 可扩展性修正 | Nyström采样在不损失统计精度的情况下提高效率<sup>[5](https://proceedings.mlr.press/v108/sterge20a.html)</sup>；通过谱聚类或随机采样缩减KPCA，在工业故障检测中减少时间和存储<sup>[6](https://www.sciencedirect.com/science/article/pii/S0959152423002317)</sup> |
| 典型核 | 多项式核\( (\gamma\, p^{\mathrm T} q + c)^d \)、高斯/RBF核\( \exp(-\gamma \|p - q\|^2) \)和Sigmoid核\( \tanh(\gamma\, p^{\mathrm T} q + c) \)<sup>[7](https://academic.oup.com/mnras/article/508/3/3551/6381718)</sup> |

## 动机与核技巧

经典PCA对数据的协方差矩阵进行对角化，在输入空间中寻找方差最大的正交方向。当数据具有线性结构时它是有效的，但当数据位于非线性低维流形上时，它无法识别出降维方向。<sup>[8](https://arxiv.org/abs/2001.01958)</sup> 1998年的论文寻求与输入非线性相关的变量的主成分，例如输入变量之间的任意高阶相关性；在图像分析中，这意味着在输入像素乘积的空间中寻找主成分。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup>

关键观察在于，PCA可以仅用点积来表述。给定任何仅用点积表达的算法，可以通过将每个点积替换为核函数\( k(x, y) = \langle \Phi(x), \Phi(y) \rangle \)来构造其非线性版本，其中Φ将输入空间映射到一个维度可能任意大、甚至无限的特征空间。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup> 泛函分析中的Mercer定理给出了条件：如果k是正积分算子的连续核，则存在一个映射，将输入映射到以k为点积的空间。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup> 核的选择隐式地决定了映射Φ和特征空间两者。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup>

## 算法

原始推导分三步进行。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup>

1. 对M个训练点计算核矩阵\( K_{ij} = k(x_i, x_j) \)。
2. 求解特征值问题\( K\alpha = M\lambda\alpha \)以获得非零特征值，并通过\( \lambda_n(\alpha_n \cdot \alpha_n) = 1 \)归一化展开系数，这确保对应的特征空间特征向量是单位向量。
3. 对于测试点x，计算其非线性主成分作为到特征向量上的投影，

\[ (V_n \cdot \Phi(x)) = \sum_{i=1}^{M} \alpha_i^n\, k(x_i, x). \]

当核满足Mercer条件时，该过程恰好对应于高维特征空间中的标准PCA，而无需在该空间中进行昂贵的计算。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup> PCA的通常性质得以延续：方差最大的正交方向、最小L₂重构误差，以及在高斯假设下与输入的最大互信息。<sup>[9](https://faculty.ucmerced.edu/mcarreira-perpinan/papers/phd-ch04.pdf)</sup> 核PCA还具有酉不变性，因为特征值问题和特征提取都仅依赖于核值。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup>

**中心化。** 推导假设观测已中心化，这在输入空间中很容易，但在特征空间中较难，因为Φ(xᵢ)的均值无法显式计算。解决办法是直接对核矩阵进行中心化，使用修正核

\[ \tilde{K} = K - \mathbf{1}_n K - K \mathbf{1}_n + \mathbf{1}_n K \mathbf{1}_n, \]

其中\( \mathbf{1}_n \)是所有元素为\( 1/n \)的n × n矩阵。<sup>[3](https://www.tahabouhsine.com/awesome-kernels/kernel-learning/kernel-pca-1998)</sup><sup> • </sup><sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup>

**成分数量。** K的秩受样本量限制，因此核PCA从n个样本中最多可提取n个非线性成分，与输入维度无关。<sup>[2](https://www.mlpack.org/papers/kpca.pdf)</sup><sup> • </sup><sup>[9](https://faculty.ucmerced.edu/mcarreira-perpinan/papers/phd-ch04.pdf)</sup> 与某些非线性PCA变体不同，该方法只需解一个特征值问题，不涉及非线性优化，且建模前无需指定主成分的数量。<sup>[10](https://www.sciencedirect.com/science/article/pii/S0009250903004652)</sup>

## 计算成本与近似

核PCA的主要计算负担是n × n核矩阵的特征分解，其大小随数据点数量增长；对于大型数据集，这在内存和时间上都占主导地位。<sup>[4](https://link.springer.com/article/10.1007/s10462-022-10297-z)</sup> 对该矩阵的运算也使核PCA在相同数据上比标准PCA昂贵得多。<sup>[7](https://academic.oup.com/mnras/article/508/3/3551/6381718)</sup>

若干近似方法解决了这一问题。[Nyström方法](https://www.edgepedia.org/zh/nystrom-method)是提高核方法可扩展性最流行的技术之一，已被专门推导用于核PCA，提供了少数可使其可扩展的可用选项之一，并给出了相对于完整方法的经验重构误差的有限样本置信界。<sup>[11](https://arxiv.org/abs/2109.05578)</sup> 2020年的一项理论分析表明，Nyström采样极大地提高了计算效率，而不带来任何统计精度的损失，这是PCA领域的首个此类结果。<sup>[5](https://proceedings.mlr.press/v108/sterge20a.html)</sup> 其他方法包括随机非线性成分分析和用于超大型数据集的流式核PCA，<sup>[12](https://arxiv.org/abs/1712.04196)</sup> 以及通过谱聚类或随机采样缩减训练集同时保留数据主要统计特征的缩减KPCA方案。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0959152423002317)</sup> 在实践中，库也提供更廉价的特征求解器：scikit-learn的KernelPCA可以使用稠密LAPACK分解、ARPACK截断SVD或随机SVD，并支持线性、多项式、RBF、Sigmoid、余弦和预计算核。<sup>[13](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.KernelPCA.html)</sup>

## 原像问题

核PCA将数据映射到特征空间，但许多应用需要反向操作：重构与给定特征空间向量对应的输入空间点。寻找这一原像在核PCA图像去噪等应用中至关重要。<sup>[14](https://www.cse.ust.hk/faculty/jamesk/papers/icml03.html)</sup> 米卡及其同事的早期方法依赖于非线性优化；郭和曾（ICML 2003）提出了一种非迭代方法，从特征空间中的距离约束定位原像，仅涉及线性代数，避免了数值不稳定和局部极小值问题。<sup>[14](https://www.cse.ust.hk/faculty/jamesk/papers/icml03.html)</sup> 后来的工作继续将反向映射视为一个开放的设计选择，例如通过最小化差异泛函将降维后的表示映射回原始高维空间。<sup>[8](https://arxiv.org/abs/2001.01958)</sup>

## 应用

**过程监控与故障检测。** 核PCA已广泛应用于化学和工业过程的监控，其中变量是非线性且高度相关的。李及其同事将特征空间中的T²和平方预测误差（SPE）图应用于一个简单的多变量过程和一个生物废水处理基准，捕捉到了线性PCA遗漏的非线性关系。<sup>[10](https://www.sciencedirect.com/science/article/pii/S0009250903004652)</sup> 由于特征空间均值不能直接获得，在特征空间中计算SPE需要专门的方法。<sup>[10](https://www.sciencedirect.com/science/article/pii/S0009250903004652)</sup> 后来的工作从核函数的梯度推导出用于故障识别的贡献统计量，<sup>[15](https://www.sciencedirect.com/science/article/pii/S0009250904006013)</sup> 用动态核PCA将该方法扩展到动态过程，<sup>[16](https://www.sciencedirect.com/science/article/pii/S0009250904004555)</sup> 并将缩减KPCA应用于Tennessee Eastman基准和水泥回转窑过程，计算时间和内存存储更低。<sup>[6](https://www.sciencedirect.com/science/article/pii/S0959152423002317)</sup>

**天文学。** 在21厘米强度映射中，核PCA去除比宇宙学信号亮几个数量级的前景辐射：最大特征值模式捕捉前景方差，其投影从每个像素中减去。研究发现需要先用线性PCA进行预清理；没有它，即使减去更多模式并使用不同的核，仍会留下大得多的残差，这表明核PCA的优势在于分离大小相近的复杂信号，而非缩减大动态范围。<sup>[7](https://academic.oup.com/mnras/article/508/3/3551/6381718)</sup>

**模式识别与去噪。** 原始论文展示了用于模式识别的多项式特征提取实验。<sup>[1](https://pure.korea.ac.kr/en/publications/nonlinear-component-analysis-as-a-kernel-eigenvalue-problem/)</sup> 此后核PCA被用于人脸识别和主动形状模型，<sup>[17](https://arxiv.org/abs/1207.3538)</sup> 以及图像去噪，其中原像问题至关重要。<sup>[14](https://www.cse.ust.hk/faculty/jamesk/papers/icml03.html)</sup>

## 与其他方法的比较

在范德马滕和欣顿对十三种降维技术的比较综述中，核PCA被归类为一种凸的、全谱方法，对成对相似度的完整矩阵进行特征分解，可能在核构造的特征空间中进行。<sup>[18](https://lvdmaaten.github.io/publications/papers/TR_Dimensionality_Reduction_Review_2009.pdf)</sup> 在他们的实验中，核PCA和自编码器在几乎所有自然数据集上表现强劲，而许多局部非线性技术令人失望；然而在人工[瑞士卷](https://www.edgepedia.org/zh/swiss-roll)基准上，核PCA的29.30% 1-NN[泛化误差](https://www.edgepedia.org/zh/generalization-error)远差于Isomap的3.28%，表明其全局相似性结构并不适合所有流形。<sup>[18](https://lvdmaaten.github.io/publications/papers/TR_Dimensionality_Reduction_Review_2009.pdf)</sup> 后来的一项综述指出，核PCA能很好地捕捉非线性方差，但可解释性差，且性能取决于核的选择。<sup>[19](https://pmc.ncbi.nlm.nih.gov/articles/PMC12453773/)</sup>

核PCA还充当一个统一的参照点：许多流形学习方法可以被证明是它的特例，它与Isomap、局部线性嵌入和拉普拉斯特征映射并列，成为降维文献中PCA的主要非线性扩展之一。<sup>[20](https://journal.hep.com.cn/fee/EN/10.1007/s11460-011-0131-5)</sup>

## References

1. [Schölkopf, B., Smola, A., & Müller, K.-R. (1998). Nonlinear Component Analysis as a Kernel Eigenvalue Problem. Neural Computation 10(5), 1299–1319.](https://pure.korea.ac.kr/en/publications/nonlinear-component-analysis-as-a-kernel-eigenvalue-problem/)
2. [Schölkopf, Smola & Müller (1998), full text PDF, Max-Planck-Institut für biologische Kybernetik / mlpack mirror.](https://www.mlpack.org/papers/kpca.pdf)
3. [Awesome Kernels: Schölkopf et al. (1998), Kernel PCA summary with centering formula.](https://www.tahabouhsine.com/awesome-kernels/kernel-learning/kernel-pca-1998)
4. [Marukatat, S. (2023). Tutorial on PCA and approximate PCA and approximate kernel PCA. Artificial Intelligence Review 56, 5445–5477.](https://link.springer.com/article/10.1007/s10462-022-10297-z)
5. [Sterge, N., Sriperumbudur, B., Rosasco, L., & Rudi, A. (2020). Gain with no Pain: Efficiency of Kernel-PCA by Nyström Sampling. AISTATS, PMLR 108:3642–3652.](https://proceedings.mlr.press/v108/sterge20a.html)
6. [Attouri, K. et al. (2024). Improved fault detection based on kernel PCA for monitoring industrial applications. Journal of Process Control 133, 103143.](https://www.sciencedirect.com/science/article/pii/S0959152423002317)
7. [Kernel PCA foreground removal from single-dish 21 cm intensity maps. Monthly Notices of the Royal Astronomical Society 508(3), 3551ff. (2021).](https://academic.oup.com/mnras/article/508/3/3551/6381718)
8. [García-González, A., Huerta, A., Zlotnik, S., & Díez, P. (2021). A kernel Principal Component Analysis (kPCA) digest with a new backward mapping (pre-image reconstruction) strategy. arXiv:2001.01958.](https://arxiv.org/abs/2001.01958)
9. [Carreira-Perpiñán, M. Á. PhD thesis, Chapter 4.5: Kernel PCA. University of California, Merced.](https://faculty.ucmerced.edu/mcarreira-perpinan/papers/phd-ch04.pdf)
10. [Lee, J.-M., Yoo, C., Choi, S. W., Vanrolleghem, P. A., & Lee, I.-B. (2004). Nonlinear process monitoring using kernel principal component analysis. Chemical Engineering Science 59(1), 223–234.](https://www.sciencedirect.com/science/article/pii/S0009250903004652)
11. [Hallgren, F. (2022). Kernel PCA with the Nyström method. arXiv:2109.05578.](https://arxiv.org/abs/2109.05578)
12. [Empirical Evaluation of Kernel PCA Approximation Methods in Classification Tasks. arXiv:1712.04196.](https://arxiv.org/abs/1712.04196)
13. [sklearn.decomposition.KernelPCA, scikit-learn documentation.](https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.KernelPCA.html)
14. [Kwok, J. T., & Tsang, I. W. (2003). The Pre-Image Problem in Kernel Methods. ICML 2003, pp. 408–415.](https://www.cse.ust.hk/faculty/jamesk/papers/icml03.html)
15. [Fault identification for process monitoring using kernel principal component analysis. Chemical Engineering Science 60(1), 279–288 (2005).](https://www.sciencedirect.com/science/article/pii/S0009250904006013)
16. [Nonlinear dynamic process monitoring based on dynamic kernel PCA. Chemical Engineering Science (2005).](https://www.sciencedirect.com/science/article/pii/S0009250904004555)
17. [Kernel Principal Component Analysis and its Applications in Face Recognition and Active Shape Models. arXiv:1207.3538.](https://arxiv.org/abs/1207.3538)
18. [van der Maaten, L., & Hinton, G. (2009). Dimensionality Reduction: A Comparative Review. Technical Report.](https://lvdmaaten.github.io/publications/papers/TR_Dimensionality_Reduction_Review_2009.pdf)
19. [Comprehensive review of dimensionality reduction algorithms: challenges, limitations, and innovative solutions. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC12453773/)
20. [Advances in adaptive nonlinear manifolds and dimensionality reduction. Frontiers of Electrical and Electronic Engineering in China (2011).](https://journal.hep.com.cn/fee/EN/10.1007/s11460-011-0131-5)

---
*Initially written 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-pca

English original: https://www.edgepedia.org/kernel-pca
