Skip to main content
`Ctrl`+`K`

# skbio.stats.composition.ilr_inv

skbio.stats.composition.ilr_inv(mat, basis=None, axis=-1, validate=True)

  Perform inverse isometric log ratio (ILR) transformation.

  This function transforms compositions from the real space to Aitchison geometry. The \(ilr^{-1}\) transform is both an isometry, and an isomorphism defined on the following spaces:

  \[ilr^{-1}: \mathbb{R}^{D-1} \rightarrow S^D\]

  The inverse ilr transformation is defined as follows:

  \[ilr^{-1}(x) = \bigoplus\limits_{i=1}^{D-1} x \odot e_i\]

  where \([e_1,\ldots, e_{D-1}]\) is an orthonormal basis in the simplex.

  If an orthonormal basis isn’t specified, the J. J. Egozcue orthonormal basis derived from Gram-Schmidt orthogonalization [1] will be used by default.

  Changed in version 0.7.0: The function now works on any dimension in arrays of any number of dimensions.

  Parameters:
    mat array_like of shape (…, n_components - 1, …)

      A matrix of ILR-transformed data.

    basis ndarray or sparse matrix, optional

      Orthonormal basis for Aitchison simplex. Defaults to J. J. Egozcue orthonormal basis.

    axis int, optional

      Axis along which ILR transformation will be performed. That is, each vector along this axis is considered as a ILR transformed composition data. Default is the last axis (-1).

      Added in version 0.7.0.

    validate bool, default True

      Check to see if basis is orthonormal and dimension matches.

      Changed in version 0.7.0: Renamed from `check`. The old name is kept as an alias but is deprecated.

  Returns:
    ndarray of shape (…, n_components, …)

      Inverse ILR-transformed matrix.

  See also

  `ilr`

  Notes

  Note

  This function supports the Python array API standard. Compatible array backends:

  Backend | CPU | GPU
  --- | --- | ---
  NumPy | ✓ | n/a
  CuPy | n/a | ✓
  PyTorch | ✓ | ✓
  JAX | ✓ | ✓
  Dask | ✓ | n/a

  If the `basis` parameter is specified, it is expected to be a basis in the Aitchison simplex. If there are \(D - 1\) elements specified in `mat`, then the dimensions of the basis needs be \((D-1) \times D\), where rows represent basis vectors, and the columns represent proportions.

  References

  [1]

  Egozcue, J. J., Pawlowsky-Glahn, V., Mateu-Figueras, G., & Barcelo-Vidal, C. (2003). Isometric logratio transformations for compositional data analysis. Mathematical geology, 35(3), 279-300.

  Examples

      >>> import numpy as np
      >>> from skbio.stats.composition import ilr
      >>> x = np.array([.1, .3, .6,])
      >>> ilr_inv(x)
      array([ 0.34180297,  0.29672718,  0.22054469,  0.14092516])