IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
pre_meanc.m
Go to the documentation of this file.
1 %> @brief Mean-centering (trained)
2 %>
3 %> Descends from pre_norm_base to organize in GUI but is unrelated to other pre_norm_*
5  properties(SetAccess=protected)
6  means = [];
7  end;
8 
9  methods
10  function o = pre_meanc(o)
11  o.classtitle = 'Trained Mean-centering';
12  o.short = 'MeanC';
13  o.flag_trainable = 1;
14  o.flag_params = 0;
15  end;
16  end;
17 
18  methods(Access=protected)
19 
20 
21  % Trains the block: records the variable means
22  function o = do_train(o, data)
23  o.means = mean(data.X, 1);
24  end;
25 
26  % Applies block to dataset
27  function data = do_use(o, data)
28  X = data.X;
29  data.X = X-repmat(o.means, size(X, 1), 1);
30  end;
31  end;
32 end
Base Block class.
Definition: block.m:2
Normalization - base class.
Definition: pre_norm_base.m:6
Mean-centering (trained)
Definition: pre_meanc.m:4