klExp#

statrl.settings.utils.klExp(x, y)[source]#

Kullback-Leibler divergence between two exponential distributions.

\[\mathrm{kl}(x, y) = \frac{x}{y} - 1 - \log\frac{x}{y}\]
Parameters:
  • x (float) – Means of the two distributions, clipped below at eps = 1e-15.

  • y (float) – Means of the two distributions, clipped below at eps = 1e-15.

Returns:

The divergence, in nats.

Return type:

float

See also

klBern, klGauss, klPoisson

Examples

>>> round(klExp(1.0, 1.0), 12)
0.0