Bayesian Discriminant Analysis

Statistics
Introduced by
Seymour Geisser
Year
1964
Type
Supervised classification / Bayesian inference
Family
Multivariate analysis

What does it do?

Bayesian discriminant analysis assigns observations to predefined groups using a multivariate Gaussian likelihood for each class and prior distributions over the class parameters.

Instead of fixed decision boundaries built from point estimates, it classifies with posterior predictive probabilities, which carry the uncertainty in the estimated class means and covariances into the class probabilities. This matters most when training samples are small relative to the number of predictors.

The intuition behind the method

Classical discriminant analysis estimates each group's mean and covariance from the training data and draws a boundary where the group likelihoods are equal. When samples are small or variables are many, these estimates are noisy and the boundary can be poorly placed. Bayesian discriminant analysis treats the group parameters as uncertain, places priors over them, and updates those priors with the training data. Classification then averages the class likelihood over all parameter values the data leave plausible, so a new observation in a region the training data constrain weakly receives less extreme class probabilities than a plug-in estimate would give.

History

The originating reference for this entry is Geisser (1964), 'Posterior odds for multivariate normal classifications', which treats classification into multivariate normal groups in terms of posterior odds.

When to use it

Use Bayesian discriminant analysis when you need class membership probabilities that reflect parameter uncertainty, when the training sample per class is small relative to the number of predictors so that classical LDA or QDA estimates become unstable, or when you want to enter prior knowledge about class locations and spreads explicitly. It is also a reasonable choice when the probabilities themselves will feed a downstream decision. Do not use it when class boundaries are strongly non-linear or the predictors are clearly non-Gaussian within class; kernel or tree-based classifiers are better suited to such data. When samples are large, classical LDA is usually accurate and much cheaper to fit, so the Bayesian machinery adds little.

Limitations and considerations

  • The model assumes multivariate normality within each class; skewed, bounded or categorical predictors violate the likelihood and can distort the posterior predictive.
  • The influence of the prior grows as the per-class sample shrinks. A misspecified prior can dominate the posterior and shift the class boundaries.
  • The linear variant assumes a shared covariance across classes. If this is violated, the quadratic variant is needed, which estimates a separate covariance per class and therefore requires more data per class.
  • Interpreting the prior hyperparameters and the posterior predictive requires statistical background that applied teams may not have.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Predictions are posterior predictive probabilities, so the uncertainty in the estimated class means and covariances widens the class probabilities where the training data constrain the parameters weakly.
  • With a conjugate Normal-Inverse-Wishart prior the posterior and the posterior predictive have closed forms (a multivariate t distribution for each class, as noted in the FAQ), so no sampler is needed in this setting.
  • The prior shrinks class estimates toward a stated baseline, which stabilises them when the number of training observations per class is small relative to the number of predictors; whether it improves accuracy over classical LDA on a given dataset is an empirical question.
  • Prior knowledge about class locations and spreads can be entered explicitly through the hyperparameters.

Applications

  • Classification of multivariate measurements into predefined groups when small training samples make classical LDA or QDA estimates unstable and within-group normality is plausible.
  • Settings where the class probabilities are used directly in a downstream decision, provided their calibration has been checked on held-out data.
  • Problems where prior knowledge about group locations or spreads is available and should be entered explicitly. Check that within-class normality holds in the application domain before use.

How it works

How it works

1

A Normal-Inverse-Wishart prior is placed over the mean vector and covariance matrix of each class in the quadratic (class-specific covariance) setting. Its hyperparameters encode prior beliefs about the location and spread of each class and pull the estimates toward that baseline, with the strength of the pull set by the hyperparameters rather than by a separate regularization term. In the linear variant all classes share one covariance matrix, so the class-specific prior is replaced by a prior on each class mean together with a single prior on the shared covariance matrix.

Formula
p(\boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k) \propto \text{Normal-Inverse-Wishart}
2

Each class k is modelled as a multivariate normal distribution with its own mean vector. In the quadratic variant each class also has its own covariance matrix. The linear variant instead constrains all classes to a single shared covariance matrix (homoscedasticity), so every class likelihood uses the same covariance. A new observation is scored under each class using these distributional parameters.

Formula
p(\mathbf{x} \mid \boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k) = \mathcal{N}(\mathbf{x}; \boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k)
3

Bayes' theorem combines the prior with the training observations of each class. In the per-class setting the Normal-Inverse-Wishart prior is conjugate to the multivariate normal likelihood, so the posterior has the same parametric form and can be computed in closed form without Markov chain Monte Carlo sampling.

