IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
esag_linear1.m
Go to the documentation of this file.
1 %> @brief Estimation Aggregator - Linear Combination of datasets
2 classdef esag_linear1 < esag
3  properties
4  %> Weights of each dataset
5  weights = [];
6  end;
7  methods
8  function o = esag_linear1(o)
9  o.classtitle = 'Dataset-Linear';
10  o.inputclass = 'irdata';
11  end;
12  end;
13 
14  methods(Access=protected)
15  %> Abstract
16  function out = do_use(o, dd)
17  dd = o.apply_threshold(dd);
18 
19  out = dd(1).copy_emptyrows();
20  out = out.copy_from_data(dd(1));
21 
22 
23  X = zeros(dd(1).no, dd(1).nf);
24  if isempty(o.weights)
25  weiyi = ones(1, numel(dd));
26  else
27  weiyi = o.weights;
28  end;
29  weiyi = weiyi/sum(weiyi);
30 
31 
32  for i = 1:numel(dd)
33  X = X+dd(i).X*weiyi(i);
34  end;
35 
36  out.X = X;
37  end;
38  end;
39 end
Dataset class.
Definition: irdata.m:30
Estimation Aggregator - combines estimato objects together.
Definition: esag.m:2
Estimation Aggregator - Linear Combination of datasets.
Definition: esag_linear1.m:2