mxnet.gluon.probability.distributions.divergence¶
KL divergence functions.
Functions
|
Estimate KL(p||q) through monte-carlo estimation, i.e. approximate KL(p||q) with:. |
|
Return the kl divergence between p and q, this method will automatically dispatch to the corresponding function based on q's type. |
|
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:
p (Distribution)
q (Distribution)
n_samples (int, optional) – Number of monte-carlo samples, by default 1
- 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:
p (Distribution) – lhs distribution.
q (Distribution) – rhs distribution.
- Returns:
KL(p||q)
- Return type:
Tensor