File Exchange

image thumbnail

Entropy estimation by Kozachenko-Leonenko method

version 2.0.0.0 (1.3 KB) by Martin V.
The script calculates the entropy point estimation for 1D date by the Kozachenko-Leonenko method.

4 Downloads

Updated 28 Aug 2018

View License

The script calculates the entropy point estimation for 1D date by the Kozachenko-Leonenko method.

Cite As

Martin V. (2020). Entropy estimation by Kozachenko-Leonenko method (https://www.mathworks.com/matlabcentral/fileexchange/37370-entropy-estimation-by-kozachenko-leonenko-method), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

LionelB

Hi Martin, nice code.

A suggestion for better efficiency on large samples is to vectorise the loop

for k = 2:n-1
r(k) = min([input(k+1) - input(k),input(k) - input(k-1)]);
end

as
r(2:n-1) = min([input(3:n)-input(2:n-1); input(2:n-1)-input(1:n-2)]);

(Note: this assumes 'input' is a row vector.)

NoNa

Updates

2.0.0.0

1) evaluation of distance to the nearest neighbour was vectorized
2) script is able to cope with degenerated values (i.e. particular value occurs more than once in input data set and as a result a distance to the nearest neighbour is zero)

MATLAB Release Compatibility
Created with R2017b
Compatible with R2010a to any release
Platform Compatibility
Windows macOS Linux