KLdistance

KLDis(P, Q)

Calculates the Kullback-Leibler Distance of two discrete probability distributions. P and Q are automatically normalised to have the sum of one on rows have the length of one at each.

USAGE:

dist = KLDis(P, Q)

INPUTS:

P = n x nbins Q = 1 x nbins or n x nbins(one to one)

OUTPUTS:

dist = n x 1

KLdistance(data1, data2, num_iter, parameters)

This function calculates the Kullback-Leibler Distance (KLD) between two distributions then runs a certain number of iterations where the labels are randomised and the KLD is calculated. Then, the distribution of the Disergences is plotted.