Cross-entropy equals entropy plus relative entropy

ID: cross-entropy-equals-entropy-plus-relative-entropy

For finite probability mass functions, with whenever , subtract the two expectations of logarithmic loss:
The Gibbs inequality makes the difference nonnegative and zero exactly when . If assigns zero probability to an outcome with positive probability under , both the cross-entropy and the Kullback-Leibler divergence are infinite. The finite information entropy still leaves the displayed identity valid in the extended sense. In more general settings, undefined differences such as cannot be used as a derivation.

New to topics? Read the docs here!