- Introduced by
- Katherine Heller & Zoubin Ghahramani
- Year
- 2005
- Type
- Probabilistic clustering / model-based hierarchical agglomeration
- Family
- Multivariate analysis
What does it do?
Bayesian hierarchical clustering is a probabilistic agglomerative method that builds a tree of nested cluster merges by comparing Bayesian marginal likelihoods at each step.
Instead of minimising a geometric linkage criterion, it asks at every candidate merge whether the data in two clusters are better explained by one shared model or by two separate models. The result is a dendrogram whose nodes carry model-based merge probabilities.
The intuition behind the method
Standard hierarchical clustering uses heuristic distance rules, such as average or Ward linkage, to decide which two clusters to merge next. Bayesian hierarchical clustering replaces that rule with a probability: given the data in two candidate clusters, is it more likely that they were generated by one parametric model or by two separate ones? This comparison is made with marginal likelihoods, which integrate out the model parameters under their priors, so the merge decisions follow from an explicit statistical model. Each merge also receives a merge probability, which can be used to decide where to cut the tree.
History
Heller and Ghahramani introduced Bayesian hierarchical clustering at ICML 2005 as a model-based alternative to distance-based agglomerative clustering. According to their abstract, merges are decided by marginal likelihoods rather than an ad hoc distance, Bayesian hypothesis testing indicates which merges are advantageous and recommends the depth of the tree, and the algorithm can be read as a fast bottom-up approximate inference method for a Dirichlet process mixture model.
When to use it
Choose Bayesian hierarchical clustering when the question is hierarchical, the observations are multivariate, and a conjugate likelihood is a reasonable description of the data, for example continuous measurements under a Gaussian model or counts under a Dirichlet-Multinomial model. Its key assumptions are exchangeable observations that are conditionally independent given the cluster parameters, a likelihood family fixed in advance, and prior hyperparameters that influence the result. Refit with different alpha and prior settings and check whether the merge structure is stable. It is appropriate when you want each merge justified by a probability rather than a distance, and when the sample size is small enough for the greedy search to remain feasible. Do not choose it for very large data sets without a scalable variant, when no conjugate family describes the data reasonably, or when only a flat partition is needed and a mixture model would answer the question more directly. If the nested tree has no substantive meaning for your problem, the additional modelling effort adds little.
Limitations and considerations
- Merge scores depend on the chosen likelihood family and conjugate prior; when the data depart strongly from that family, the merge probabilities can mislead.
- The merge procedure is greedy, so the final tree is not guaranteed to be the most probable tree over all possible hierarchies.
- Computational cost grows steeply with sample size, so the naive algorithm becomes slow on large data sets unless approximations are used.
- The concentration parameter alpha shapes how many clusters the prior expects. The source paper describes procedures for learning hyperparameters, but the value of alpha still influences how readily new clusters form.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Merge decisions come from marginal likelihood comparisons under an explicit parametric model rather than from a distance or linkage rule, so the criterion can be stated and checked.
- Each internal node carries a merge probability r_k, which gives a model-based basis for deciding where to cut the tree instead of choosing a height by eye.
- Conjugate priors give closed-form marginal likelihoods for Gaussian and Multinomial-type data, so the merge scores are exact rather than estimated by sampling.
- The Dirichlet process prior links the method to Dirichlet process mixture models, which the source paper uses to interpret the algorithm as approximate inference.
Applications
- Clustering multivariate continuous measurements, such as clinical or biological profiles, under a Gaussian model with an inverse-Wishart prior, where a nested grouping is of interest.
- Clustering document or count data under a Dirichlet-Multinomial model, producing a hierarchy of groups defined by word-count profiles.
- Exploratory analysis of moderate-sized data sets in which merge probabilities are used to judge how many groups the data support.
How it works
How it works
The prior over tree structures is built from a Dirichlet process with concentration parameter alpha. Alpha controls how readily the prior allows separate groups: smaller values favour fewer clusters and larger values allow more. The prior supplies the probability term pi_k in the merge probability, which is the prior probability that the data under node k form a single cluster. Its exact form is given in Heller and Ghahramani (2005).
Formula
p(T) \propto \prod_{n} \alphaFor a candidate pair of clusters, the algorithm computes the marginal likelihood of the combined data under one shared parametric model, integrating the model parameters out against their prior. With conjugate priors such as Gaussian-inverse-Wishart or Dirichlet-Multinomial, this integral has a closed form, so the score is computed exactly rather than by sampling. Observations within a cluster are assumed exchangeable and conditionally independent given the cluster parameters, and the likelihood family is fixed in advance.
Formula
p(\mathcal{D}_k | H_1^k) = \int p(\mathcal{D}_k | \theta)\, p(\theta | \beta)\, d\thetaAt each step the algorithm computes the merge probability r_k for each candidate merge. It compares the marginal likelihood of the hypothesis that the two clusters form one group (H1) with that of the hypothesis that they remain two separate subtrees (H2), weighted by the prior probability pi_k. The candidate with the highest r_k is merged.
Formula
r_k = \frac{\pi_k\, p(\mathcal{D}_k | H_1^k)}{\pi_k\, p(\mathcal{D}_k | H_1^k) + (1-\pi_k)\, p(\mathcal{D}_k | H_2^k)}Merges proceed greedily, taking the candidate pair with the highest r_k at each step, until all observations are joined under a single root. The result is a binary tree in which each internal node records the merge probability at which it was formed. The source uses Bayesian hypothesis testing on these merge probabilities to decide which merges are advantageous and to recommend the depth of the tree. A common practical rule is to cut at nodes whose r_k is below one half, since such merges are not favoured by the model, or to examine the full tree to study nested structure.
Common pitfalls
- Calling BHC nonparametric in the everyday sense. Within each cluster it assumes a parametric likelihood, and its results depend on that choice.
- Ignoring the merge probability r_k and cutting the tree at an arbitrary height, which discards the main advantage over classical hierarchical clustering.
- Running the naive algorithm on a large data set and expecting fast results without a scalable or approximate variant.
- Reading the output as a flat mixture posterior. BHC returns a tree of nested merges, so cluster counts and memberships are obtained by cutting the tree, not from a fitted mixture.
Frequently asked questions
How does Bayesian hierarchical clustering differ from standard hierarchical clustering?
Standard hierarchical clustering merges clusters by a geometric distance or linkage rule with no probabilistic interpretation. BHC replaces that rule with a Bayesian model comparison: at each step it computes the probability that two candidate clusters come from one shared model rather than two separate ones, and merges the pair with the highest such probability.
How do I choose the number of clusters from the BHC dendrogram?
Each internal node carries a merge probability r_k. The source paper uses Bayesian hypothesis testing on these merge probabilities to decide which merges are advantageous and to recommend the depth of the tree; r_k above one half indicates a merge the model favours. A common practical rule is to cut the tree just below nodes with r_k under one half to get a flat partition. This is a convention rather than the paper's procedure, and it can be varied to suit the analysis.
What likelihood and prior should I use?
For continuous data, a Gaussian likelihood with an inverse-Wishart prior on the covariance and a Normal prior on the mean is a standard choice with a closed-form marginal likelihood. For count or categorical data, a Dirichlet-Multinomial model is the natural conjugate choice. The key requirement is that the prior be conjugate to the likelihood so that the marginal integral is tractable. Check sensitivity by refitting with different alpha and hyperparameter values.
Is BHC suitable for large datasets?
The naive algorithm becomes slow as the number of observations grows, so it is not suited to large data sets in its basic form. Approximate or scalable variants would be needed for large data.
How does BHC relate to Dirichlet process mixture models?
BHC uses a Dirichlet process prior, so it shares its nonparametric prior family with DP mixtures. The source paper interprets the algorithm as a fast bottom-up approximate inference method for a DP mixture. DP mixtures produce a flat partition posterior, whereas BHC produces a tree of nested partitions, so the two methods answer related but different questions.
Related methods
Sources
Heller, K. A. & Ghahramani, Z. (2005). Bayesian hierarchical clustering. In Proceedings of the 22nd International Conference on Machine Learning (ICML 2005), pp. 297–304. ACM.
Open DOI referenceMurtagh, F. & Legendre, P. (2014). Ward's hierarchical agglomerative clustering method: which algorithms implement Ward's criterion? Journal of Classification, 31(3), 274–295.
Open DOI reference