- Introduced by
- Francis Bach & Michael Jordan (probabilistic formulation, 2005); Klami, Virtanen & Kaski (fully Bayesian treatment, 2013)
- Year
- 2005-2013
- Type
- Latent variable model / dimensionality reduction
- Family
- Multivariate analysis
What does it do?
Bayesian canonical correlation analysis is a probabilistic latent-variable model for matched sets of continuous variables measured on the same observations.
It treats each view as a noisy linear projection of shared latent variables and places priors on the parameters, so the estimated shared structure comes with posterior uncertainty. In the fully Bayesian treatment of Klami, Virtanen and Kaski (2013), automatic relevance determination (ARD) priors are used to infer how many shared dimensions the data support.
The intuition behind the method
Classical canonical correlation analysis asks which linear combinations of two variable sets correlate most strongly, and returns point estimates of those directions and their correlations. Bayesian CCA treats both variable sets as noisy projections of a common set of hidden factors. Priors on the projection matrices and noise terms can shrink dimensions that the data do not support toward zero, and the fit returns posterior distributions over the shared structure rather than single values. This matters most when the number of variables is large relative to the number of observations, although the shrinkage is only as sound as the prior choices.
History
Canonical correlation analysis was introduced by Harold Hotelling in 1936. Bach and Jordan (2005) gave a probabilistic interpretation of CCA in a technical report from the University of California, Berkeley. Klami, Virtanen and Kaski (2013) developed a fully Bayesian treatment with ARD priors and variational inference, published in the Journal of Machine Learning Research. Their model is the reference point for the Bayesian CCA applications listed below.
When to use it
Use Bayesian CCA when you have two or more sets of continuous measurements on the same observations and want to estimate their shared structure with uncertainty. It is most useful when the number of variables is large relative to the sample size, where classical CCA can be unstable, and when the number of shared dimensions is unknown and you prefer the model to infer it. It also suits cases where the fitted latent model will be used to predict or impute one view from the other. Do not use it when you have a large, clean dataset and only need canonical correlations as descriptive statistics, because classical CCA answers that question with far less effort. It is a poor fit for categorical or strongly skewed variables unless the likelihood is extended, since the model as written is linear and Gaussian.
Limitations and considerations
- Variational inference or MCMC is substantially more expensive than the eigendecomposition used in classical CCA, which becomes a bottleneck for very large datasets.
- Results depend on prior choices, particularly the scale of the ARD hyperprior; a poorly chosen prior can over-shrink genuine shared dimensions.
- The linear Gaussian assumption may miss non-linear shared structure; non-linear Bayesian CCA extensions exist but are considerably more complex.
- Software support is less widespread than for classical CCA; specialist implementations are required (for example, the CCAGFA package or custom MCMC code).
- The latent space is identified only up to rotation, so individual canonical directions require post-processing before they can be given a conventional interpretation.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Automatic relevance determination infers the effective number of shared latent dimensions from the data, removing the need for a separate model-selection criterion.
- Bayesian regularisation can reduce overfitting in high-dimensional, small-sample settings where classical CCA is numerically unstable or over-parameterised.
- Full posterior inference yields uncertainty estimates on the latent scores and projections, supporting credible-interval reporting.
- The generative model allows prediction or imputation of one view from the other, which extends its use beyond exploratory analysis.
- The framework can in principle extend to more than two views, but the formulas on this page cover only two views; check the implementation before using more.
Applications
- Multi-omics data integration, discovering shared latent factors between gene expression and metabolomics profiles measured on the same subjects.
- Neuroimaging and behaviour research, linking brain connectivity matrices to cognitive or clinical scores while accounting for small sample sizes.
- Multi-view text and image analysis, finding shared semantic dimensions between document representations and visual features.
- Medical data fusion, combining clinical biomarkers with imaging features to identify patient subtypes.
- Psychometrics, relating two distinct test batteries administered to the same sample when the number of items is large relative to sample size.
How it works
How it works
The generative model assumes conditional independence: given the shared latent variable z, the two observed views x and y are independent. This factored likelihood is the formal statement that all cross-view dependence is carried by the latent space, so whatever correlation exists between x and y must pass through z.
Formula
p(\mathbf{x},\mathbf{y}\mid\mathbf{z}) = p(\mathbf{x}\mid\mathbf{z})\,p(\mathbf{y}\mid\mathbf{z})Each view is a noisy linear projection of the shared latent code z, with projection matrices W_x and W_y, a mean vector for each view, and view-specific Gaussian noise. The columns of the projection matrices are loosely analogous to canonical directions, but they are not the same objects. The dimensionality of z sets how many shared directions the model can represent.
Formula
\mathbf{x} = \mathbf{W}_x\mathbf{z}+\boldsymbol{\mu}_x+\boldsymbol{\varepsilon}_x,\quad \mathbf{y} = \mathbf{W}_y\mathbf{z}+\boldsymbol{\mu}_y+\boldsymbol{\varepsilon}_yThe displayed prior covers the latent code z (standard Gaussian) and the view-specific Gaussian noise terms with covariances Ψ_x and Ψ_y. The projection matrices need priors as well, and these are not shown in the formulas. In the Bayesian treatment of Klami et al. (2013), ARD priors are placed on the weight columns, with a separate precision hyperparameter for each latent dimension. A dimension the data do not support is shrunk toward zero, which selects the active dimensionality without a separate model-selection step. In practice, set the number of latent dimensions generously, as an upper bound, and let the ARD shrinkage remove unused ones. The structure of the noise covariances (for example diagonal versus full) changes what counts as shared structure, so check which form your implementation uses.
Formula
\mathbf{z}\sim\mathcal{N}(\mathbf{0},\mathbf{I}),\quad \boldsymbol{\varepsilon}_x\sim\mathcal{N}(\mathbf{0},\boldsymbol{\Psi}_x),\quad \boldsymbol{\varepsilon}_y\sim\mathcal{N}(\mathbf{0},\boldsymbol{\Psi}_y)The posterior has no closed form for the general model, so inference relies on variational Bayes or Markov chain Monte Carlo. Variational methods approximate the joint posterior over latent variables and parameters with a tractable factored distribution, fitted by maximising the evidence lower bound (ELBO). MCMC methods such as Gibbs sampling give samples from the posterior and are used when those samples are needed. For variational fits, monitor the change in the ELBO across iterations and stop when it levels off; for MCMC, inspect trace plots and standard convergence diagnostics.
Inference yields a posterior distribution over the latent scores z for each observation, posterior summaries of the projection matrices, and an estimate of how many latent dimensions are active, judged from the ARD hyperparameters: dimensions with very large precision (weights shrunk to near zero) are effectively pruned, while those with small precision are retained. Canonical-style correlations can be computed from the fitted projections, but because the latent space is identified only up to rotation, such quantities are only meaningful after a rotation has been fixed and should be checked against the posterior before interpretation. Predictive distributions for one view given the other follow by integrating over the latent posterior.
Common pitfalls
- Treating the posterior mean of the projection matrices as classical canonical vectors without checking whether the ARD hyperparameters confirm those dimensions are active.
- Running Bayesian CCA on unmatched or differently sized datasets; the method requires paired observations across views.
- Ignoring convergence diagnostics for variational or MCMC inference and reporting results from a poorly converged run.
- Using the method when one view is much higher-dimensional than the other without appropriate dimensionality reduction, which can overwhelm the shared latent space.
- Conflating shared latent dimensions with canonical correlations: the Bayesian latent dimensions correspond directly to classical CCA variates only if the model is parameterised accordingly.
Frequently asked questions
How does Bayesian CCA differ from classical canonical correlation analysis?
Classical CCA solves a generalised eigenvalue problem and returns point estimates of canonical directions and correlations. Bayesian CCA embeds the same question in a generative model with priors, returning posterior distributions over parameters, uncertainty on the directions, and an estimate of the number of shared dimensions via ARD. It is more robust when dimensionality is high relative to sample size.
Do I need to choose the number of latent dimensions in advance?
Not exactly. With ARD priors you set an upper bound on the number of dimensions and let the ARD mechanism shrink irrelevant ones toward zero. Dimensions whose ARD precision hyperparameter grows large during inference are effectively pruned, so the active dimensionality is determined by the data.
Can Bayesian CCA handle more than two views?
The framework can in principle be extended to K views by positing that each view is a noisy projection of the same shared latent code. The formulas on this page are written for the two-view case, so check how your specific model and software handle more than two views.
Which software implements Bayesian CCA?
The CCAGFA package is associated with Klami et al. Confirm its platform and current availability before relying on it. Custom implementations using variational or MCMC inference are the alternative.
When should I prefer classical CCA over Bayesian CCA?
When the sample size is large relative to the number of variables in both views, classical CCA is numerically stable and computationally inexpensive. In that setting the extra cost of longer run times, prior specification and convergence checking rarely pays off unless uncertainty quantification or prediction is explicitly needed.
Related methods
Sources
Bach, F. R. & Jordan, M. I. (2005). A probabilistic interpretation of canonical correlation analysis. Technical Report 688, Department of Statistics, University of California, Berkeley.
Open publication referenceKlami, A., Virtanen, S. & Kaski, S. (2013). Bayesian canonical correlation analysis. Journal of Machine Learning Research, 14, 965-1003.
Open publication reference