skbio.stats.composition.centralize#
- skbio.stats.composition.centralize(mat)[source]#
Center data around its geometric average.
- Parameters:
- matarray_like of shape (n_compositions, n_components)
A matrix of proportions.
- Returns:
- ndarray of shape (n_compositions, n_components)
Centered composition matrix.
Examples
>>> import numpy as np >>> from skbio.stats.composition import centralize >>> X = np.array([[.1, .3, .4, .2], [.2, .2, .2, .4]]) >>> centralize(X) array([[ 0.17445763, 0.30216948, 0.34891526, 0.17445763], [ 0.32495488, 0.18761279, 0.16247744, 0.32495488]])