klGauss#

statrl.settings.utils.klGauss(x, y, sig2=1.0)[source]#

Kullback-Leibler divergence between two Gaussians of equal variance.

\[\mathrm{kl}(x, y) = \frac{(x - y)^2}{2\sigma^2}\]
Parameters:
  • x (float) – Means of the two distributions.

  • y (float) – Means of the two distributions.

  • sig2 (float, default=1.0) – Common variance \(\sigma^2\).

Returns:

The divergence, in nats.

Return type:

float

See also

klBern, klPoisson, klExp

Examples

>>> klGauss(0.0, 1.0)
0.5