Skip to main content
`Ctrl`+`K`

# skbio.stats.composition.multiplicative_replacement

skbio.stats.composition.multiplicative_replacement(mat, delta=None)

  Replace all zeros with small non-zero values.

  This function is an alias for `multi_replace`.

  Parameters:
    mat array_like of shape (n_compositions, n_components)

      A matrix of proportions.

    delta float, 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`