limix.qc.mean_standardize

limix.qc.mean_standardize(X, axis=None, out=None)[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.

It works well with Dask array.

Parameters:
  • X (array_like) – Array to be normalised.
  • axis (None or int, optional) – Axis along which the normalisation will take place. The default is to normalise the flattened array.
Returns:

Normalized array.

Return type:

array_like

Examples

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