IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
aggr_ovc.m
Go to the documentation of this file.
1 %> @brief One-versus-"control" classifier
2 %>
3 %> Currently not multitrainable
4 classdef aggr_ovc < aggr
5  properties
6  % must contain a block object that will be replicated as needed
7  block_mold = [];
8  end;
9 
10  methods
11  function o = aggr_ovc(o)
12  o.classtitle = 'One-versus-reference';
13  end;
14  end;
15 
16  methods(Access=protected)
17  function o = do_boot(o)
18  o = do_boot@aggr(o);
19  end;
20 
21  % Adds classifiers when new classes are presented
22  function o = do_train(o, data)
23  o.classlabels = data.classlabels;
24 
25  nc = data.nc;
26 
28 
29 % pieces = data_split_classes(data); % Por enquanto assim, mas dava pra tentar um split unico
30  o.time_train = 0;
31  for i1 = 2:nc
32  blk = o.block_mold.boot();
33  o.blocks(i1-1).block = blk.train(data_split_classmap(data, [1, i1]));
34  o.blocks(i1-1).classlabels = data.classlabels(1, i1);
35  end;
36  end;
37 
38  %{
39  %> Uses blocks and aggregates @c est 's using @c o.esag
40  %>
41  %> @retval [o, est]
42  function est = do_use(o, data)
43 
44  nb = numel(o.blocks);
45  for i = nb:-1:1 % for allocation of ests_
46  [o.blocks(i).block, ee] = o.blocks(i).block.use(data);
47 
48  ests_(i) = ee;
49  ests_(i).classlabels = o.classlabels;
50  ests_(i).X = zeros(data.no, nb);
51  ests_(i).X = repmat(ee.X(:, 2)/(nb-1), 1, nb); % "Dilutes" the "all" posterior
52  ests_(i).X(:, i) = ee.X(:, 1);
53  end;
54 
55  est = o.esag.use(ests_);
56  if o.flag_ests
57  o.ests = ests_;
58  else
59  o.ests = [];
60  end;
61  end;
62  %}
63  end;
64 end
Base class for all ensemble classifiers.
Definition: aggr.m:6
function data_split_classmap(in data, in maps)
Base Block class.
Definition: block.m:2
function data_split_classes(in data, in hierarchy)
One-versus-"control" classifier.
Definition: aggr_ovc.m:4
Analysis Session (AS) base class.
Definition: as.m:6