Maximum a posteriori estimation

From HandWiki
Short description: Method of estimating the parameters of a statistical model

In Bayesian statistics, a maximum a posteriori probability (MAP) estimate is an estimate of an unknown quantity, that equals the mode of the posterior distribution. The MAP can be used to obtain a point estimate of an unobserved quantity on the basis of empirical data. It is closely related to the method of maximum likelihood (ML) estimation, but employs an augmented optimization objective which incorporates a prior distribution (that quantifies the additional information available through prior knowledge of a related event) over the quantity one wants to estimate. MAP estimation can therefore be seen as a regularization of maximum likelihood estimation.

Description

Assume that we want to estimate an unobserved population parameter [math]\displaystyle{ \theta }[/math] on the basis of observations [math]\displaystyle{ x }[/math]. Let [math]\displaystyle{ f }[/math] be the sampling distribution of [math]\displaystyle{ x }[/math], so that [math]\displaystyle{ f(x\mid\theta) }[/math] is the probability of [math]\displaystyle{ x }[/math] when the underlying population parameter is [math]\displaystyle{ \theta }[/math]. Then the function:

[math]\displaystyle{ \theta \mapsto f(x \mid \theta) \! }[/math]

is known as the likelihood function and the estimate:

[math]\displaystyle{ \hat{\theta}_{\mathrm{MLE}}(x) = \underset{\theta}{\operatorname{arg\,max}} \ f(x \mid \theta) \! }[/math]

is the maximum likelihood estimate of [math]\displaystyle{ \theta }[/math].

Now assume that a prior distribution [math]\displaystyle{ g }[/math] over [math]\displaystyle{ \theta }[/math] exists. This allows us to treat [math]\displaystyle{ \theta }[/math] as a random variable as in Bayesian statistics. We can calculate the posterior distribution of [math]\displaystyle{ \theta }[/math] using Bayes' theorem:

[math]\displaystyle{ \theta \mapsto f(\theta \mid x) = \frac{f(x \mid \theta) \, g(\theta)}{\displaystyle\int_{\Theta} f(x \mid \vartheta) \, g(\vartheta) \, d\vartheta} \! }[/math]

where [math]\displaystyle{ g }[/math] is density function of [math]\displaystyle{ \theta }[/math], [math]\displaystyle{ \Theta }[/math] is the domain of [math]\displaystyle{ g }[/math].

The method of maximum a posteriori estimation then estimates [math]\displaystyle{ \theta }[/math] as the mode of the posterior distribution of this random variable:

[math]\displaystyle{ \begin{align} \hat{\theta}_{\mathrm{MAP}}(x) & = \underset{\theta}{\operatorname{arg\,max}} \ f(\theta \mid x) \\ & = \underset{\theta}{\operatorname{arg\,max}} \ \frac{f(x \mid \theta) \, g(\theta)} {\displaystyle\int_{\Theta} f(x \mid \vartheta) \, g(\vartheta) \, d\vartheta} \\ & = \underset{\theta}{\operatorname{arg\,max}} \ f(x \mid \theta) \, g(\theta). \end{align} \! }[/math]

The denominator of the posterior distribution (so-called marginal likelihood) is always positive and does not depend on [math]\displaystyle{ \theta }[/math] and therefore plays no role in the optimization. Observe that the MAP estimate of [math]\displaystyle{ \theta }[/math] coincides with the ML estimate when the prior [math]\displaystyle{ g }[/math] is uniform (i.e., [math]\displaystyle{ g }[/math] is a constant function).

When the loss function is of the form

[math]\displaystyle{ L(\theta, a) = \begin{cases} 0, & \text{if } |a-\theta|\lt c, \\ 1, & \text{otherwise}, \\ \end{cases} }[/math]

as [math]\displaystyle{ c }[/math] goes to 0, the Bayes estimator approaches the MAP estimator, provided that the distribution of [math]\displaystyle{ \theta }[/math] is quasi-concave.[1] But generally a MAP estimator is not a Bayes estimator unless [math]\displaystyle{ \theta }[/math] is discrete.

Computation

MAP estimates can be computed in several ways:

  1. Analytically, when the mode(s) of the posterior distribution can be given in closed form. This is the case when conjugate priors are used.
  2. Via numerical optimization such as the conjugate gradient method or Newton's method. This usually requires first or second derivatives, which have to be evaluated analytically or numerically.
  3. Via a modification of an expectation-maximization algorithm. This does not require derivatives of the posterior density.
  4. Via a Monte Carlo method using simulated annealing

Limitations

While only mild conditions are required for MAP estimation to be a limiting case of Bayes estimation (under the 0–1 loss function),[1] it is not very representative of Bayesian methods in general. This is because MAP estimates are point estimates, whereas Bayesian methods are characterized by the use of distributions to summarize data and draw inferences: thus, Bayesian methods tend to report the posterior mean or median instead, together with credible intervals. This is both because these estimators are optimal under squared-error and linear-error loss respectively—which are more representative of typical loss functions—and for a continuous posterior distribution there is no loss function which suggests the MAP is the optimal point estimator. In addition, the posterior distribution may often not have a simple analytic form: in this case, the distribution can be simulated using Markov chain Monte Carlo techniques, while optimization to find its mode(s) may be difficult or impossible.[citation needed]

