# KL-divergence returns infinity

Given an original probability distribution P, I want to measure how much an approximation Q differs from the initial distribution. For that I calculate the KL-divergence via scipy.stats.entropy, which returns infinity due to the large difference. However, as with time the approximation becomes better, I still want to quantify the divergence between the two sets.

The question is, is there any hack to avoid inf values or should I circumvent the behaviour by using some other distance measure?

• I had the same problem and I saw that my x-axes weren't aligned so some adjustments were required as a "hack" when these happened. Read here: stackoverflow.com/questions/26743201/… Sep 25, 2017 at 9:09