Generalized Kullback–Leibler divergence (source code)

= Generalized Kullback–Leibler divergence
{title2=$D(x,y)=\int[x\log(x/y)-x+y]$}

For nonnegative densities of possibly different total masses, this divergence includes the mass correction $-x+y$ as well as the logarithmic term. It is the <Bregman distance> of the <maximum-entropy regularization functional> at a positive reference $y$. Convexity of $s\log s-s$ proves nonnegativity. For equal masses the correction integrates to zero, recovering the <Kullback-Leibler divergence>; for <probability density functions> both masses are one. Use the usual extended-value conventions at zero reference density.