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