(For more details see this PR)
Compute KL Divergences using Distributions.jl objects either analytically (PR are welcome to enrich the library) or via Monte Carlo sampling.
There is only one function exported : KL
which takes two arguments p
and q
for an analytical formulation and an additional argument n_samples
for the sampling based approach.
The list of the pair of distributions supported analytically is given here
p | q |
---|---|
Normal | Normal |
Poisson | Poisson |
Exponential | Exponential |
Gamma | Gamma |
InverseGamma | InverseGamma |
Beta | Beta |
p | q |
---|---|
MvNormal | MvNormal |
AbstractMvNormal* | AbstractMvNormal* |
* Note that the generic approach is not optimized but only requires you to define mean(p)
and cov(p)
on your distribution