# skbio.stats.composition.perturb

`skbio.stats.composition.``perturb`(x, y)

  State: Experimental as of 0.4.0. Performs the perturbation operation.

  This operation is defined as

  \[x \oplus y = C[x_1 y_1, \ldots, x_D y_D]\]

  \(C[x]\) is the closure operation defined as

  \[C[x] = \left[\frac{x_1}{\sum_{i=1}^{D} x_i},\ldots, \frac{x_D}{\sum_{i=1}^{D} x_i} \right]\]

  for some \(D\) dimensional real vector \(x\) and \(D\) is the number of components for every composition.

  Parameters:

  x : array_like, float

  > a matrix of proportions where rows = compositions and columns = components

  y : array_like, float

  > a matrix of proportions where rows = compositions and columns = components

  Returns:

  numpy.ndarray, np.float64

  > A matrix of proportions where all of the values are nonzero and each composition (row) adds up to 1

  Examples

      >>> import numpy as np
      >>> from skbio.stats.composition import perturb
      >>> x = np.array([.1,.3,.4, .2])
      >>> y = np.array([1./6,1./6,1./3,1./3])
      >>> perturb(x,y)
      array([ 0.0625,  0.1875,  0.5   ,  0.25  ])