IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
vectorcomp.m
Go to the documentation of this file.
1 %> @brief Paired Vector Comparer base class
2 %>
3 %> Compares two vectors. Number of elements must be the same in both vector. This is applied to:
4 %> @arg comparing two classifiers (see @ref reptt_sgs, which has a @ref reptt_sgs::vectorcomp property)
5 %> @arg measusing the diversity of two classifiers (example: @ref reptt_xornorm)
6 %>
7 %> Depending on the case (i.e., the @ref vectorcomp descendant considered), the vectors must be classification rates or the class predictions
8 %> themselves. See the descendant classes (i.e., classes vectorcomp_*)
9 classdef vectorcomp < irobj
10  methods(Access=protected)
11  % Abstract
12  function z = do_test(o, vv)
13  z = 0;
14  end;
15  end
16  methods
17  function o = vectorcomp(o)
18  o.classtitle = 'Vector Comparer';
19  %o.color = [118, 176, 189]/255;
20  o.color = [244, 192, 34]/255;
21 
22 
23  end;
24 
25  % May return one grade or a vector thereof
26  function z = test(o, v1, v2)
27  z = o.do_test(v1, v2);
28  end;
29 
30  %> Cross-test of many vectors
31  %>
32  %> Performs the test with all combinations of the columns of R
33  %>
34  %> The resulting table should be read as: the row represents the first variable
35  %> and the column represents the second variable.
36  %>
37  %> Examples:
38  %> @arg for a 2-sided t-test: H0: mean_row_i - mean_col_j = 0
39  %> @arg for a right-tail t-test: H0: mean_row_i - mean_col_j < 0
40  %>
41  %> @param o
42  %> @param R a matrix of shape [v1, v2, v3, v4, ...]
43  %> @return a matrix [number of v's]x[number of v's]
44  function M = crosstest(o, R)
45  nb = size(R, 2);
46 
47  M = zeros(nb, nb);
48  for i = 1:nb
49  for j = i+1:nb
50  meas = o.test(R(:, i), R(:, j));
51 
52  if numel(meas) > 1
53  M(i, j) = meas(1);
54  M(j, i) = meas(2);
55  else
56  M(i, j) = meas;
57  M(j, i) = meas;
58  end;
59  end;
60  end;
61  end;
62  end;
63 end
Paired Vector Comparer base class.
Definition: vectorcomp.m:9
Analysis Session (AS) base class.
Definition: as.m:6
Base class.
Definition: irobj.m:33