skbio.stats.composition.multiplicative_replacement#

skbio.stats.composition.multiplicative_replacement(mat, delta=None)[source]#

Replace all zeros with small non-zero values.

This function is an alias for multi_replace.

Parameters:
matarray_like of shape (n_compositions, n_components)

A matrix of proportions.

deltafloat, optional

A small number to be used to replace zeros. If not specified, the default value is \(\delta = \frac{1}{N^2}\) where \(N\) is the number of components.

Returns:
ndarray of shape (n_compositions, n_components)

The matrix where all of the values are non-zero and each composition (row) adds up to 1.

Raises:
ValueError

If negative proportions are created due to a large delta.

Warning

multiplicative_replacement is deprecated as of 0.6.0 in favor of multi_replace.

See also

multi_replace