The current implementation needs to call klXYZ for each of the distribution XYZ. It will be great if you can provide a common interface to call KL divergence and dispatch depending on the type of the argument you get.
Ex:
using Distributions
# Example
KL( X1::Distributions.Bernoulli, X2::Distributions.Bernoulli ) = klBern( X1.p, X2.p )
KL( X1::Distributions.Exponential, X2::Distributions.Exponential ) = klExp( X1.ฮธ, X2.ฮธ )
# Use case
X = Bernoulli(0.33)
Y = Bernoulli(0.42)
d1 = KL( X, Y ) # Calc KL divergence for Bernoullli R.V
X = Exponential( 0.33 )
Y = Exponential( 0.42 )
d2 = KL( X, Y) # Calc KL div for Exponential R.V
I think this way, the users don't have to remember all the klXYZ function.