3 %>@brief Checks whether the columns of X have mean zero and variance 1 up to a certain tolerance.
5 %> For instance,
if tolerance is 0.02, -0.02 <= mean <= 0.02, and 0.98 <= variance <= 1.02 will be accepted.
7 %> @param X Input matrix
8 %> @param tolerance =0.001 Tolerance
9 %> @
return Nothing. If fails, wil generate an error.
11 if nargin < 2 || isempty(tolerance)
15 [v, i] = max(abs(vv-1)); % Maximum absolute deviation around 1
17 irerror(sprintf('Invalid variable variance! Expecting: 1; found: %g', vv(i)));
20 mm = max(abs(mean(X)));
23 irerror(sprintf('Invalid variable mean! Expecting: 0; found: %g', mm));
function assert_standardized(in X, in tolerance)