Tutorials › Multi-Omics Data Integration › Variational Inference for Bayesian Integrative Clustering

Bayesian Integrative Clustering · Tutorial 278 of 597

Variational Inference for Bayesian Integrative Clustering

You will derive coordinate-ascent variational updates for an integrative mixture and learn how to interpret their approximate assignment uncertainty and computational limitations.

Advanced 12 min read

What You'll Learn

  • State a conjugate Bayesian mixture model for multiple omics blocks and its conditional-independence assumptions.
  • Derive the mean-field evidence lower bound and coordinate updates for labels, cluster prevalence, and profiles.
  • Calculate responsibilities and conjugate variational parameter updates from small hypothetical data.
  • Interpret assignment entropy without treating a variational approximation as exact posterior uncertainty.
  • Diagnose poor local optima, factorization error, and computational costs relative to sampling methods.

Why use a variational approximation?

A Bayesian integrative mixture represents each sample by a shared latent cluster label while allowing each omics modality to have its own cluster-specific profile. The posterior distribution over labels and parameters can be difficult to explore when many samples, features, or clusters are involved. Gibbs sampling and split-merge moves target that posterior by simulation, but may require many iterations and can be computationally demanding. Variational inference instead searches for a tractable distribution that approximates the posterior and improves a lower bound on the log marginal likelihood.

The trade-off is important: variational inference is often faster and produces convenient approximate distributions, but its factorization can omit posterior dependence and its optimization can settle at a local optimum. The resulting assignment probabilities are therefore probabilities under the fitted approximation, not exact posterior probabilities.

Model and mean-field family

Consider \(N\) samples, \(K\) clusters, and \(M\) modalities. For sample \(i\), modality \(m\), and feature \(j\), let \(x_{imj}\) be a binary observation and \(z_i\) the shared cluster label, represented by \(z_{ik}=1\) when sample \(i\) belongs to cluster \(k\) and zero otherwise. Suppose \(x_{imj}\), conditional on \(z_i=k\) and its profile parameter \(\theta_{kmj}\), follows a Bernoulli distribution with success probability \(\theta_{kmj}\). Let the cluster proportions be \(\pi=(\pi_1,\ldots,\pi_K)\).

For this derivation, assume the observations are conditionally independent across samples and features and across modalities given the shared labels and the modality-specific profiles. The priors are \(\pi\sim\operatorname{Dirichlet}(\alpha_1,\ldots,\alpha_K)\), \(z_i\mid\pi\sim\operatorname{Categorical}(\pi)\), and independently \(\theta_{kmj}\sim\operatorname{Beta}(a_{mj},b_{mj})\). Missing feature values are omitted from the likelihood and sufficient statistics; this treatment assumes the observation pattern does not itself carry modeled information about the labels or profiles.

Definition: A mean-field variational approximation chooses a distribution \(q\) from a restricted family that factorizes selected unknown quantities. Here we use \(q(\pi,\theta,z)=q(\pi)\prod_{i=1}^Nq(z_i)\prod_{k=1}^K\prod_{m=1}^M\prod_jq(\theta_{kmj})\), with \(q(z_i)\) categorical, \(q(\pi)\) Dirichlet, and each \(q(\theta_{kmj})\) Beta. Write \(r_{ik}=q(z_{ik}=1)\), so \(r_{ik}\geq0\) and \(\sum_k r_{ik}=1\).

This factorization is an approximation, not a conditional-independence assertion about the exact posterior. In particular, the exact posterior generally couples labels to mixture proportions and profiles. The variational family suppresses those dependencies in order to make optimization manageable.

The evidence lower bound and coordinate updates

Let \(X\) denote all observed values and \(Z\) all labels. The evidence lower bound (ELBO) is

$$ \mathcal{L}(q)=\mathbb{E}_q[\log p(X,Z,\pi,\theta)]-\mathbb{E}_q[\log q(Z,\pi,\theta)]. $$

The identity \(\log p(X)=\mathcal{L}(q)+\operatorname{KL}\{q(Z,\pi,\theta)\,\|\,p(Z,\pi,\theta\mid X)\}\) shows that the ELBO is a lower bound, since Kullback–Leibler divergence is nonnegative. Maximizing it reduces this divergence within the chosen family, but does not ensure that the best member of the family is close to the exact posterior.

For any one factor \(q_j\), with all other factors fixed, the coordinate-optimal update is proportional to the exponential of the expected log joint density, where the expectation is over all variables except the one in that factor. To see this, write the terms involving \(q_j\) as \(\int q_j(u)h(u)\,du-\int q_j(u)\log q_j(u)\,du\), plus a constant. Normalizing \(\exp\{h(u)\}\) gives the maximum: the difference from that value is a negative Kullback–Leibler divergence. Thus the coordinate update improves or leaves unchanged the ELBO.

For the model above, these updates preserve conjugate forms. Define \(\psi\) as the digamma function, the derivative of the log gamma function. Then

