Navigation

Operators and Keywords

Function List:

C++ API

Function File: kullback_leibler_distance (P, Q)

P and Q are probability distribution functions of the Dkl(P,Q) = \sum_x -P(x).log(Q(x)) + P(x).log(P(x)) = \sum_x -P(x).log(P(x)/Q(x))

Compute the Kullback-Leibler distance of two probability distributions given, P & Q.

                   kullback_leibler_distance([0.2 0.3 0.5],[0.1 0.8 0.1])
                   ⇒   ans = 0.64910