Fox
Fox

Reputation: 9444

KL Divergence in KDE toolbox giving Inf

I am using the KDE toolbox for my work .. Here I am calculating the kde for the set of points in class 1 and set of points in class 2. Then I am taking a KLD between them --

        Bandwidth = 'Hall';
        p = kde(X(:,find(Y(:,1)>=0.5)),Bandwidth);
        q = kde(X(:,find(Y(:,2)>=0.5)),Bandwidth);
        divergence = kld(p,q);

Here X get can be nx9 vector. (n - Nine dimensional points)

For some of the cases I am getting the divergence value as 'Inf'. I am trying to figure out the cause for it. If you have any suggestions please let me know. Any help is appreciated.

Link to the UCI KDE toolbox - http://www.ics.uci.edu/~ihler/code/kde.html

Thanks

Upvotes: 0

Views: 741

Answers (1)

Animesh Pandey
Animesh Pandey

Reputation: 6018

If you look at the formula of the KL Divergence.

enter image description here

One reason could be that one or more of the values in the denominator must have been zero!

and log(0) = Inf/undefined

Upvotes: 1

Related Questions