# 核聚类

核聚类是一类聚类方法：它先用核函数表示数据点之间的两两相似度，再对所得的特征空间表示运行聚类算法，例如k均值或谱方法。其动机在于：普通k均值用线性分隔面划分输入点，因此无法分开仅非线性可分的簇，而且它会使恢复出的簇强烈偏向各向同性和球形；将数据隐式映射到更高维特征空间可消除这两项限制，因为那里的线性划分对应于输入空间中的非线性划分。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup><sup> • </sup><sup>[2](https://jmlr.org/papers/volume20/17-517/17-517.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 目标 | 最小化 \( \mathrm{cost}^{\varphi}(X, C) = \sum_{x \in X} w_X(x) \cdot \min_{c \in C} \Vert \varphi(x) - c \Vert^{2} \)，对隐式映射到特征空间的点进行聚类<sup>[3](https://link.springer.com/article/10.1007/s10994-024-06540-z)</sup> |
| 解决的问题 | 捕捉普通k均值遗漏的非线性可分簇结构<sup>[3](https://link.springer.com/article/10.1007/s10994-024-06540-z)</sup> |
| 核技巧 | 重写算法，使其只使用特征向量的点积 \( x^{T} \cdot z \)，并用核函数 \( k(x,z) = \varphi(x)^{T} \varphi(z) \) 替换每个点积<sup>[4](https://www.cs.cmu.edu/~mgormley/courses/10601-s18/slides/lecture29-kernel-kmeans.pdf)</sup> |
| 谱等价 | 在特定权重选择下，加权核k均值目标与归一化割相同<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup> |
| 计算成本 | 每次迭代 \( O(n^{2}) \) 次标量运算；从数据向量计算核矩阵需要 \( O(n^{2} \cdot m) \)；精确解成本为 \( O(n^{3} + n^{2} \cdot d + T \cdot n^{2} \cdot k) \)<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup><sup> • </sup><sup>[2](https://jmlr.org/papers/volume20/17-517/17-517.pdf)</sup> |
| 收敛条件 | 只要 \( K \) 是半正定的，算法就单调收敛，此时 \( K \) 可解释为格拉姆矩阵<sup>[5](https://people.bu.edu/bkulis/pubs/spectral_techreport.pdf)</sup> |

## 工作原理

核聚类通过非线性映射 \( \Phi \) 将数据集投影到特征空间，在该空间中初始化码本，并在那里进行线性划分；结果是对输入空间的非线性划分。<sup>[6](https://eprints.gla.ac.uk/56336/1/56336.pdf)</sup> 核技巧分两步使之可行：首先重写聚类算法，使其只处理特征向量的点积 \( x^{T} \cdot z \)，然后用核函数 \( k(x,z) \) 替换每个点积；核函数可以是点积 \( k(x,z) = \varphi(x)^{T} \varphi(z) \) 的任何合法定义。<sup>[4](https://www.cs.cmu.edu/~mgormley/courses/10601-s18/slides/lecture29-kernel-kmeans.pdf)</sup> 该技巧的本质是，算法随后可以仅依靠核矩阵 \( K \) 运行，而无需显式知道映射 \( \Phi \)。<sup>[7](https://ar5iv.labs.arxiv.org/html/1701.05335)</sup>

## 如何实施

实践者选择核并构造 \( n \times n \) 核矩阵 \( K \)；从数据向量计算 \( K \) 通常需要 \( O(n^{2} \cdot m) \) 时间，其中 \( m \) 是原始点的维数。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup> 核必须是半正定的，这样 \( K \) 才能解释为格拉姆矩阵；在此条件下，加权核k均值算法单调收敛。<sup>[5](https://people.bu.edu/bkulis/pubs/spectral_techreport.pdf)</sup> 随后，对于稠密核矩阵，每次迭代需要 \( O(n^{2}) \) 次标量运算；对于具有 \( n \cdot z \) 个非零项的稀疏矩阵，则需要 \( O(n \cdot z) \) 次；若输入为数据向量（\( T \) 次迭代），总时间复杂度为 \( O(n^{2} \cdot (T + m)) \)；若给定正定矩阵，则为 \( O(nz \cdot T) \)。<sup>[5](https://people.bu.edu/bkulis/pubs/spectral_techreport.pdf)</sup> 如果需要显式特征向量，\( K \) 的完整特征分解需要 \( O(n^{3}) \)，而特征分解加劳埃德迭代的过程需要 \( O(n^{3} + n^{2} \cdot d + T \cdot n^{2} \cdot k) \) 时间，其中形成 \( K \) 需要 \( O(n^{2} \cdot d) \)，每次劳埃德迭代需要 \( O(n^{2} \cdot k) \)；全局求解核k均值是NP难的，因此这些迭代只能找到局部解。<sup>[2](https://jmlr.org/papers/volume20/17-517/17-517.pdf)</sup> 即使评估最优1均值中心，也需要对 \( K \) 进行 \( \Omega(n^{2}) \) 次访问，而经典设置中为 \( O(n) \)，这是核心计算挑战。<sup>[3](https://link.springer.com/article/10.1007/s10994-024-06540-z)</sup> 簇数 \( k \) 是用户设定的参数；在核谱聚类中，它通过在调优参数上进行网格搜索来调整，并用验证集上的准则评估。<sup>[8](https://arxiv.org/pdf/1505.00477v1.pdf)</sup>

## 起源

核聚类结合了两个更早的想法：围绕码向量对数据进行基于均值的迭代划分，以及在隐式特征空间中计算点积的核函数。将这些线索统一为现代形式的方法由因德吉特·S·迪隆（Inderjit S. Dhillon）、关宇强（Yuqiang Guan）和布赖恩·库利斯（Brian Kulis）于2004年发表，论文题为《核k均值、谱聚类与归一化割》（Kernel k-means, Spectral Clustering and Normalized Cuts），该文表明加权核k均值、[谱聚类](https://www.edgepedia.org/zh/spectral-clustering)和图割优化的是相关目标。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup> 核谱聚类是一种不同的表述，由约翰·A·K·苏肯斯（Johan A. K. Suykens）和卡洛斯·阿尔萨特（Carlos Alzate）发表；他们2011年的论文题为《核谱聚类：模型表示、稀疏性与样本外扩展》（Kernel Spectral Clustering: Model Representations, Sparsity and Out-of-sample Extensions）。后来的论述将核聚类与谱聚类之间的明确关系归功于2004年的统一。<sup>[9](https://ar5iv.labs.arxiv.org/html/2011.06461)</sup>

## 变体

**加权核k均值**通过逐点权重推广基础算法；以特定方式选择权重会使其目标与归一化割相同，因此类k均值迭代算法可以直接最小化归一化割，而无需计算特征向量。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup> 当最大化比率关联时，若将权重设为1，核k均值与谱聚类方法之间存在完美等价。<sup>[6](https://eprints.gla.ac.uk/56336/1/56336.pdf)</sup>

**谱聚类**改为求解一个松弛的特征向量问题；加权核k均值目标的迹最大化松弛将特定的核与权重方案同吴、乔丹和韦斯（Ng, Jordan, Weiss）的算法联系起来，而谱聚类因图像分割中的归一化割准则而流行。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup><sup> • </sup><sup>[8](https://arxiv.org/pdf/1505.00477v1.pdf)</sup>

**核谱聚类（KSC）**是一种基于最小二乘支持向量机的谱聚类表述，由加权核主成分分析目标描述；它包含验证与模型选择阶段，并通过将测试数据投影到学习到的特征子空间，实现准确的样本外预测。<sup>[8](https://arxiv.org/pdf/1505.00477v1.pdf)</sup>

**支持向量聚类**通过高斯核将数据点映射到高维特征空间，并搜索最小包围球；该球映射回数据空间后分离成若干分量，每个分量包围一个单独的簇。高斯核的宽度控制探测数据的尺度，软间隔常数有助于处理离群点和重叠簇。<sup>[10](https://www.jmlr.org/papers/volume2/horn01a/horn01a.pdf)</sup>

**核幂k均值**使用一族均值来缓解局部极小值，RFF-KPKM对其应用随机傅里叶特征，具有 \( O(k^{3}/n) \) 的超额风险界、强一致性，以及使用RFF维度 \( \mathrm{poly}(\varepsilon^{-1} \log k) \) 的 \( (1 + \varepsilon) \) 相对误差界；一种改进的可能性变体结合了可能性隶属度与模糊隶属度，并在大规模数据集上表现出更高的效率和准确率。<sup>[11](https://ojs.aaai.org/index.php/AAAI/article/view/39128)</sup>

**生成式核谱聚类（GenKSC，2025）**将核谱聚类与生成建模相结合，以产生定义良好的簇和可解释的潜在表示，并在MNIST和FashionMNIST上进行了评估。<sup>[12](https://arxiv.org/html/2502.02185)</sup>

模糊c均值、自组织映射和神经气也存在核化变体；两种基于核的聚类方法假设已选择核并构造了核矩阵，利用矩阵结构在输入空间中进行非线性聚类。<sup>[6](https://eprints.gla.ac.uk/56336/1/56336.pdf)</sup><sup> • </sup><sup>[13](https://proceedings.neurips.cc/paper_files/paper/2001/file/4ba29b9f9e5732ed33761840f4ba6c53-Paper.pdf)</sup>

## 应用

已有记录的应用包括图像分割、手写数字识别、使用核自组织映射的人脸识别、语音识别和作物产量预测，谱方法用于图像分割、生物信息学和[协同聚类](https://www.edgepedia.org/zh/co-clustering)。<sup>[6](https://eprints.gla.ac.uk/56336/1/56336.pdf)</sup> 在生物信息学中，将二次核（平方相关）应用于基因表达数据会产生反相关基因簇，并且该方法已被证明能在大型手写识别数据集上扩展。<sup>[1](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)</sup> 核谱聚类已应用于电力负荷时间序列聚类、文档聚类和大数据学习。<sup>[8](https://arxiv.org/pdf/1505.00477v1.pdf)</sup>

## 局限与替代方法

核k均值继承了k均值的非凸目标，因此可能停在糟糕的局部极小值；核解决了线性可分假设，但局部极小值问题仍然存在。<sup>[9](https://ar5iv.labs.arxiv.org/html/2011.06461)</sup> 扩展性是主要实际约束：成本随数据量呈二次增长，使得大规模不平衡数据集在没有近似的情况下不可行。<sup>[14](https://journal.hep.com.cn/fcs/EN/10.1007/s11704-026-52144-2)</sup> 特别是谱聚类，如果不使用尼斯特伦算法、幂迭代或基于线性代数的方法等近似方法，就无法处理大数据，而且其向样本外数据的泛化只是近似的。<sup>[8](https://arxiv.org/pdf/1505.00477v1.pdf)</sup> 核选择很重要：在支持向量聚类中，高斯核宽度设定探测数据的尺度，已有实用的带宽选择程序发表，例如通过核格拉姆矩阵的谱性质调整的两阶段算法，以及将带宽选为成对平方距离的经验分位数的规则。

近似方法现在主导着扩展性方面的研究。尼斯特伦方法和随机特征映射用[低秩近似](https://www.edgepedia.org/zh/low-rank-approximation)替换 \( K \)；奇塔等人（Chitta et al.）早期对核k均值的应用减轻了计算负担，但没有提供性能保证。<sup>[2](https://jmlr.org/papers/volume20/17-517/17-517.pdf)</sup> 穆斯科与穆斯科（Musco and Musco，2017）以及王等人（Wang et al.，2019）的基于尼斯特伦的算法，在随 \( n \) 近线性增长的时间内计算秩为 \( O(k/\varepsilon) \) 的核矩阵近似。<sup>[3](https://link.springer.com/article/10.1007/s10994-024-06540-z)</sup> 将线性k均值应用于来自秩受限尼斯特伦近似的 \( \frac{k}{\varepsilon}(1 + o(1)) \) 个特征，就核k均值成本函数而言可得到 \( 1 + \varepsilon \) 的近似比，并在包含810万实例的MNIST8M数据集上进行了实证演示；这一系列工作主张，用尼斯特伦近似的谱聚类（该工作称其在理论上不健全）应被用尼斯特伦近似的核k均值取代。<sup>[2](https://jmlr.org/papers/volume20/17-517/17-517.pdf)</sup> 2024年的一篇核心集论文给出了核聚类的可证明压缩。<sup>[3](https://link.springer.com/article/10.1007/s10994-024-06540-z)</sup>

## References

1. [Kernel k-means, Spectral Clustering and Normalized Cuts (Dhillon, Guan, Kulis, KDD 2004)](https://dl.acm.org/doi/pdf/10.1145/1014052.1014118)
2. [Scalable Kernel K-Means Clustering with Nyström Approximation: Relative-Error Bounds (Wang, Zhang, JMLR)](https://jmlr.org/papers/volume20/17-517/17-517.pdf)
3. [Coresets for kernel clustering (Machine Learning, Springer, 2024)](https://link.springer.com/article/10.1007/s10994-024-06540-z)
4. [CMU lecture slides: Kernel k-means](https://www.cs.cmu.edu/~mgormley/courses/10601-s18/slides/lecture29-kernel-kmeans.pdf)
5. [A Unified View of Kernel k-means, Spectral Clustering and Graph Cuts (Kulis, Dhillon, Ghahramani, technical report)](https://people.bu.edu/bkulis/pubs/spectral_techreport.pdf)
6. [A survey of kernel and spectral methods for clustering (Filippone, Camastra, Masulli, Rovetta, Pattern Recognition 41(1), 2008)](https://eprints.gla.ac.uk/56336/1/56336.pdf)
7. [Validity of Clusters Produced By kernel-k-means With Kernel-Trick (arXiv)](https://ar5iv.labs.arxiv.org/html/1701.05335)
8. [Kernel Spectral Clustering and applications (review)](https://arxiv.org/pdf/1505.00477v1.pdf)
9. [Kernel k-Means, By All Means: Algorithms and Strong Consistency (arXiv 2011.06461)](https://ar5iv.labs.arxiv.org/html/2011.06461)
10. [Support Vector Clustering (Ben-Hur, Horn, Siegelmann, Vapnik, JMLR)](https://www.jmlr.org/papers/volume2/horn01a/horn01a.pdf)
11. [Enhancing Kernel Power K-means: Scalable and Robust Clustering with Random Fourier Features and Possibilistic Method (AAAI)](https://ojs.aaai.org/index.php/AAAI/article/view/39128)
12. [Generative Kernel Spectral Clustering (GenKSC) (arXiv 2025)](https://arxiv.org/html/2502.02185)
13. [Spectral Kernel Methods for Clustering (NeurIPS 2001)](https://proceedings.neurips.cc/paper_files/paper/2001/file/4ba29b9f9e5732ed33761840f4ba6c53-Paper.pdf)
14. [Statistical and computational trade-offs in imbalanced kernel clustering (Frontiers of Computer Science)](https://journal.hep.com.cn/fcs/EN/10.1007/s11704-026-52144-2)

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

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/kernel-clustering

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