IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
sgs_weighted.m
Go to the documentation of this file.
1 %> @brief Weighted Sub-Sampling
2 %>
3 %> Used in Adaboost
4 %> @sa sgs_randsub_base, uip_sgs_randsub_base.m, uip_sgs_weighted.m
6  properties
7  %> weights per observation
8  weights;
9  end;
10 
11  methods(Access=protected)
12  %> Returns a 2D cell: rows are pieces, columns are bites, elements are indexes
13  function idxs = get_idxs_new(o)
14  idxs = cell(o.no_pieces, 1);
15  if o.flag_perclass
16  for i = 1:o.no_pieces
17  no_units_sel = o.pvt_no_units_sel(i, 1); %> row vector containing number of units for each bite of the piece
18  p = weightedsubsampling(no_units_sel, o.weights(o.maps{i}));
19  idxs{i, 1} = p;
20  end;
21  else
22  p = weightedsubsampling(o.pvt_no_units_sel(1, 1), o.weights);
23  idxs{1, 1} = p;
24  end;
25  end;
26 
27  %> Parameter validation
28  function o = do_assert(o)
29  if strcmp(o.type, 'fixed')
30  if numel(o.bites_fixed) > 1
31  irverbose('INFO: Only one ''bite'' will be used (the bites_fixed property has more than one element)', 2);
32  end;
33  else
34  if numel(o.bites) > 1
35  irverbose('INFO: Only one ''bite'' will be used (the bites property has more than one element)', 2);
36  end;
37  end;
38  if o.flag_group
39  irerror('Working with groups not supported!');
40  end;
41  do_assert@sgs_randsub(o);
42  end;
43  end;
44 
45  methods
46  function o = sgs_weighted(o)
47  o.classtitle = 'Weighted Sub-sampling';
48  end;
49  end;
50 end
function irverbose(in s, in level)
function weightedsubsampling(in no_sel, in weights)
Random Sub-sampling base class.
Weighted Sub-Sampling.
Definition: sgs_weighted.m:5
function irerror(in s)
Random Sub-sampling.
Definition: sgs_randsub.m:5