JuliaStats/Distributions.jl — pull request #152 by lindahua (2013-09-23 03:18:26+00:00)
Title: Refactoring of Conjugate-prior

The changes are motivated by the key observation that construction of the full-fledged posterior distribution is often unnecessary when your goal is doing MAP estimation of sampling from the posterior.

For conjugate exponential family distributions, we usually computes the canonical parameters (i.e. natural parameters) of the posterior, then depending on the task, we can:
- construct the posterior by converting canonical parameterization to conventional parameterization (e.g. for multivariate normal distribution, the canonical parameters are potential vector & precision matrix, while the typical representation uses mean and covariance)
- computing the mode (usually more efficient to directly compute from the canonical form)
- sampling from the posterior (sometimes construction of the posterior is not necessary)

In this PR, we require to implement the construction of the canonical form for each conjugate-pair, as well as several methods respectively to convert the canonical form to full-fledged posterior, compute the mode, and perform sampling.

The fallback methods that rely on canonical form instead of the full posterior is in many cases the most efficient way to accomplish the task. Therefore, we don't have to provide lots of specialized methods.