Suppose I want to calculate the relative entropy:
$$D(q||p)= \sum q(x)\log \frac{q(x)}{p(x)}$$
If, for some $x$, I have $q(x)=p(x)=0$, does the corresponding factor in the sum becomes $0$?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communitySuppose I want to calculate the relative entropy:
$$D(q||p)= \sum q(x)\log \frac{q(x)}{p(x)}$$
If, for some $x$, I have $q(x)=p(x)=0$, does the corresponding factor in the sum becomes $0$?
Wikipedia has the answer. Yes, the corresponding term becomes $0$.
In more detail (from wiki): For discrete distributions,
The Kullback–Leibler divergence is defined only if $q(x)=0$ implies $p(x)=0$, for all $x$ (absolute continuity). Whenever $p(x)$ is zero the contribution of the x-th term is interpreted as zero because $\lim _{x\to 0}x\log(x)=0$
That is if both probabilities are $0$ you take the limit which, is $0$ for that term of the sum.