IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
estlog_rightwrong.m
Go to the documentation of this file.
1 %> @brief Records (1)x([rejected, right, wrong]) hits
2 %>
3 %> For right/wrong to be detected, classlabels from estimation and test datasets need to follow same system, which is
4 %> represented by the @c estlabels property.
6  properties
7  %> All possible class labels in estimation datasets
8  estlabels = {};
9  %> =2. Index of element: 1-rejected; 2-right; 3-wrong
10  idx_rate = 2;
11  end;
12 
13  methods
14  function o = estlog_rightwrong()
15  o.classtitle = 'Right/Wrong';
16  o.flag_params = 1;
17  end;
18 
19  %> Returns average sensitivity. Calculated as normalized sum.
20  function z = get_rate(o)
21  C = o.get_C([], 1, 2, 1); % Average time-wise percentage with discounted items
22  z = C(o.idx_rate);
23  end;
24 
25  %> Returns vector of time-wise averages.
26  function z = get_rates(o)
27  CC = o.get_C([], 1, 0, 1); % gets time-wise percentage with discounted items
28  z = permute(CC(1, o.idx_rate, :), [1, 3, 2]);
29  end;
30  end;
31 
32  methods(Access=protected)
33  %> Returns fixed {'Right', 'Wrong'} cell.
34  function z = get_collabels(o)
35  z = {'Right', 'Wrong'};
36  end;
37 
38  %> Returns fixed {'---'} cell.
39  function z = get_rowlabels(o)
40  z = {'---'};
41  end;
42 
43  function o = do_record(o, pars)
44  est = pars.est;
45  ds_test = pars.ds_test;
46  classes1 = renumber_classes(est.classes, est.classlabels, o.estlabels);
47  classes2 = renumber_classes(ds_test.classes, ds_test.classlabels, o.estlabels);
48 
49  boolc = classes1 == classes2;
50  boolr = classes1 == -1;
51  no_correct = sum(boolc);
52  no_reject = sum(boolr);
53  o.hits(:, :, o.t) = [no_reject, no_correct, est.no-no_reject-no_correct];
54 
55  if o.flag_support
56  o.supports(:, :, o.t) = {est.X(boolr, :)', est.X(boolc, :)', est.X(~boolc & ~boolr, :)'};
57  end;
58  end;
59  end;
60 end
Estimation logs base class.
Definition: estlog.m:4
Records (1)x([rejected, right, wrong]) hits.
function renumber_classes(in classes_orig, in classlabels_orig, in classlabels_ref)
Analysis Session (AS) base class.
Definition: as.m:6