limix.qc.mean_standardize

limix.qc.mean_standardize(X, axis=- 1, inplace=False)[source]

Zero-mean and one-deviation normalisation.

Normalise in such a way that the mean and variance are equal to zero and one. This transformation is taken over the flattened array by default, otherwise over the specified axis. Missing values represented by NaN are ignored.

Parameters
  • X (array_like) – Array of values.

  • axis (int, optional) – Axis value. Defaults to 1.

  • inplace (bool, optional) – Defaults to False.

Returns

X – Normalized array.

Return type

ndarray

Example

>>> import limix
>>> from numpy import arange
>>>
>>> X = arange(15).reshape((5, 3)).astype(float)
>>> print(X)  
[[ 0.  1.  2.]
 [ 3.  4.  5.]
 [ 6.  7.  8.]
 [ 9. 10. 11.]
 [12. 13. 14.]]
>>> X = arange(6).reshape((2, 3)).astype(float)
>>> X = limix.qc.mean_standardize(X, axis=0)
>>> print(X)  
[[-1.22474487  0.          1.22474487]
 [-1.22474487  0.          1.22474487]]