$$ q(\pi)=\operatorname{Dirichlet}(\gamma_1,\ldots,\gamma_K), \qquad \gamma_k=\alpha_k+\sum_i r_{ik}. $$

For each profile parameter, using only observed values of that feature,

$$ q(\theta_{kmj})=\operatorname{Beta}(A_{kmj},B_{kmj}),\quad A_{kmj}=a_{mj}+\sum_i r_{ik}x_{imj},\quad B_{kmj}=b_{mj}+\sum_i r_{ik}(1-x_{imj}). $$

The assignment update is a normalized exponential of the expected log mixture weight plus the expected log likelihood for all observed features and modalities:

$$ r_{ik}\ \propto\ \exp\left[ \psi(\gamma_k)-\psi\!\left(\sum_{\ell=1}^K\gamma_\ell\right) +\sum_{m,j\ \mathrm{observed\ for}\ i} \left\{x_{imj}\big[\psi(A_{kmj})-\psi(A_{kmj}+B_{kmj})\big] +(1-x_{imj})\big[\psi(B_{kmj})-\psi(A_{kmj}+B_{kmj})\big]\right\} \right], \qquad \sum_k r_{ik}=1. $$

This update combines evidence across modalities because a sample has one shared label. It does not imply that each modality has the same profile: the parameters \(\theta_{kmj}\) remain modality- and feature-specific.

Worked Example: Updating One Sample’s Responsibilities

Consider one binary feature observed in one modality for a sample, with \(x=1\) and two clusters. Suppose the current variational factors are \(q(\pi)=\operatorname{Dirichlet}(3,2)\), \(q(\theta_1)=\operatorname{Beta}(3,1)\), and \(q(\theta_2)=\operatorname{Beta}(1,3)\). These are hypothetical factor values for illustrating one coordinate update.

For a Dirichlet factor, \(\mathbb{E}[\log\pi_k]=\psi(\gamma_k)-\psi(\gamma_1+\gamma_2)\). The resulting expected log weights are approximately \(-0.5833\) for cluster 1 and \(-1.0833\) for cluster 2. For integer arguments, digamma differences can be calculated using harmonic sums; for example, \(\psi(3)-\psi(4)=-1/3\). The expected log success probabilities are \(-0.3333\) under \(\operatorname{Beta}(3,1)\) and \(-1.8333\) under \(\operatorname{Beta}(1,3)\).

Because \(x=1\), the underlying log scores are approximately \(-0.9167\) for cluster 1 and \(-2.9167\) for cluster 2; the displayed rounded terms sum to \(-0.9166\) and \(-2.9166\), respectively. Their difference is 2, so normalization gives

$$ r_{11}=\frac{\exp(-0.9167)}{\exp(-0.9167)+\exp(-2.9167)} =\frac{\exp(2)}{1+\exp(2)} \approx 0.8808,\qquad r_{12}=1-r_{11}\approx0.1192. $$

Under these factors and this single observation, the approximate assignment favors cluster 1. It is not a claim that the exact posterior probability of cluster 1 is 0.8808.

Worked Example: Updating Prevalence and Profiles

Suppose there are three samples, two clusters, and two modalities, each with one observed binary feature. In modality A the observations are \((1,0,1)\); in modality B they are \((1,1,0)\). Use hypothetical current responsibilities \(r_1=(0.8,0.2)\), \(r_2=(0.3,0.7)\), and \(r_3=(0.6,0.4)\), with all prevalence and Beta prior parameters equal to 1.

The cluster responsibility totals are \(0.8+0.3+0.6=1.7\) and \(0.2+0.7+0.4=1.3\). Therefore \(q(\pi)=\operatorname{Dirichlet}(2.7,2.3)\). In modality A, cluster 1 receives weighted successes \(0.8+0+0.6=1.4\) and weighted failures \(0+0.3+0=0.3\), giving \(q(\theta_{1,A})=\operatorname{Beta}(2.4,1.3)\). Cluster 2 has successes \(0.2+0+0.4=0.6\) and failures \(0+0.7+0=0.7\), giving \(\operatorname{Beta}(1.6,1.7)\).

In modality B, cluster 1 has successes \(0.8+0.3=1.1\) and failures \(0.6\), so its factor is \(\operatorname{Beta}(2.1,1.6)\). Cluster 2 has successes \(0.2+0.7=0.9\) and failures \(0.4\), giving \(\operatorname{Beta}(1.9,1.4)\). These are one set of parameter updates; the next label update would use the expected log weights and profiles just calculated. Repeated updates, rather than a single pass, are needed for coordinate ascent.

Approximate assignment uncertainty

The factor \(q(z_i)\) is a categorical distribution with probabilities \(r_{i1},\ldots,r_{iK}\). Its entropy, measured in nats, is \(-\sum_k r_{ik}\log r_{ik}\), with \(0\log0\) interpreted as zero. Entropy is small when one approximate assignment probability dominates and large when probability is spread across clusters. It describes uncertainty within the fitted variational factor, not all uncertainty in the exact posterior.

