mxnet.gluon.probability.distributions.divergence

KL divergence functions.

Functions

empirical_kl(p, q[, n_samples])

Estimate KL(p||q) through monte-carlo estimation, i.e. approximate KL(p||q) with:.

kl_divergence(p, q)

Return the kl divergence between p and q, this method will automatically dispatch to the corresponding function based on q's type.

register_kl(typeP, typeQ)

Decorator for registering custom implementation of kl divergence between distribution typeP and typeQ

mxnet.gluon.probability.distributions.divergence.empirical_kl(p, q, n_samples=1)[source]

Estimate KL(p||q) through monte-carlo estimation, i.e. approximate KL(p||q) with:

1/M * Sum_{i=1}^{M} log(p(x_i) / q(x_i)), x_i ~ p(x)

Parameters:
mxnet.gluon.probability.distributions.divergence.kl_divergence(p, q)[source]

Return the kl divergence between p and q, this method will automatically dispatch to the corresponding function based on q’s type.

Parameters:
Returns:

KL(p||q)

Return type:

Tensor

mxnet.gluon.probability.distributions.divergence.register_kl(typeP, typeQ)[source]

Decorator for registering custom implementation of kl divergence between distribution typeP and typeQ

Returns ——- function