# Ward方法

**Ward方法**（Ward最小方差法）是一种凝聚层次聚类准则，在每一步中，合并两个簇，使得合并后各点到簇中心的簇内平方距离总和增加量最小。该方法由拉克兰空军基地航空航天医学部的小乔·H·沃德（Joe H. Ward Jr.）在1963年发表于《美国统计协会杂志》的论文《为优化目标函数而进行的层次分组》中描述，该文针对大规模研究（n > 100）提出了这一流程，因为在此类情形下精确最优分组不切实际。<sup>[1](https://doi.org/10.1080/01621459.1963.10500845)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 小乔·H·沃德（Joe H. Ward Jr.），《为优化目标函数而进行的层次分组》，《美国统计协会杂志》58(301), 236–244, 1963<sup>[1](https://doi.org/10.1080/01621459.1963.10500845)</sup> |
| 合并规则 | 在每一步凝聚中，合并使误差平方和（簇内平方和）增加量最小的簇对<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC9017600/)</sup> |
| 簇的特征 | 旨在找到紧凑的球形簇；倾向于产生大小和形状相对均衡的簇<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup><sup> • </sup><sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC5665711/)</sup> |
| 距离要求 | 在最小方差目标下，连接关系仅对平方欧氏距离正确定义<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC5235383/)</sup> |
| 软件命名 | 在R的`hclust`中，`"ward.D2"`实现Ward 1963准则，而`"ward.D"`不实现；两者的区别在于聚类更新前是否对相异度取平方<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup> |
| 理论保证 | 当最优k聚类分离良好时，在任意维度下计算k均值目标的2-近似<sup>[6](https://arxiv.org/abs/1907.05094)</sup> |

## 算法

Ward方法是一种自底向上的凝聚式过程。它从每个观测值作为自身的单点簇开始，反复合并两个最相似的簇，直到只剩一个簇；在每个阶段，簇间距离根据所用方法通过Lance–Williams相异度更新公式重新计算。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup> Ward的具体准则选择使簇质心周围平方距离总和增加量最小的合并，因此树状图的高度记录了每个分组阶段的损失。<sup>[7](https://brb.nci.nih.gov/techreport/DesignandAnalysisofDNAMicroarrayInvestigations.pdf)</sup><sup> • </sup><sup>[1](https://doi.org/10.1080/01621459.1963.10500845)</sup>

Ward的原始论文对该流程作了一般性表述：给定n个集合，通过考察所有n(n − 1)/2个可能对并选择研究者所选目标函数值最大的并集，将其缩减为n − 1个互斥集合，重复此过程直到只剩一个组。<sup>[1](https://doi.org/10.1080/01621459.1963.10500845)</sup> 最小方差准则成为“Ward方法”几乎总是指代的版本。<sup>[8](https://biodatamining.biomedcentral.com/articles/10.1186/1756-0381-3-1/tables/2)</sup>

## 距离要求与ward.D / ward.D2的区别

最小方差目标与平方欧氏几何紧密相关：Ward连接只能应用于使用平方欧氏度量的距离矩阵，因为簇质心被定义为使到簇成员的平方欧氏距离之和最小的点。<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC5235383/)</sup> 文献中存在两种不同的Ward聚类算法，软件对它们的实现并不一致。在R的`hclust`函数中，选项`"ward.D"`（等价于R版本≤ 3.0.3中唯一的Ward选项`"ward"`）不实现Ward 1963聚类准则，而`"ward.D2"`实现该准则，在聚类更新前对相异度取平方；cluster包中的`agnes(*, method="ward")`对应于`hclust(*, "ward.D2")`。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup>

这一分歧有明确的文献记载。Fionn Murtagh（其1992年的[Fortran](https://www.edgepedia.org/zh/fortran)代码是`hclust`的基础）和Pierre Legendre表明，直到R版本3.0.2，`hclust`实现的是第一种变体（Ward1），而`agnes`实现的是第二种（Ward2）；2013年9月，针对他们的工作，R核心团队准备了一个新的`hclust`，同时提供`method="ward"`（Ward1）和`method="ward.D2"`（Ward2）。<sup>[9](https://staff.fmi.uvt.ro/~daniela.zaharie/dm2019/RO/proiecte/biblio/HierarchicalClustering/WardAlgorithm.pdf)</sup> R源代码将`"ward.D"`和`"ward.D2"`选项归功于Pierre Legendre和Martin Maechler的建议，旧的`"ward"`名称被重定向到`"ward.D"`，并附有一条说明重命名的消息。<sup>[10](https://github.com/SurajGupta/r-source/blob/master/src/library/stats/R/hclust.R)</sup> 将Ward方法应用于非欧氏相异度矩阵（例如由相关性构建的矩阵）而不对距离取平方，是一个反复出现的实际错误，而ward.D/ward.D2的区别使这种错误很容易犯。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup>

## 性质与行为

**簇的形状与大小。** Ward最小方差法旨在获得紧凑的球形簇。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup> 由于每次合并以其方差代价来评判，该方法倾向于产生大小和形状大致均衡的簇，形成球状而非细长或链状的簇。<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC5665711/)</sup> 它不能用于二值变量，这一局限源于其对平方欧氏距离的依赖。<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC5665711/)</sup>

**离群值。** 按方差代价合并使该方法对离群值敏感，离群值倾向于与其他小簇合并，而非作为孤立点保留。<sup>[4](https://pmc.ncbi.nlm.nih.gov/articles/PMC5665711/)</sup> 后续工作构建了对离群值较不敏感的算法变体。<sup>[11](https://www.sciencedirect.com/science/article/pii/S0047259X22000781)</sup>

**簇结构的恢复。** 蒙特卡洛验证研究倾向于支持这样的观点：在层次方法中，Ward最小方差法对植入的簇结构恢复得最好，尽管对验证文献更全面的回顾表明，其他算法在多种条件下可以提供更好的恢复，应用研究者已被提醒不要不加批判地选择Ward方法。<sup>[12](https://pubmed.ncbi.nlm.nih.gov/26815599/)</sup> SAS文档总结了同样的模式：由于大多数聚类方法偏向于具有特定大小、形状或离散特征的簇，评估研究自然倾向于平均连接和Ward方法而非大多数其他层次方法，尤其是单连接。<sup>[13](https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/statug_introclus_sect004.htm)</sup>

## 理论分析

Ward方法是层次k均值的一种贪心启发式：从单点簇开始，它连续合并使所得聚类的k均值代价局部最小化的簇对。<sup>[6](https://arxiv.org/abs/1907.05094)</sup> 在SODA 2019上，理论计算机科学家Anna Großwendt、Heiko Röglin和Melanie Schmidt证明了，当最优k聚类分离良好时，Ward方法产生的聚类在k均值目标下达到2-近似，并且在满足额外平衡条件时能精确恢复该最优解；这两项保证在任意维度下均适用。在没有分离保证的情况下，他们给出了\(\mathbb{R}^{d}\)中数据集的下界\(\Omega((3/2)^{d})\)，并表明Ward对一维数据产生\(\mathcal{O}(1)\)-近似聚类。<sup>[6](https://arxiv.org/abs/1907.05094)</sup>

## 实践中的使用与替代方案

Ward方法是主流软件中的标准选项：R的`hclust`和`agnes`、MATLAB的`linkage`函数（使用`"ward"`方法）、SAS、SPSS和SciPy均提供该方法。<sup>[3](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)</sup><sup> • </sup><sup>[14](https://www.mathworks.com/help/stats/linkage.html)</sup> 在针对临床数据聚类的模拟衍生最佳实践中，使用Ward方法的凝聚层次聚类被描述为一种基于连通性的方法，它顺序合并对象以最小化簇内误差平方和，且不需要先验指定簇的数量。<sup>[2](https://pmc.ncbi.nlm.nih.gov/articles/PMC9017600/)</sup> 针对消费者感官项目的建议指出，尽管欧氏距离配合Ward方法似乎是安全合理的选择，但强烈建议测试和验证不同的距离与连接组合。<sup>[15](https://pmc.ncbi.nlm.nih.gov/articles/PMC10230197/)</sup>

推广将该准则扩展到平方欧氏数据之外：Ward方法已通过将簇内平方和推广到非欧氏情形而适配于曼哈顿距离。<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC5235383/)</sup> 在竞争方面，Genie连接准则限制了簇大小不平等度量的增加，在已发表的聚类质量基准中通常优于Ward或平均连接，同时保持单连接的速度。<sup>[16](https://arxiv.org/abs/2209.05757)</sup>

## References

1. [Ward, J. H. Jr. (1963). Hierarchical Grouping to Optimize an Objective Function. Journal of the American Statistical Association 58(301), 236–244.](https://doi.org/10.1080/01621459.1963.10500845)
2. [Simulation-derived best practices for clustering clinical data, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC9017600/)
3. [hclust: Hierarchical Clustering, R stats documentation](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/hclust.html)
4. [Cluster Analysis in Nursing Research, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC5665711/)
5. [Generalising Ward's Method for Use with Manhattan Distances, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC5235383/)
6. [Großwendt, A., Röglin, H., Schmidt, M. (2019). Analysis of Ward's Method. SODA 2019, arXiv:1907.05094](https://arxiv.org/abs/1907.05094)
7. [Design and Analysis of DNA Microarray Investigations, NCI Technical Report](https://brb.nci.nih.gov/techreport/DesignandAnalysisofDNAMicroarrayInvestigations.pdf)
8. [A reference guide for tree analysis and visualization, BioData Mining](https://biodatamining.biomedcentral.com/articles/10.1186/1756-0381-3-1/tables/2)
9. [Murtagh, F., Legendre, P. (2014). Ward's Hierarchical Clustering Method: Clustering Criterion and Agglomerative Algorithm, arXiv:1111.6285](https://staff.fmi.uvt.ro/~daniela.zaharie/dm2019/RO/proiecte/biblio/HierarchicalClustering/WardAlgorithm.pdf)
10. [R source, src/library/stats/R/hclust.R, GitHub](https://github.com/SurajGupta/r-source/blob/master/src/library/stats/R/hclust.R)
11. [Statistical analysis of a hierarchical clustering algorithm with outliers, ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0047259X22000781)
12. [A Review of Monte Carlo Tests of Cluster Analysis, PubMed](https://pubmed.ncbi.nlm.nih.gov/26815599/)
13. [Characteristics of Methods for Clustering Observations, SAS/STAT User's Guide](https://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/statug_introclus_sect004.htm)
14. [linkage: Agglomerative hierarchical cluster tree, MATLAB documentation](https://www.mathworks.com/help/stats/linkage.html)
15. [Recommendations for validating hierarchical clustering in consumer sensory projects, PMC](https://pmc.ncbi.nlm.nih.gov/articles/PMC10230197/)
16. [Genie: A new, fast, and outlier-resistant hierarchical clustering algorithm, arXiv:2209.05757](https://arxiv.org/abs/2209.05757)

---
*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/wards-method

English original: https://www.edgepedia.org/wards-method
