- Introduced by
- Christopher M. Bishop
- Year
- 1999
- Type
- Bayesian latent variable / dimension reduction
- Family
- Multivariate analysis
What does it do?
Bayesian principal component analysis (BPCA) extends probabilistic PCA into a Bayesian framework by placing priors on the loading matrix, so that components with little support in the data are shrunk toward zero.
Because the model is likelihood-based, it can accommodate missing entries within the same fit, and it returns posterior uncertainty for the latent scores and loadings.
The intuition behind the method
Classical PCA requires the analyst to fix the number of components in advance and offers no internal criterion for deciding which components matter. In BPCA, each column of the loading matrix receives its own precision hyperparameter. When a component contributes little to the data, its estimated precision becomes large and its loadings are pushed toward zero, so the component is effectively switched off. This automatic relevance determination lets the data help determine the effective number of dimensions, although the result still depends on the hyperparameters, the initialisation, the modelling assumptions, the approximate inference, and a judgement about how large a precision must be before a component is treated as switched off.
History
Probabilistic PCA, in which PCA is cast as maximum-likelihood estimation in a latent variable model closely related to factor analysis, is due to Tipping and Bishop (1999). The Bayesian extension, which places priors on the model parameters and allows automatic selection of the latent dimensionality with approximate inference, was proposed by Bishop (1999) in the proceedings of NIPS 11 (the proceedings are also listed under the 1998 conference).
When to use it
Choose BPCA when you want the number of retained components to be determined by the fitting procedure rather than chosen by hand, when the continuous data contain missing entries that should be handled within a probabilistic model, or when you need posterior uncertainty for the latent scores, for example as input to a further Bayesian model. It is also a reasonable option when the number of variables is large relative to the number of observations, since the priors regularise the loadings. Do not choose BPCA when the main goal is to interpret components as named latent constructs; exploratory or confirmatory factor analysis is more suitable for that. Avoid it for categorical or ordinal variables that cannot be treated as approximately continuous, and for very large datasets where the cost of variational or MCMC inference becomes a practical constraint.
Limitations and considerations
- Variational inference is an approximation: mean-field factorisation tends to understate posterior variance, and results can depend on initialisation.
- Inference is considerably more expensive than classical PCA, and the cost grows with the number of candidate components.
- The Gaussian latent and noise assumptions may be violated by heavy-tailed, skewed or bounded variables, which affects both the fitted loadings and the pruning decision.
- The retained components are variance-maximising directions in the model; interpreting them as meaningful latent constructs requires substantive judgement, as with standard PCA.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Selects the effective number of components through automatic relevance determination, so the scree-plot or cross-validation decision is not needed.
- Handles missing continuous entries within the likelihood, without a separate imputation step before the analysis.
- Gives posterior uncertainty for the latent scores, which can be carried into downstream probabilistic models.
- Priors on the loading columns regularise the solution, which can help when samples are few relative to variables.
- The variational lower bound provides a monitorable quantity that approximates the marginal likelihood and can be used to compare fits.
Applications
- Dimension reduction of continuous data sets in which some entries are missing, where a likelihood-based fit avoids a separate imputation step.
- Selecting the number of components automatically in exploratory analyses where a fixed rank is hard to justify.
- Producing latent scores with posterior uncertainty for use as inputs to further Bayesian models.
- Compressing high-dimensional continuous measurements, such as spectra or multichannel signals, when the retained dimensions should be learned from the data.
How it works
How it works
Each observed vector x is modelled as a linear projection of a low-dimensional latent vector z, which has a standard normal prior, through the loading matrix W, plus a mean and an isotropic Gaussian noise term, ε ~ N(0, σ²I). Equivalently, p(x | z) = N(Wz + μ, σ²I). This is the probabilistic PCA model, which gives the method a likelihood that can be evaluated.
Formula
\mathbf{x} = \mathbf{W}\mathbf{z} + \boldsymbol{\mu} + \boldsymbol{\varepsilon}, \quad \mathbf{z} \sim \mathcal{N}(\mathbf{0}, \mathbf{I}), \quad \boldsymbol{\varepsilon} \sim \mathcal{N}(\mathbf{0}, \sigma^2\mathbf{I})Each column w_i of the loading matrix receives its own zero-mean Gaussian prior with precision alpha_i. A large alpha_i shrinks the corresponding column toward zero. Because the data inform the values of the alpha_i, components that do not explain variation in the data can be driven toward zero loadings. In the full Bayesian treatment, a prior is also placed on the remaining parameters (the mean and the noise variance), so that they can be integrated out rather than fixed at point estimates.
Formula
p(\mathbf{W}) = \prod_{i=1}^{q} \mathcal{N}(\mathbf{w}_i \mid \mathbf{0}, \alpha_i^{-1} \mathbf{I})Each precision alpha_i has a Gamma hyperprior with shape a_0 and rate b_0. Small values of these hyperparameters make the hyperprior weakly informative, so the data have most of the influence on which components are retained. The resulting effective rank can nevertheless depend on the choice of a_0 and b_0.
Formula
p(\alpha_i) = \mathrm{Gamma}(\alpha_i \mid a_0, b_0)Integrating out the parameters is analytically intractable, so the posterior over the loadings, latent scores, precisions and other parameters is approximated. Bishop (1999) proposes approximate inference such as MCMC or variational inference. Variational Bayes with a mean-field factorisation alternates updates of the approximate posteriors until convergence and yields a lower bound on the marginal likelihood. Mean-field approximations tend to understate posterior variance, and the solution can depend on initialisation.
After convergence, components whose precision alpha_i has become very large are treated as switched off, and the effective number of components is read from the remaining ones. No universal cut-off defines how large a precision must be, so this is a judgement that should be checked across random restarts and hyperparameter settings. This replaces the separate choice of dimensionality by cross-validation or a scree-plot judgement that is needed in standard PCA and probabilistic PCA.
Common pitfalls
- Accepting the automatically selected number of components without checking whether it is stable across different random starts or initialisations.
- Applying the Gaussian model to strongly non-Gaussian data, such as bounded proportions or counts, where the fitted components and the pruning may be misleading.
- Reading the loadings as factor loadings for construct validation. The model captures variance structure and does not separate common from unique variance in the way that exploratory factor analysis does.
- Failing to standardise variables measured on very different scales, which changes the covariance structure that the model is fitted to.
Frequently asked questions
How is BPCA different from standard probabilistic PCA?
Probabilistic PCA (Tipping & Bishop 1999) is a maximum-likelihood model that still requires the analyst to fix the number of components. BPCA places priors on the loading columns so that components with little support in the data are shrunk toward zero during approximate inference, which makes dimensionality selection part of the fitting procedure rather than a separate step.
How does BPCA handle missing data?
Because BPCA defines an explicit generative model with a likelihood, missing values are treated as unobserved quantities and integrated out during inference. The posterior over the latent scores is computed from the observed dimensions of each data point, and missing entries can be imputed from the posterior predictive distribution.
Does BPCA replace exploratory factor analysis?
No. BPCA is a variance-based dimension-reduction model and is suited to compression and missing-data handling. It uses a single shared isotropic noise variance σ² rather than a separate unique variance for each variable, whereas exploratory factor analysis explicitly models unique variance and is the usual tool for construct discovery and scale development. Choose EFA when the goal is measuring latent constructs, and BPCA when the goal is data compression with automatic component selection.
What software implements BPCA?
General probabilistic programming tools such as Stan and PyMC can be used to write a custom Bayesian PCA model with MCMC or variational inference. Check the documentation of any specific package for the exact model and inference scheme it implements before relying on it.
How many candidate components should I specify at the start?
A common practice is to set the maximum number of candidate components to a value larger than expected, such as the number of variables, and let automatic relevance determination prune the excess. The final effective rank is determined by which component precisions converge to large values, not by the initial upper bound. Check that it is stable across restarts.
Related methods
Sources
Bishop, C. M. (1999). Bayesian PCA. In M. S. Kearns, S. A. Solla & D. A. Cohn (Eds.), Advances in Neural Information Processing Systems 11 (pp. 382–388). MIT Press.
Open publication referenceTipping, M. E. & Bishop, C. M. (1999). Probabilistic principal component analysis. Journal of the Royal Statistical Society: Series B, 61(3), 611–622.
Open DOI reference