An example of a density of a bimodal distribution in which the highest mode is uncharacteristic of the majority of the distribution

In many types of models, such as mixture models, the posterior may be multi-modal. In such a case, the usual recommendation is that one should choose the highest mode: this is not always feasible (global optimization is a difficult problem), nor in some cases even possible (such as when identifiability issues arise). Furthermore, the highest mode may be uncharacteristic of the majority of the posterior.

Finally, unlike ML estimators, the MAP estimate is not invariant under reparameterization. Switching from one parameterization to another involves introducing a Jacobian that impacts on the location of the maximum.[2]

As an example of the difference between Bayes estimators mentioned above (mean and median estimators) and using a MAP estimate, consider the case where there is a need to classify inputs [math]\displaystyle{ x }[/math] as either positive or negative (for example, loans as risky or safe). Suppose there are just three possible hypotheses about the correct method of classification [math]\displaystyle{ h_1 }[/math], [math]\displaystyle{ h_2 }[/math] and [math]\displaystyle{ h_3 }[/math] with posteriors 0.4, 0.3 and 0.3 respectively. Suppose given a new instance, [math]\displaystyle{ x }[/math], [math]\displaystyle{ h_1 }[/math] classifies it as positive, whereas the other two classify it as negative. Using the MAP estimate for the correct classifier [math]\displaystyle{ h_1 }[/math], [math]\displaystyle{ x }[/math] is classified as positive, whereas the Bayes estimators would average over all hypotheses and classify [math]\displaystyle{ x }[/math] as negative.

Example

Suppose that we are given a sequence [math]\displaystyle{ (x_1, \dots, x_n) }[/math] of IID [math]\displaystyle{ N(\mu,\sigma_v^2 ) }[/math] random variables and a prior distribution of [math]\displaystyle{ \mu }[/math] is given by [math]\displaystyle{ N(\mu_0,\sigma_m^2 ) }[/math]. We wish to find the MAP estimate of [math]\displaystyle{ \mu }[/math]. Note that the normal distribution is its own conjugate prior, so we will be able to find a closed-form solution analytically.

The function to be maximized is then given by

[math]\displaystyle{ f(\mu) f(x \mid \mu)=\pi(\mu) L(\mu) = \frac{1}{\sqrt{2 \pi} \sigma_m} \exp\left(-\frac{1}{2} \left(\frac{\mu-\mu_0}{\sigma_m}\right)^2\right) \prod_{j=1}^n \frac{1}{\sqrt{2 \pi} \sigma_v} \exp\left(-\frac{1}{2} \left(\frac{x_j - \mu}{\sigma_v}\right)^2\right), }[/math]

which is equivalent to minimizing the following function of [math]\displaystyle{ \mu }[/math]:

[math]\displaystyle{ \sum_{j=1}^n \left(\frac{x_j - \mu}{\sigma_v}\right)^2 + \left(\frac{\mu-\mu_0}{\sigma_m}\right)^2. }[/math]

Thus, we see that the MAP estimator for μ is given by

[math]\displaystyle{ \hat{\mu}_\mathrm{MAP} = \frac{\sigma_m^2\,n}{\sigma_m^2 \,n+ \sigma_v^2 } \left(\frac{1}{n} \sum_{j=1}^n x_j \right) + \frac{\sigma_v^2}{\sigma_m^2 \,n+ \sigma_v^2 } \,\mu_0 =\frac{\sigma_m^2\left(\sum_{j=1}^n x_j\right) + \sigma_v^2 \,\mu_0}{\sigma_m^2\,n + \sigma_v^2 }. }[/math]

which turns out to be a linear interpolation between the prior mean and the sample mean weighted by their respective covariances.

The case of [math]\displaystyle{ \sigma_m \to \infty }[/math] is called a non-informative prior and leads to an ill-defined a priori probability distribution; in this case [math]\displaystyle{ \hat{\mu}_\mathrm{MAP} \to \hat{\mu}_\mathrm{MLE}. }[/math]

References

  1. 1.0 1.1 Bassett, Robert; Deride, Julio (2018-01-30). "Maximum a posteriori estimators as a limit of Bayes estimators" (in en). Mathematical Programming: 1–16. doi:10.1007/s10107-018-1241-0. ISSN 0025-5610. 
  2. Murphy, Kevin P. (2012). Machine learning : a probabilistic perspective. Cambridge, Massachusetts: MIT Press. pp. 151–152. ISBN 978-0-262-01802-9. 
  • DeGroot, M. (1970). Optimal Statistical Decisions. McGraw-Hill. ISBN 0-07-016242-5. 
  • Sorenson, Harold W. (1980). Parameter Estimation: Principles and Problems. Marcel Dekker. ISBN 0-8247-6987-2. 
  • Hald, Anders (2007). "Gauss's Derivation of the Normal Distribution and the Method of Least Squares, 1809". A History of Parametric Statistical Inference from Bernoulli to Fisher, 1713–1935. New York: Springer. pp. 55–61. ISBN 978-0-387-46409-1.