skbio.stats.ordination.scale#

skbio.stats.ordination.scale(a, weights=None, with_mean=True, with_std=True, ddof=0, copy=True)[source]#

Scale array by columns to have weighted average 0 and standard deviation 1.

Parameters:
aarray_like

2D array whose columns are standardized according to the weights.

weightsarray_like, optional

Array of weights associated with the columns of a. By default, the scaling is unweighted.

with_meanbool, optional, defaults to True

Center columns to have 0 weighted mean.

with_stdbool, optional, defaults to True

Scale columns to have unit weighted std.

ddofint, optional, defaults to 0

If with_std is True, variance is calculated by dividing by n - ddof (where n is the number of elements). By default it computes the maximum likelyhood stimator.

copybool, optional, defaults to True

Whether to perform the standardization in place, or return a new copy of a.

Returns:
2D ndarray

Scaled array.

Notes

Wherever std equals 0, it is replaced by 1 in order to avoid division by zero.