IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
esag_wta.m
Go to the documentation of this file.
1 %> @brief Estimation Aggregator - Winner takes all
2 %>
3 %> For each row, the output will be the output of the dataset that contains the highest confidence degree
4 classdef esag_wta < esag
5  methods
6  function o = esag_wta(o)
7  o.classtitle = 'Winner-Takes-All';
8  o.inputclass = 'irdata';
9  end;
10  end;
11 
12  methods(Access=protected)
13  %> Abstract
14  function out = do_use(o, dd)
15  dd = o.apply_threshold(dd);
16 
17  out = dd(1).copy_emptyrows();
18  out = out.copy_from_data(dd(1));
19 
20  nf = dd(1).nf;
21  X = zeros(dd(1).no, dd(1).nf);
22  Xbig = [dd.X]; % Horizontal concatenation
23 
24  [vv, ii] = max(Xbig, [], 2);
25  ii = floor((ii-1)/3)+1; % Determines which dataset contains the maximum for each row
26  ii = [(ii-1)*nf+1, ii*nf]; % initial and end position into Xbig for each row
27 
28  % Unfortunately I don't know how to avoid this loop
29  for i = 1:dd(1).no
30  X(i, :) = Xbig(i, ii(i, 1):ii(i, 2));
31  end;
32 
33  out.X = X;
34  end;
35  end;
36 end
Estimation Aggregator - Winner takes all.
Definition: esag_wta.m:4
Dataset class.
Definition: irdata.m:30
Estimation Aggregator - combines estimato objects together.
Definition: esag.m:2