Formula
p(\boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k \mid \mathbf{X}) \propto p(\mathbf{X} \mid \boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k)\, p(\boldsymbol{\mu}_k, \boldsymbol{\Sigma}_k)
4

Each class is scored by its posterior predictive density for the new observation, which integrates the class likelihood over the posterior distribution of that class's parameters. In the conjugate Normal-Inverse-Wishart setting this density is a multivariate t distribution whose location, scale and degrees of freedom are determined by the updated hyperparameters and the class sample statistics. The mechanics formula multiplies this density by the prior class probability π_k. Averaging over parameter values, rather than plugging in point estimates, widens the predictive distribution where the posterior is diffuse.

Formula
p(y=k \mid \mathbf{x}) \propto \pi_k \int p(\mathbf{x} \mid \boldsymbol{\theta}_k)\, p(\boldsymbol{\theta}_k \mid \mathbf{X})\, d\boldsymbol{\theta}_k
5

The predicted class is the one with the highest posterior predictive score, which includes the class prior π_k. Under the assumed model this rule minimises expected zero-one loss. The class priors are often set from the class frequencies in the training data or from a stated prior belief. Unequal class priors shift the decision boundary toward the less frequent class, so the choice should be stated and justified. The per-class probabilities can be reported alongside the label and are only as well calibrated as the model's assumptions allow, so check calibration on held-out data before using them as thresholds.

Formula
\hat{y} = \arg\max_k\, p(y=k \mid \mathbf{x})

Common pitfalls

  • Using a flat (improper) prior without checking that the posterior is proper; with very few observations per class the posterior can be ill-defined.
  • Reading the posterior predictive probability as a frequentist p-value. These probabilities express belief under the fitted model and are not Type-I error rates.
  • Confusing Bayesian discriminant analysis with naive Bayes. Naive Bayes assumes features are independent within class, whereas this method keeps the full within-class covariance structure.
  • Choosing hyperparameters by maximising accuracy on the training set, which removes the regularizing effect of the prior. Use cross-validation or the marginal likelihood instead.
  • Ignoring strong collinearity among predictors. Nearly singular within-class covariance makes the posterior depend heavily on the prior in some directions, which makes the class boundaries unstable.

Frequently asked questions

How does Bayesian discriminant analysis differ from classical LDA?

Classical LDA estimates the class means and the pooled covariance by maximum likelihood and then draws a linear boundary. Bayesian discriminant analysis places a prior over those parameters and classifies with the posterior predictive probability, which averages over parameter uncertainty. The result is probabilities that reflect that uncertainty and boundaries that are typically more stable when sample sizes are small.

Do I need MCMC to implement Bayesian discriminant analysis?

Not in the standard Normal-Inverse-Wishart conjugate setting. The conjugate prior yields a closed-form posterior and a closed-form posterior predictive (a multivariate t distribution for each class), so MCMC is unnecessary. MCMC becomes necessary when non-conjugate priors or non-Gaussian likelihoods are used.

How do I choose the prior hyperparameters?

The Normal-Inverse-Wishart prior has four hyperparameters: a prior mean for the class location, a prior sample size that sets how strongly the prior weighs against the data, prior degrees of freedom, and a scale matrix for the covariance. The prior must be a proper distribution, because an improper prior can leave the posterior ill-defined when few observations are available. Default values depend on the software used and should be checked against its documentation. When genuine domain knowledge exists, for example published class means from earlier studies, it can be encoded in the hyperparameters. Run a sensitivity analysis across a range of hyperparameter values, and do not tune the hyperparameters to training accuracy.

What is the difference between the linear and quadratic Bayesian variants?

The linear variant (Bayesian LDA) assumes all classes share one covariance matrix, estimated from pooled data. The quadratic variant (Bayesian QDA) lets each class have its own covariance. QDA estimates more parameters and needs more observations per class. In the Bayesian setting the class-specific prior covariances provide regularization, but QDA is still preferable mainly when the shared-covariance assumption is clearly violated.

Can Bayesian discriminant analysis handle more than two classes?

Yes. The posterior predictive approach extends to K > 2 classes: a separate posterior is computed for each class, and the predicted class is the one with the highest posterior predictive density multiplied by the prior class probability. No binary decomposition is needed.

Related methods

Sources

  1. Geisser, S. (1964). Posterior odds for multivariate normal classifications. Journal of the Royal Statistical Society, Series B, 26(1), 69–76.

    Open publication reference
  2. Minka, T. P. (2000). Bayesian linear regression. Technical Report, MIT Media Lab.

    Open publication reference