IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
hitsentropy.m
Go to the documentation of this file.
1 %>@ingroup maths
2 %> @file
3 %> @brief Calculates entropy curve of a hitss matrix
4 %>
5 %> @param hitss matrix [nf selected]x[nf] of "hits", where each row is a histogram in a forward selection process
6 %> @param type ='uni'
7 %> @arg 'uni' evaluates the rows individually
8 %> @arg 'accum' accumilates rows as it goes down the rows
9 %> @return y nf x stability curve
10 function y = hitsentropy(hitss, type)
11 
12 if nargin < 2 || isempty(type)
13  type = 'uni';
14 end;
15 
16 
17 [nf_select, nf] = size(hitss);
18 
19 y = zeros(1, nf_select);
20 
21 x = 0;
22 for i = 1:nf_select
23  switch type
24  case 'uni'
25  x = hitss(i, :);
26  case 'accum'
27  x = hitss(i, :)+x;
28  otherwise
29  irerror(sprintf('Unknown type: "%s"', type));
30  end;
31 
32  % converts to frequency or probability estimations
33  p = x/sum(x);
34  p(p == 0) = [];
35 
36  y(i) = -sum(p.*log10(p));
37 end;
function irerror(in s)
function hitsentropy(in hitss, in type)
Analysis Session (AS) base class.
Definition: as.m:6