Worked Example: Computing Assignment Entropy

For the responsibilities \((0.8808,0.1192)\) from the first example, the entropy is

$$ -\{0.8808\log(0.8808)+0.1192\log(0.1192)\}\approx0.3653\ \text{nats}. $$

The maximum entropy for two clusters is \(\log 2\approx0.6931\) nats, attained at \((0.5,0.5)\), while a degenerate factor such as \((1,0)\) has entropy zero. The computed value is between these extremes. It summarizes the spread of this approximate label factor; it is neither a measure of uncertainty in the true biological grouping alone nor a guarantee that the approximation captures posterior uncertainty accurately.

Optimization, diagnostics, and alternatives

A practical coordinate-ascent algorithm alternates updates of the label factors with the conjugate parameter factors. Initialization matters because the ELBO is generally not jointly concave in all variational parameters. Each exact coordinate update should not decrease the ELBO, apart from numerical error, but the final solution may be only a local optimum. Multiple initializations are therefore useful; compare their final ELBO values and inspect whether the resulting fitted profiles and allocations are substantively plausible.

1
Initialize variational factors.
Choose valid responsibilities and set the corresponding Dirichlet and Beta parameters. Use more than one reasonable initialization when feasible.
2
Update conjugate parameters.
Compute expected cluster counts and weighted feature success and failure counts from the current responsibilities.
3
Update responsibilities.
For each sample, calculate the expected log score in every cluster across its observed modalities, then normalize the scores.
4
Monitor and inspect.
Recompute the ELBO and stop when its change is small under a stated numerical tolerance. Also check for NaNs, invalid probabilities, unstable iterations, and solutions dominated by implausible allocations.

Numerically, use a log-sum-exp calculation to normalize assignment scores: subtract the largest score before exponentiating, then divide by the sum. Otherwise, very negative expected log scores can underflow to zero. A decreasing ELBO can indicate an implementation error, an inexact update, or numerical instability. A rising ELBO alone is not a model check: it confirms progress in the chosen optimization criterion, not that the assumed likelihoods or conditional independences adequately describe the data.

Compared with Gibbs sampling or split-merge sampling, mean-field variational inference avoids producing a long chain of posterior draws and can be substantially faster for large data sets. Sampling can represent posterior dependence more faithfully in principle, but computational mixing and multimodality can be serious concerns. Collapsed sampling integrates out some parameters before updating labels, whereas the variational updates above retain variational factors for prevalence and profiles. These approaches answer the same posterior-inference problem with different computational approximations; none removes the need to examine model adequacy.

The main limitation of this mean-field family is its imposed independence. It may understate uncertainty when labels and profiles are strongly coupled, or when several parameters must vary together to explain the data. A sharply concentrated \(q(z_i)\) can therefore reflect the approximation as well as strong evidence. Further, a model with many features can accumulate large likelihood contributions, so a modality with more features may exert more influence; this tutorial’s updates do not correct a poorly chosen likelihood or an unsuitable feature scale. Evaluate the model and the modality contributions rather than interpreting a high ELBO or confident-looking responsibilities as proof of a correct clustering.

Common pitfall

  • Wrong reasoning: “The variational responsibility is 0.99, so the exact posterior probability that this sample belongs to this cluster is 0.99.”
  • Correction: The value 0.99 is \(q(z_i=k)\) under a particular optimized factorized approximation. The omitted posterior dependencies and local optimization can make it overconfident. Report it as an approximate assignment probability and assess sensitivity to initialization and the model assumptions.
Key takeaway: Mean-field variational inference turns a difficult posterior calculation into tractable coordinate updates by restricting the distributional family. The ELBO provides an optimization target, while approximation error and local optima remain important limits on uncertainty interpretation.

Check Your Understanding

Try each question, then compare your reasoning with the solutions below.

  1. If responsibilities for a sample are \((0.6,0.4)\), calculate its assignment entropy in nats and state what it summarizes.
  2. With a \(\operatorname{Beta}(1,1)\) prior and one sample observed as 1 with responsibility 0.7 for a cluster, what are the updated Beta parameters for that cluster’s feature profile?
  3. Why does coordinate ascent not guarantee the globally best variational approximation?
  4. Name one symptom of numerical instability in responsibility updates and one practical prevention.

Solutions. (1) The entropy is \(-0.6\log(0.6)-0.4\log(0.4)\approx0.6730\) nats. It summarizes the spread of the approximate categorical factor for that sample. (2) The weighted success count is \(0.7(1)=0.7\), and the weighted failure count is \(0.7(0)=0\), so the updated factor is \(\operatorname{Beta}(1.7,1.0)\). (3) The ELBO is not generally jointly concave in all variational parameters, so coordinate updates can converge to a local optimum that depends on initialization. (4) Exponentiating very negative scores can underflow, producing zero or invalid normalized probabilities; compute normalization with the log-sum-exp method.

Clinical Biostats