Jul 19, 2013

Standardize the data

%% standardize the data
numDsc = size(X,1);
fprintf('numDsc = %d\n',numDsc);
meanData = mean(X); % column-wise mean
meanDuplicate = meanData(ones(1,numDsc), :); % replicate
normData = X - meanDuplicate;
stdData = std(X); % column-wise std
stdData(stdData == 0) = 1; % if standard deviation is 0, set to 1 to avoid zero-denominator problems in normalization
stdDuplicate = stdData(ones(1,numDsc), :); % replicate
normData = normData ./stdDuplicate;

No comments:

Down with the Dictatorship!

    "Let them hate me, so that they fear me" - Caligula 41AD