ITE / code / shared / embedded / KDP / mat_oct / kdpee.m

function h = kdpee (arr, mins, maxs, zcut)
% function h = kdpee (arr)
% function h = kdpee (arr, mins, maxs)
% function h = kdpee (arr, mins, maxs, zcut)
% 
% Entropy estimator using k-d partitioning. Returns a value in nats.
%
%   "arr" is a matrix of data points, 1 row per datum.
%
% The algorithm can run on data with known OR unknown support.
%   (Support is assumed to be extent of data in the latter case.)
% If the support is known, pass it in as vectors "mins" and "maxs".
% If the support is not known simply don't supply "mins" or "maxs".
%
%   kdpee is free software: you can redistribute it and/or modify
%   it under the terms of the GNU General Public License as published by
%   the Free Software Foundation, either version 3 of the License, or
%   (at your option) any later version.


if (nargin < 4)
	zcut = 1.96;
end

n = size(arr, 1);    % num data points
d = size(arr, 2);    % dimensionality

%if (n < (2^d))
%	fprintf(1, 'kdpee() warning: n < 2^d, meaning you might not have enough data to make an entropy estimate for the dimensionality\n');
%end

if(nargin < 3)
    % Take limits from data, should have tendency to underestimate support
    %           but seems to work well
	mins = min(arr, [], 1);
	maxs = max(arr, [], 1);
end


h = kdpeemex(arr, mins, maxs, zcut);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.