IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
grag_classes_votew.m
Go to the documentation of this file.
1 %> @file
2 %> @ingroup groupgroup
3 
4 %> @brief Group Aggregator - Classes - Weighted Vote
5 %>
6 %> @c X property of output will have the ratio between the sum of weights for for the assigned class and total sum of weights in
7 %> group.
8 %>
9 %> Acts on estimato datasets already processed by a decider. The relevant thing is that the X property must have the support for the
10 %class decided
12  methods
13  function o = grag_classes_votew(o)
14  o.classtitle = 'Weighted vote';
15  end;
16  end;
17 
18  methods(Access=protected)
19  function o = process_group(o, idxs)
20  % Extracts from dataset for faster manipulation
21  classes = o.indata.classes(idxs);
22  X = o.indata.X(idxs, :);
23 
24  poll = zeros(1, max(classes)+1); % Initializes poll
25  if isempty(poll)
26  o.outdata.X(o.no_out, 1) = 0;
27  o.outdata.classes(o.no_out) = -1;
28  else
29  for i = 1:numel(classes)
30  if classes(i) > -1
31  poll(classes(i)+1) = poll(classes(i)+1)+X(i, 1);
32  end;
33  end;
34  [val, idx] = max(poll);
35  support = val/sum(poll);
36  o.outdata.X(o.no_out, 1) = support;
37  if support >= o.decisionthreshold
38  o.outdata.classes(o.no_out) = idx-1;
39  else
40  o.outdata.classes(o.no_out) = -1;
41  end;
42  end;
43  end;
44 
45  function o = dim_outdata(o, ng)
46  o.outdata.classes(ng, 1) = 0;
47  o.outdata.X(ng, 1) = 0;
48  end;
49  end;
50 end
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
Group Aggregator - Classes - Weighted Vote.
Block that resolves estimato posterior probabilities into classes.
Definition: decider.m:10
Group Aggregator - classes.
Definition: grag_classes.m:5
Dataset representing estimation.
Definition: estimato.m:4