1 function [train_data, normalized_data, num_fact denum_fact] = ...
2 normalization_module(data, data_to_normalize, parameters)
4 %parameters.normalize 0: none 1: min and std 2:minmax 3: zscore
5 % data_to_normalize = data;
7 if ~isfield(parameters,
'BoW')
8 parameters.BoW = false;
11 denum_fact = ones(1,size(data_to_normalize,2));
13 normalized_data = data_to_normalize;
14 switch(parameters.normalize)
17 denum_fact = ones(size(data_to_normalize));
20 denum_fact = std(data);
21 train_data = bsxfun(@rdivide, bsxfun(@minus, data, num_fact), denum_fact+eps);
24 denum_fact = max(data)- min(data);
25 train_data = bsxfun(@rdivide, bsxfun(@minus, data, num_fact), denum_fact+eps)-0.5;
28 [train_data, num_fact,denum_fact] = zscore(data);
30 train_data= rank_normlize(data);
32 normalized_data = rank_normlize(data_to_normalize, data);
34 num_fact = (max(data)+min(data))/2;
35 denum_fact = num_fact;
36 train_data = bsxfun(@rdivide, bsxfun(@minus, data, num_fact), denum_fact+eps);
39 if ~isempty(data_to_normalize)
40 normalized_data = bsxfun(@rdivide, bsxfun(@minus, data_to_normalize, num_fact), denum_fact+eps);