IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
aggr_hiesplit.m
Go to the documentation of this file.
1 %> @brief Class-Hierarchical Training Data Split
2 %>
3 %> Creates one classifier per class when taking the @c hie_split class hierarchical levels into account for splitting
4 %> the training dataset.
5 %>
6 %> Every time @c train() is called, new classifiers are added maintaining existing ones.
7 %>
8 %> @todo think about the future of this class, it cannot be trained like the others! The problem is that the classes in
9 %> dataset passed for training are not the classes classified by the classifier
10 %>
11 classdef aggr_hiesplit < aggr
12  properties
13  %> must contain a block object that will be replicated as needed
14  block_mold = [];
15  end;
16 
17  methods
18  function o = aggr_hiesplit()
19  o.classtitle = 'Class-Hierarchical Training Data Split';
20  end;
21  end;
22 
23  methods(Access=protected)
24  %> Adds one classifier per class considering the-the-the-the. Existing classifiers remain
25  function o = do_train(o, data)
26  labels_temp = {};
27 
28  pieces = data.split_splitidxs();
29  nump = numel(pieces);
30 
31  k = numel(o.blocks);
32 
33  ipro = progress2_open('AGGR_HIESPLIT', [], 0, nump);
34  for i = 1:nump
35  d = pieces(i);
36  labels_temp = unique([labels_temp, d.classlabels]); % collects class labels - here providing for idfferent splits not having the same class labels
37 
38  cl = o.block_mold.boot();
39  cl = cl.train(d);
40  cl.title = ['Model ', int2str(i)];
41  k = k+1;
42  o.blocks(k).block = cl;
43  o.blocks(k).classlabels = d.classlabels;
44 
45  ipro = progress2_change(ipro, [], [], i);
46  end;
47  progress2_close(ipro);
48 
49  o.classlabels = labels_temp;
50  end;
51  end;
52 end
Class-Hierarchical Training Data Split.
Definition: aggr_hiesplit.m:11
function progress2_change(in prgrss, in title, in perc, in i, in n)
Base class for all ensemble classifiers.
Definition: aggr.m:6
function progress2_open(in title, in perc, in i, in n)
Base Block class.
Definition: block.m:2
function progress2_close(in prgrss)
Analysis Session (AS) base class.
Definition: as.m:6