# X-means

**X-means**是一种聚类算法，它扩展了K-means，能够自动估计簇的数量K，而不需要用户事先指定。该算法由卡内基梅隆大学计算机科学学院的Dan Pelleg和Andrew Moore提出，论文发表于2000年在旧金山举行的第十七届国际机器学习大会（ICML 2000），第727–734页。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup><sup> • </sup><sup>[2](https://software.llnl.gov/muster/bic_8h_source.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | Dan Pelleg和Andrew Moore，卡内基梅隆大学；ICML 2000，第727–734页<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup><sup> • </sup><sup>[2](https://software.llnl.gov/muster/bic_8h_source.html)</sup> |
| 解决的问题 | K-means要求用户提供K，每次迭代的扩展性差，且容易陷入局部极小值；X-means解决了前两个问题，并部分改善了第三个问题<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> |
| 选择准则 | 通过比较贝叶斯信息准则（BIC）分数来决定是否接受分裂；该框架也支持赤池信息准则（AIC）<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> |
| 机制 | 每次K-means运行后，通过局部决策确定哪些质心分裂为两个子质心；黑名单和缓存的充分统计量使BIC评估的成本控制在一个K-means迭代之内<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> |
| 报告的性能 | 在合成数据和真实数据上，就BIC而言，聚类效果始终优于猜测K值；即使与加速黑名单K-means相比也快得多<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> |
| 已知局限 | 球形簇假设可能导致严重的过拟合；MX-means和GX-means等扩展方法为每个簇使用完整的协方差矩阵<sup>[3](https://www.kci.go.kr/kciportal/ci/sereArticleSearch/ciSereArtiView.kci?sereArticleSearchBean.artiId=ART001243620)</sup> |

## 动机

K-means将度量数据围绕质心划分为K个子集，因其简单性和收敛到局部极小值的特性，长期以来一直是聚类的标准工具。原始论文指出了三个缺点：每次迭代随数据规模的扩展性差；簇的数量K必须由用户提供；当K固定时，算法在经验上找到的局部最优解比允许动态改变K时更差。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> X-means直接针对前两个问题，并对第三个问题提供了部分改善，因为在搜索过程中允许K变化，使算法能够逃离固定K运行无法离开的配置。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup>

## 算法工作原理

**带模型选择检验的迭代分裂。** X-means运行K-means，然后检查当前质心，决定哪些质心应分裂为两个子质心以更好地拟合数据。决策是局部的，逐簇进行，通过计算父模型与分裂后模型的BIC分数，仅当分数提高时才保留分裂。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> 后来对该方法的描述总结了同样的循环：X-means在内部运行多轮K-means，并使用BIC进行聚类验证以计算最佳K值，无需用户事先选择最终的簇数。<sup>[4](https://www.usenix.org/legacy/event/sec08/tech/full_papers/gu/gu.pdf)</sup> 搜索也可以使用赤池信息准则代替BIC。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup>

**通过缓存统计量和黑名单提速。** 该算法建立在作者早期提出的加速K-means之上，后者并非基于近似。黑名单是一种进一步的几何计算，仅记录每个特定空间区域内必须检查的质心。论文展示了黑名单如何扩展，使得获取所有当前中心及其候选子代的BIC值的成本不超过一次K-means迭代，而缓存的充分统计量和缓存的稳态信息免去了重新计算未变化量的需要。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> X-means内部使用的K-means例程实际上是Pelleg和Moore开发的加速K-means算法。<sup>[5](https://citeseerx.ist.psu.edu/document?doi=ea7d1c6aa7308c55d11fc6e64f5c983d437c7e67&repid=rep1&type=pdf)</sup>

**K的边界。** 实现通常以最小和最大簇数作为参数。在ELKI实现中，kmax不是硬阈值：由于候选分裂在接受之前会被评估，算法最多可以返回2 × kmax个簇。<sup>[6](https://elki-project.github.io/releases/current/javadoc/elki/clustering/kmeans/XMeans.html)</sup>

## 作者报告的性能

原始实验将X-means与猜测K值后运行K-means的传统方法进行了比较。在合成数据和真实数据上，就BIC而言，X-means始终产生更好的聚类效果，而且运行速度快得多，即使基线是作者自己的加速黑名单K-means。<sup>[1](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)</sup> 后来一篇关于簇数方法的综述指出，X-means速度快，且随数据集规模的扩展性良好。<sup>[4](https://www.usenix.org/legacy/event/sec08/tech/full_papers/gu/gu.pdf)</sup>

## 局限与扩展

**球形簇。** X-means继承了K-means的球形簇假设，当真实簇不是球形时，这可能导致严重的过拟合。Heo和Woo提出了两种扩展方法——改进型X-means（MX-means）和广义X-means（GX-means），它们为每个簇使用一个完整的协方差矩阵。MX-means使用K-means在当前K值下寻找最优簇，简单且快速，但当簇重叠时会生成错误估计的中心；GX-means使用EM算法估计参数，即使簇重叠也能产生更稳定的聚类。两者都从一个簇开始，迭代分裂以最大化BIC分数。<sup>[3](https://www.kci.go.kr/kciportal/ci/sereArticleSearch/ciSereArtiView.kci?sereArticleSearchBean.artiId=ART001243620)</sup>

**相关衍生方法。** GMeans通过检验高斯性而非BIC来增长簇，在ELKI中作为X-means的直接子类实现。<sup>[6](https://elki-project.github.io/releases/current/javadoc/elki/clustering/kmeans/XMeans.html)</sup> 应用驱动的变体也已出现；例如，在无线传感器网络聚类中，适应度函数X-means（FFX-means）增加了一个准则，根据质心到汇聚节点的距离以及簇大小与网络平均簇大小的关系来判断一个簇是否值得分裂。<sup>[7](https://ijece.iaescore.com/index.php/IJECE/article/download/26672/16212)</sup>

## 实际使用

X-means可在标准研究工具包中使用。ELKI将其纳入聚类算法之中，并指出它可用于选择参数k。<sup>[8](https://elki-project.github.io/howto/clustering)</sup> ELKI实现目前不使用k-d树进行加速。<sup>[6](https://elki-project.github.io/releases/current/javadoc/elki/clustering/kmeans/XMeans.html)</sup> X-means论文中的BIC公式已被直接复用于其他聚类库，例如Muster包的BIC实现，用于具有球形高斯簇假设的K-means和[K-medoids](https://www.edgepedia.org/zh/k-medoids)聚类。<sup>[2](https://software.llnl.gov/muster/bic_8h_source.html)</sup> Dan Pelleg还在其卡内基梅隆大学页面上以非商业许可证分发了参考版K-means和X-means实现。<sup>[9](https://www.cs.cmu.edu/~dpelleg/kmeans.html)</sup>

在比较研究中，X-means是若干自动簇数估计器之一，而非普遍最优的方法。2021年一项将估计方法与不同K-means变体配对的比较发现，X-means风格的BIC搜索（XBI）无法使用DELTA初始化技巧，因为在X-means中数据集在每次探索迭代时都会变化；在合成数据上，基于BIC的估计不如某些替代方法准确，但通过更好的K-means加速仍有所改善。<sup>[10](https://link.springer.com/article/10.1007/s00778-021-00716-y)</sup> 一项购物趋势案例研究发现，在该数据集上DBSCAN的聚类有效性优于K-means和X-means。<sup>[11](https://journal.irpi.or.id/index.php/ijatis/article/view/1135)</sup>

## References

1. [Dan Pelleg, Andrew Moore (2000). X-means: Extending K-means with Efficient Estimation of the Number of Clusters. ICML 2000.](https://www.cs.cmu.edu/~dpelleg/download/xmeans.pdf)
2. [Muster: src/bic.h Source File, Lawrence Livermore National Laboratory](https://software.llnl.gov/muster/bic_8h_source.html)
3. [Gyeongyong Heo, Young Woon Woo (2008). Extensions of X-means with Efficient Learning the Number of Clusters. Journal of the Korea Institute of Information and Communication Engineering 12(4), 772–780.](https://www.kci.go.kr/kciportal/ci/sereArticleSearch/ciSereArtiView.kci?sereArticleSearchBean.artiId=ART001243620)
4. [Gu et al. (2008). USENIX Security Symposium paper describing X-means' cluster-number estimation.](https://www.usenix.org/legacy/event/sec08/tech/full_papers/gu/gu.pdf)
5. [On Determining The Number Of Clusters – A Comparative Study, CiteSeerX](https://citeseerx.ist.psu.edu/document?doi=ea7d1c6aa7308c55d11fc6e64f5c983d437c7e67&repid=rep1&type=pdf)
6. [ELKI javadoc: elki.clustering.kmeans.XMeans](https://elki-project.github.io/releases/current/javadoc/elki/clustering/kmeans/XMeans.html)
7. [International Journal of Electrical and Computer Engineering (IJECE): FFX-means article](https://ijece.iaescore.com/index.php/IJECE/article/download/26672/16212)
8. [ELKI how-to: Clustering](https://elki-project.github.io/howto/clustering)
9. [Dan Pelleg, K-means and X-means implementations, Carnegie Mellon University](https://www.cs.cmu.edu/~dpelleg/kmeans.html)
10. [Efficient exploratory clustering analyses in large-scale exploration processes. The VLDB Journal (2021).](https://link.springer.com/article/10.1007/s00778-021-00716-y)
11. [Comparison of DBSCAN, K-Means and X-Means Algorithms on Shopping Trends Data. IJATIS.](https://journal.irpi.or.id/index.php/ijatis/article/view/1135)

---
*Initially written 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/x-means

English original: https://www.edgepedia.org/x-means
