Rank: 765 based on 92 downloads (last 30 days) and 2 files submitted
photo

Nima Razavi

E-mail

Personal Profile:
Professional Interests:
Computer Vision, Machine Learning

 

Watch this Author's files

 

Files Posted by Nima View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
15 Jul 2008 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi kullbackleibler diver..., statistics, infor, information gain, relative entropy, probability 83 3
  • 4.0
4.0 | 1 rating
15 Jul 2008 Jensen-Shannon divergence Calculates the Jensen-Shannon divergence between two probability distributions Author: Nima Razavi statistics, probability, jensenshannon diverge..., information radius ir..., total divergence 9 1
Comments and Ratings on Nima's Files View all
Updated File Comment by Comments Rating
18 Oct 2011 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi khan, amjad

dear sir we need kld for feature selection in MRI brain image can some one help me

07 May 2011 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi nguyen, Hung
07 Mar 2011 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi Greene, Nate

Please note that the logarithms should be base 2 if calculating values in bits.

15 Sep 2009 Jensen-Shannon divergence Calculates the Jensen-Shannon divergence between two probability distributions Author: Nima Razavi Kimberly

Hi ... thanks very much for writing this code and taking the time to post it! I had some trouble in the case where at least one of the entries of P and Q are both 0. In this case the last line of KLdiv.m:

% resolving the case when P(i)==0
dist(isnan(dist))=0;

sets the divergence to 0, which is clearly not the case e.g. if P = [1 0 1], Q = [0 0 1].

I would suggest changing the last few lines to:

   
    Q = Q ./repmat(sum(Q,2),[1 size(Q,2)]);
    P = P ./repmat(sum(P,2),[1 size(P,2)]);
    M=log(P./Q);
    M(isnan(M))=0;
    dist = sum(P.*M,2);
end

which seems to work for me.

14 Jul 2008 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi Shvorob, Dimitri

Your implementation is third of its kind on FEX: please take time to search FEX for existing code before posting.

Top Tags Applied by Nima
probability, statistics, infor, information gain, information radius irad
Files Tagged by Nima View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
15 Jul 2008 Kullback-Leibler Divergence Calculates the Kullback-Leibler Divergence between two probability distributions Author: Nima Razavi kullbackleibler diver..., statistics, infor, information gain, relative entropy, probability 83 3
  • 4.0
4.0 | 1 rating
15 Jul 2008 Jensen-Shannon divergence Calculates the Jensen-Shannon divergence between two probability distributions Author: Nima Razavi statistics, probability, jensenshannon diverge..., information radius ir..., total divergence 9 1

Contact us at files@mathworks.com