mushi.composition.centralize

centralize(mat)[source]

Center data around its geometric average.

Parameters

mat (array_like, float) – a matrix of proportions where rows = compositions and columns = components

Returns

centered composition matrix

Return type

numpy.ndarray

Examples

>>> import numpy as np
>>> import mushi.composition as cmp
>>> X = np.array([[.1,.3,.4, .2],[.2,.2,.2,.4]])
>>> cmp.centralize(X)
DeviceArray([[0.17445763, 0.30216948, 0.34891526, 0.17445763],
             [0.32495488, 0.18761279, 0.16247744, 0.32495488]],            dtype=float64)