The real function fun x ↦ x * log x + 1 - x
#
We define klFun x = x * log x + 1 - x
. That function is notable because the Kullback-Leibler
divergence is an f-divergence for klFun
. That is, the Kullback-Leibler divergence is an integral
of klFun
composed with a Radon-Nikodym derivative.
For probability measures, any function f
that differs from klFun
by an affine function of the
form x ↦ a * (x - 1)
would give the same value for the integral
∫ x, f (μ.rnDeriv ν x).toReal ∂ν
.
However, klFun
is the particular choice among those that satisfies klFun 1 = 0
and
deriv klFun 1 = 0
, which ensures that desirable properties of the Kullback-Leibler divergence
extend to other finite measures: it is nonnegative and zero iff the two measures are equal.
Main definitions #
klFun
: the functionfun x : ℝ ↦ x * log x + 1 - x
.
This is a continuous nonnegative, strictly convex function on [0,∞), with minimum value 0 at 1.
Main statements #
integrable_klFun_rnDeriv_iff
: For two finite measuresμ ≪ ν
, the functionx ↦ klFun (μ.rnDeriv ν x).toReal
is integrable with respect toν
iff the log-likelihood ratiollr μ ν
is integrable with respect toμ
.integral_klFun_rnDeriv
: For two finite measuresμ ≪ ν
such thatllr μ ν
is integrable with respect toμ
,∫ x, klFun (μ.rnDeriv ν x).toReal ∂ν = ∫ x, llr μ ν x ∂μ + (ν univ).toReal - (μ univ).toReal
.
The function x : ℝ ↦ x * log x + 1 - x
.
The Kullback-Leibler divergence is an f-divergence for this function.
Instances For
klFun
is strictly convex on [0,∞).
klFun
is convex on (0,∞).
This is an often useful consequence of convexOn_klFun
, which states convexity on [0, ∞).
klFun
is strongly measurable.
The derivative of klFun
at x ≠ 0
is log x
.
The right derivative of klFun
is log x
. This also holds at x = 0
although klFun
is not
differentiable there since the default value of derivWithin
in that case is 0.
The left derivative of klFun
is log x
. This also holds at x = 0
although klFun
is not
differentiable there since the default value of derivWithin
in that case is 0.
For two finite measures μ ≪ ν
, the function x ↦ klFun (μ.rnDeriv ν x).toReal
is integrable
with respect to ν
iff llr μ ν
is integrable with respect to μ
.