In probability theory, an f {\displaystyle f} -divergence is a certain type of function D f ( P ‖ Q ) {\displaystyle D_{f}(P\|Q)} that measures the difference between two probability distributions P {\displaystyle P} and Q {\displaystyle Q} . Many common divergences, such as KL-divergence, Hellinger distance, and total variation distance, are special cases of f {\displaystyle f} -divergence.
These divergences were introduced by Alfréd Rényi[1] in the same paper where he introduced the well-known Rényi entropy. He proved that these divergences decrease in Markov processes. f-divergences were studied further independently by Csiszár (1963), Morimoto (1963) and Ali & Silvey (1966) and are sometimes known as Csiszár f {\displaystyle f} -divergences, Csiszár–Morimoto divergences, or Ali–Silvey distances.
Let P {\displaystyle P} and Q {\displaystyle Q} be two probability distributions over a space Ω {\displaystyle \Omega } , such that P ≪ Q {\displaystyle P\ll Q} , that is, P {\displaystyle P} is absolutely continuous with respect to Q {\displaystyle Q} (meaning Q > 0 {\displaystyle Q>0} wherever P > 0 {\displaystyle P>0} ). Then, for a convex function f : [ 0 , + ∞ ) → ( − ∞ , + ∞ ] {\displaystyle f:[0,+\infty )\to (-\infty ,+\infty ]} such that f ( x ) {\displaystyle f(x)} is finite for all x > 0 {\displaystyle x>0} , f ( 1 ) = 0 {\displaystyle f(1)=0} , and f ( 0 ) = lim t → 0 + f ( t ) {\displaystyle f(0)=\lim _{t\to 0^{+}}f(t)} (which could be infinite), the f {\displaystyle f} -divergence of P {\displaystyle P} from Q {\displaystyle Q} is defined as
We call f {\displaystyle f} the generator of D f {\displaystyle D_{f}} .
In concrete applications, there is usually a reference distribution μ {\displaystyle \mu } on Ω {\displaystyle \Omega } (for example, when Ω = R n {\displaystyle \Omega =\mathbb {R} ^{n}} , the reference distribution is the Lebesgue measure), such that P , Q ≪ μ {\displaystyle P,Q\ll \mu } , then we can use Radon–Nikodym theorem to take their probability densities p {\displaystyle p} and q {\displaystyle q} , giving
When there is no such reference distribution ready at hand, we can simply define μ = P + Q {\displaystyle \mu =P+Q} , and proceed as above. This is a useful technique in more abstract proofs.
The above definition can be extended to cases where P ≪ Q {\displaystyle P\ll Q} is no longer satisfied (Definition 7.1 of [2]).
Since f {\displaystyle f} is convex, and f ( 1 ) = 0 {\displaystyle f(1)=0} , the function f ( x ) x − 1 {\displaystyle {\frac {f(x)}{x-1}}} must be nondecreasing, so there exists f ′ ( ∞ ) := lim x → ∞ f ( x ) / x {\displaystyle f'(\infty ):=\lim _{x\to \infty }f(x)/x} , taking value in ( − ∞ , + ∞ ] {\displaystyle (-\infty ,+\infty ]} .
Since for any p ( x ) > 0 {\displaystyle p(x)>0} , we have lim q ( x ) → 0 q ( x ) f ( p ( x ) q ( x ) ) = p ( x ) f ′ ( ∞ ) {\displaystyle \lim _{q(x)\to 0}q(x)f\left({\frac {p(x)}{q(x)}}\right)=p(x)f'(\infty )} , we can extend f-divergence to the P ≪̸ Q {\displaystyle P\not \ll Q} .
If f ( x ) = g ( x ) + c ( x − 1 ) {\displaystyle f(x)=g(x)+c(x-1)} , then D f = D g {\displaystyle D_{f}=D_{g}} by definition.
Conversely, if D f − D g = 0 {\displaystyle D_{f}-D_{g}=0} , then let h = f − g {\displaystyle h=f-g} . For any two probability measures P , Q {\displaystyle P,Q} on the set { 0 , 1 } {\displaystyle \{0,1\}} , since D f ( P ‖ Q ) − D g ( P ‖ Q ) = 0 {\displaystyle D_{f}(P\|Q)-D_{g}(P\|Q)=0} , we get h ( P 1 / Q 1 ) = − Q 0 Q 1 h ( P 0 / Q 0 ) {\displaystyle h(P_{1}/Q_{1})=-{\frac {Q_{0}}{Q_{1}}}h(P_{0}/Q_{0})}
Since each probability measure P , Q {\displaystyle P,Q} has one degree of freedom, we can solve P 0 Q 0 = a , P 1 Q 1 = x {\displaystyle {\frac {P_{0}}{Q_{0}}}=a,{\frac {P_{1}}{Q_{1}}}=x} for every choice of 0 < a < 1 < x {\displaystyle 0<a<1<x} .
Linear algebra yields Q 0 = x − 1 x − a , Q 1 = 1 − a x − a {\displaystyle Q_{0}={\frac {x-1}{x-a}},Q_{1}={\frac {1-a}{x-a}}} , which is a valid probability measure. Then we obtain h ( x ) = h ( a ) a − 1 ( x − 1 ) , h ( a ) = h ( x ) x − 1 ( a − 1 ) {\displaystyle h(x)={\frac {h(a)}{a-1}}(x-1),h(a)={\frac {h(x)}{x-1}}(a-1)} .
Thus h ( x ) = { c 1 ( x − 1 ) if x > 1 , c 0 ( x − 1 ) if 0 < x < 1 , {\displaystyle h(x)={\begin{cases}c_{1}(x-1)\quad {\text{if }}x>1,\\c_{0}(x-1)\quad {\text{if }}0<x<1,\\\end{cases}}} for some constants c 0 , c 1 {\displaystyle c_{0},c_{1}} . Plugging the formula into h ( x ) = h ( a ) a − 1 ( x − 1 ) {\displaystyle h(x)={\frac {h(a)}{a-1}}(x-1)} yields c 0 = c 1 {\displaystyle c_{0}=c_{1}} .
In particular, the monotonicity implies that if a Markov process has a positive equilibrium probability distribution P ∗ {\displaystyle P^{*}} then D f ( P ( t ) ∥ P ∗ ) {\displaystyle D_{f}(P(t)\parallel P^{*})} is a monotonic (non-increasing) function of time, where the probability distribution P ( t ) {\displaystyle P(t)} is a solution of the Kolmogorov forward equations (or Master equation), used to describe the time evolution of the probability distribution in the Markov process. This means that all f-divergences D f ( P ( t ) ∥ P ∗ ) {\displaystyle D_{f}(P(t)\parallel P^{*})} are the Lyapunov functions of the Kolmogorov forward equations. The converse statement is also true: If H ( P ) {\displaystyle H(P)} is a Lyapunov function for all Markov chains with positive equilibrium P ∗ {\displaystyle P^{*}} and is of the trace-form ( H ( P ) = ∑ i f ( P i , P i ∗ ) {\displaystyle H(P)=\sum _{i}f(P_{i},P_{i}^{*})} ) then H ( P ) = D f ( P ( t ) ∥ P ∗ ) {\displaystyle H(P)=D_{f}(P(t)\parallel P^{*})} , for some convex function f.[3][4] For example, Bregman divergences in general do not have such property and can increase in Markov processes.[5]
The f-divergences can be expressed using Taylor series and rewritten using a weighted sum of chi-type distances (Nielsen & Nock (2013)).
Let f ∗ {\displaystyle f^{*}} be the convex conjugate of f {\displaystyle f} . Let e f f d o m ( f ∗ ) {\displaystyle \mathrm {effdom} (f^{*})} be the effective domain of f ∗ {\displaystyle f^{*}} , that is, e f f d o m ( f ∗ ) = { y : f ∗ ( y ) < ∞ } {\displaystyle \mathrm {effdom} (f^{*})=\{y:f^{*}(y)<\infty \}} . Then we have two variational representations of D f {\displaystyle D_{f}} , which we describe below.
Under the above setup,
Theorem— D f ( P ; Q ) = sup g : Ω → e f f d o m ( f ∗ ) E P [ g ] − E Q [ f ∗ ∘ g ] {\displaystyle D_{f}(P;Q)=\sup _{g:\Omega \to \mathrm {effdom} (f^{*})}E_{P}[g]-E_{Q}[f^{*}\circ g]} .
This is Theorem 7.24 in.[2]
Using this theorem on total variation distance, with generator f ( x ) = 1 2 | x − 1 | , {\displaystyle f(x)={\frac {1}{2}}|x-1|,} its convex conjugate is f ∗ ( x ∗ ) = { x ∗ on [ − 1 / 2 , 1 / 2 ] , + ∞ else. {\displaystyle f^{*}(x^{*})={\begin{cases}x^{*}{\text{ on }}[-1/2,1/2],\\+\infty {\text{ else.}}\end{cases}}} , and we obtain T V ( P ‖ Q ) = sup | g | ≤ 1 / 2 E P [ g ( X ) ] − E Q [ g ( X ) ] . {\displaystyle TV(P\|Q)=\sup _{|g|\leq 1/2}E_{P}[g(X)]-E_{Q}[g(X)].} For chi-squared divergence, defined by f ( x ) = ( x − 1 ) 2 , f ∗ ( y ) = y 2 / 4 + y {\displaystyle f(x)=(x-1)^{2},f^{*}(y)=y^{2}/4+y} , we obtain χ 2 ( P ; Q ) = sup g E P [ g ( X ) ] − E Q [ g ( X ) 2 / 4 + g ( X ) ] . {\displaystyle \chi ^{2}(P;Q)=\sup _{g}E_{P}[g(X)]-E_{Q}[g(X)^{2}/4+g(X)].} Since the variation term is not affine-invariant in g {\displaystyle g} , even though the domain over which g {\displaystyle g} varies is affine-invariant, we can use up the affine-invariance to obtain a leaner expression.
Replacing g {\displaystyle g} by a g + b {\displaystyle ag+b} and taking the maximum over a , b ∈ R {\displaystyle a,b\in \mathbb {R} } , we obtain χ 2 ( P ; Q ) = sup g ( E P [ g ( X ) ] − E Q [ g ( X ) ] ) 2 V a r Q [ g ( X ) ] , {\displaystyle \chi ^{2}(P;Q)=\sup _{g}{\frac {(E_{P}[g(X)]-E_{Q}[g(X)])^{2}}{Var_{Q}[g(X)]}},} which is just a few steps away from the Hammersley–Chapman–Robbins bound and the Cramér–Rao bound (Theorem 29.1 and its corollary in [2]).
For α {\displaystyle \alpha } -divergence with α ∈ ( − ∞ , 0 ) ∪ ( 0 , 1 ) {\displaystyle \alpha \in (-\infty ,0)\cup (0,1)} , we have f α ( x ) = x α − α x − ( 1 − α ) α ( α − 1 ) {\displaystyle f_{\alpha }(x)={\frac {x^{\alpha }-\alpha x-(1-\alpha )}{\alpha (\alpha -1)}}} , with range x ∈ [ 0 , ∞ ) {\displaystyle x\in [0,\infty )} . Its convex conjugate is f α ∗ ( y ) = 1 α ( x ( y ) α − 1 ) {\displaystyle f_{\alpha }^{*}(y)={\frac {1}{\alpha }}(x(y)^{\alpha }-1)} with range y ∈ ( − ∞ , ( 1 − α ) − 1 ) {\displaystyle y\in (-\infty ,(1-\alpha )^{-1})} , where x ( y ) = ( ( α − 1 ) y + 1 ) 1 α − 1 {\displaystyle x(y)=((\alpha -1)y+1)^{\frac {1}{\alpha -1}}} .
Applying this theorem yields, after substitution with h = ( ( α − 1 ) g + 1 ) 1 α − 1 {\displaystyle h=((\alpha -1)g+1)^{\frac {1}{\alpha -1}}} , D α ( P ‖ Q ) = 1 α ( 1 − α ) − inf h : Ω → ( 0 , ∞ ) ( E Q [ h α α ] + E P [ h α − 1 1 − α ] ) , {\displaystyle D_{\alpha }(P\|Q)={\frac {1}{\alpha (1-\alpha )}}-\inf _{h:\Omega \to (0,\infty )}\left(E_{Q}\left[{\frac {h^{\alpha }}{\alpha }}\right]+E_{P}\left[{\frac {h^{\alpha -1}}{1-\alpha }}\right]\right),} or, releasing the constraint on h {\displaystyle h} , D α ( P ‖ Q ) = 1 α ( 1 − α ) − inf h : Ω → R ( E Q [ | h | α α ] + E P [ | h | α − 1 1 − α ] ) . {\displaystyle D_{\alpha }(P\|Q)={\frac {1}{\alpha (1-\alpha )}}-\inf _{h:\Omega \to \mathbb {R} }\left(E_{Q}\left[{\frac {|h|^{\alpha }}{\alpha }}\right]+E_{P}\left[{\frac {|h|^{\alpha -1}}{1-\alpha }}\right]\right).} Setting α = − 1 {\displaystyle \alpha =-1} yields the variational representation of χ 2 {\displaystyle \chi ^{2}} -divergence obtained above.
The domain over which h {\displaystyle h} varies is not affine-invariant in general, unlike the χ 2 {\displaystyle \chi ^{2}} -divergence case. The χ 2 {\displaystyle \chi ^{2}} -divergence is special, since in that case, we can remove the | ⋅ | {\displaystyle |\cdot |} from | h | {\displaystyle |h|} .
For general α ∈ ( − ∞ , 0 ) ∪ ( 0 , 1 ) {\displaystyle \alpha \in (-\infty ,0)\cup (0,1)} , the domain over which h {\displaystyle h} varies is merely scale invariant. Similar to above, we can replace h {\displaystyle h} by a h {\displaystyle ah} , and take minimum over a > 0 {\displaystyle a>0} to obtain D α ( P ‖ Q ) = sup h > 0 [ 1 α ( 1 − α ) ( 1 − E P [ h α − 1 ] α E Q [ h α ] α − 1 ) ] . {\displaystyle D_{\alpha }(P\|Q)=\sup _{h>0}\left[{\frac {1}{\alpha (1-\alpha )}}\left(1-{\frac {E_{P}[h^{\alpha -1}]^{\alpha }}{E_{Q}[h^{\alpha }]^{\alpha -1}}}\right)\right].} Setting α = 1 2 {\displaystyle \alpha ={\frac {1}{2}}} , and performing another substitution by g = h {\displaystyle g={\sqrt {h}}} , yields two variational representations of the squared Hellinger distance: H 2 ( P ‖ Q ) = 1 2 D 1 / 2 ( P ‖ Q ) = 2 − inf h > 0 ( E Q [ h ( X ) ] + E P [ h ( X ) − 1 ] ) , {\displaystyle H^{2}(P\|Q)={\frac {1}{2}}D_{1/2}(P\|Q)=2-\inf _{h>0}\left(E_{Q}\left[h(X)\right]+E_{P}\left[h(X)^{-1}\right]\right),} H 2 ( P ‖ Q ) = 2 sup h > 0 ( 1 − E P [ h − 1 ] E Q [ h ] ) . {\displaystyle H^{2}(P\|Q)=2\sup _{h>0}\left(1-{\sqrt {E_{P}[h^{-1}]E_{Q}[h]}}\right).} Applying this theorem to the KL-divergence, defined by f ( x ) = x ln x , f ∗ ( y ) = e y − 1 {\displaystyle f(x)=x\ln x,f^{*}(y)=e^{y-1}} , yields D K L ( P ; Q ) = sup g E P [ g ( X ) ] − e − 1 E Q [ e g ( X ) ] . {\displaystyle D_{KL}(P;Q)=\sup _{g}E_{P}[g(X)]-e^{-1}E_{Q}[e^{g(X)}].} This is strictly less efficient than the Donsker–Varadhan representation D K L ( P ; Q ) = sup g E P [ g ( X ) ] − ln E Q [ e g ( X ) ] . {\displaystyle D_{KL}(P;Q)=\sup _{g}E_{P}[g(X)]-\ln E_{Q}[e^{g(X)}].} This defect is fixed by the next theorem.
Assume the setup in the beginning of this section ("Variational representations").
Theorem—If f ( x ) = + ∞ {\displaystyle f(x)=+\infty } on x < 0 {\displaystyle x<0} (redefine f {\displaystyle f} if necessary), then
D f ( P ‖ Q ) = f ′ ( ∞ ) P [ S c ] + sup g E P [ g 1 S ] − Ψ Q , P ∗ ( g ) {\displaystyle D_{f}(P\|Q)=f^{\prime }(\infty )P\left[S^{c}\right]+\sup _{g}\mathbb {E} _{P}\left[g1_{S}\right]-\Psi _{Q,P}^{*}(g)} ,
where Ψ Q , P ∗ ( g ) := inf a ∈ R E Q [ f ∗ ( g ( X ) − a ) ] + a P [ S ] {\displaystyle \Psi _{Q,P}^{*}(g):=\inf _{a\in \mathbb {R} }\mathbb {E} _{Q}\left[f^{*}(g(X)-a)\right]+aP[S]} and S := { q > 0 } {\displaystyle S:=\{q>0\}} , where q {\displaystyle q} is the probability density function of Q {\displaystyle Q} with respect to some underlying measure.
In the special case of f ′ ( ∞ ) = + ∞ {\displaystyle f^{\prime }(\infty )=+\infty } , we have
D f ( P ‖ Q ) = sup g E P [ g ] − Ψ Q ∗ ( g ) , Ψ Q ∗ ( g ) := inf a ∈ R E Q [ f ∗ ( g ( X ) − a ) ] + a {\displaystyle D_{f}(P\|Q)=\sup _{g}\mathbb {E} _{P}[g]-\Psi _{Q}^{*}(g),\quad \Psi _{Q}^{*}(g):=\inf _{a\in \mathbb {R} }\mathbb {E} _{Q}\left[f^{*}(g(X)-a)\right]+a} .
This is Theorem 7.25 in.[2]
Applying this theorem to KL-divergence yields the Donsker–Varadhan representation.
Attempting to apply this theorem to the general α {\displaystyle \alpha } -divergence with α ∈ ( − ∞ , 0 ) ∪ ( 0 , 1 ) {\displaystyle \alpha \in (-\infty ,0)\cup (0,1)} does not yield a closed-form solution.
The following table lists many of the common divergences between probability distributions and the possible generating functions to which they correspond. Notably, except for total variation distance, all others are special cases of α {\displaystyle \alpha } -divergence, or linear sums of α {\displaystyle \alpha } -divergences.
For each f-divergence D f {\displaystyle D_{f}} , its generating function is not uniquely defined, but only up to c ⋅ ( t − 1 ) {\displaystyle c\cdot (t-1)} , where c {\displaystyle c} is any real constant. That is, for any f {\displaystyle f} that generates an f-divergence, we have D f ( t ) = D f ( t ) + c ⋅ ( t − 1 ) {\displaystyle D_{f(t)}=D_{f(t)+c\cdot (t-1)}} . This freedom is not only convenient, but actually necessary.
Let f α {\displaystyle f_{\alpha }} be the generator of α {\displaystyle \alpha } -divergence, then f α {\displaystyle f_{\alpha }} and f 1 − α {\displaystyle f_{1-\alpha }} are convex inversions of each other, so D α ( P ‖ Q ) = D 1 − α ( Q ‖ P ) {\displaystyle D_{\alpha }(P\|Q)=D_{1-\alpha }(Q\|P)} . In particular, this shows that the squared Hellinger distance and Jensen-Shannon divergence are symmetric.
In the literature, the α {\displaystyle \alpha } -divergences are sometimes parametrized as
{ 4 1 − α 2 ( 1 − t ( 1 + α ) / 2 ) , if α ≠ ± 1 , t ln t , if α = 1 , − ln t , if α = − 1 {\displaystyle {\begin{cases}{\frac {4}{1-\alpha ^{2}}}{\big (}1-t^{(1+\alpha )/2}{\big )},&{\text{if}}\ \alpha \neq \pm 1,\\t\ln t,&{\text{if}}\ \alpha =1,\\-\ln t,&{\text{if}}\ \alpha =-1\end{cases}}}
which is equivalent to the parametrization in this page by substituting α ← α + 1 2 {\displaystyle \alpha \leftarrow {\frac {\alpha +1}{2}}} .
Here, we compare f-divergences with other statistical divergences.
The Rényi divergences is a family of divergences defined by
R α ( P ‖ Q ) = 1 α − 1 log ( E Q [ ( d P d Q ) α ] ) {\displaystyle R_{\alpha }(P\|Q)={\frac {1}{\alpha -1}}\log {\Bigg (}E_{Q}\left[\left({\frac {dP}{dQ}}\right)^{\alpha }\right]{\Bigg )}\,}
when α ∈ ( 0 , 1 ) ∪ ( 1 , + ∞ ) {\displaystyle \alpha \in (0,1)\cup (1,+\infty )} . It is extended to the cases of α = 0 , 1 , + ∞ {\displaystyle \alpha =0,1,+\infty } by taking the limit.
Simple algebra shows that R α ( P ‖ Q ) = 1 α − 1 ln ( 1 + α ( α − 1 ) D α ( P ‖ Q ) ) {\displaystyle R_{\alpha }(P\|Q)={\frac {1}{\alpha -1}}\ln(1+\alpha (\alpha -1)D_{\alpha }(P\|Q))} , where D α {\displaystyle D_{\alpha }} is the α {\displaystyle \alpha } -divergence defined above.
The only f-divergence that is also a Bregman divergence is the KL divergence.[6]
The only f-divergence that is also an integral probability metric is the total variation.[7]
A pair of probability distributions can be viewed as a game of chance in which one of the distributions defines the official odds and the other contains the actual probabilities. Knowledge of the actual probabilities allows a player to profit from the game. For a large class of rational players the expected profit rate has the same general form as the ƒ-divergence.[8]