You can't -- the KL divergence is only defined when the zeroes of $P$ and $Q$ are in the same places.
–
mjqxxxxOct 23 '12 at 16:04

2

You might consider using the so-called "earth mover's distance" instead, unless you have a special reason for wanting KL in particular.
–
mjqxxxxOct 23 '12 at 16:07

ahh i found this line in the definition of K-L: The K-L divergence is only defined if P and Q both sum to 1 and if implies for all i (absolute continuity). If the quantity appears in the formula, it is interpreted as zero because ." Please answer the question, and I accept as solution.
–
Tatar ElemérOct 23 '12 at 17:19

1 Answer
1

As the others already mentioned for the given data there exist no exact calculation of the KL divergence. However if you want to have something in hand anyway, then you can use deliver an $\epsilon$ amount of probability from the non zero probabilites to the zero probabilites, say $1/100$ from each. Then you wil have $3/100$ for the zero probabilities. Now you can calculate the KL-divergence.

In the next step deliver even less amount of probability say $1/1000$ and in the same way calculate the KL- divergence. This procedure will eventually give some ideas. It is also okay to remove a very tiny amount of probability from non zero elements because in the divisions or multiplications it will have a little effect while it will make your problem well defined.