Mercurial > hg > camir-ismir2012
comparison toolboxes/FullBNT-1.0.7/KPMstats/standardize.m @ 0:cc4b1211e677 tip
initial commit to HG from
Changeset:
646 (e263d8a21543) added further path and more save "camirversion.m"
author | Daniel Wolff |
---|---|
date | Fri, 19 Aug 2016 13:07:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cc4b1211e677 |
---|---|
1 function [S, mu, sigma2] = standardize(M, mu, sigma2) | |
2 % function S = standardize(M, mu, sigma2) | |
3 % Make each column of M be zero mean, std 1. | |
4 % Thus each row is scaled separately. | |
5 % | |
6 % If mu, sigma2 are omitted, they are computed from M | |
7 | |
8 M = double(M); | |
9 if nargin < 2 | |
10 mu = mean(M,2); | |
11 sigma2 = std(M,0,2); | |
12 sigma2 = sigma2 + eps*(sigma2==0); | |
13 end | |
14 | |
15 [nrows ncols] = size(M); | |
16 S = M - repmat(mu(:), [1 ncols]); | |
17 S = S ./ repmat(sigma2, [1 ncols]); | |
18 |