TEAP (Toolbox for Emotion Analysis using Physiological Signals) doc
normalization_module.m
Go to the documentation of this file.
1 function [train_data, normalized_data, num_fact denum_fact] = ...
2  normalization_module(data, data_to_normalize, parameters)
3 
4 %parameters.normalize 0: none 1: min and std 2:minmax 3: zscore
5 % data_to_normalize = data;
6 % end
7 if ~isfield(parameters,'BoW')
8  parameters.BoW = false;
9 end
10 num_fact = 0;
11 denum_fact = ones(1,size(data_to_normalize,2));
12 train_data = data;
13 normalized_data = data_to_normalize;
14 switch(parameters.normalize)
15  case 0
16  num_fact = 0;
17  denum_fact = ones(size(data_to_normalize));
18  case 1
19  num_fact = min(data);
20  denum_fact = std(data);
21  train_data = bsxfun(@rdivide, bsxfun(@minus, data, num_fact), denum_fact+eps);
22  case 2
23  num_fact = min(data);
24  denum_fact = max(data)- min(data);
25  train_data = bsxfun(@rdivide, bsxfun(@minus, data, num_fact), denum_fact+eps)-0.5;
26 
27  case 3
28  [train_data, num_fact,denum_fact] = zscore(data);
29  case 4
30  train_data= rank_normlize(data);
31  flag_of = false;
32  normalized_data = rank_normlize(data_to_normalize, data);
33  case 5
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);
37 
38 end
39 if ~isempty(data_to_normalize)
40  normalized_data = bsxfun(@rdivide, bsxfun(@minus, data_to_normalize, num_fact), denum_fact+eps);
41 end