mushi.composition.ilr

ilr(mat, basis=None, check=True)[source]

Performs isometric log ratio transformation.

This function transforms compositions from Aitchison simplex to the real space. The :math: ilr` transform is both an isometry, and an isomorphism defined on the following spaces

\(ilr: S^D \rightarrow \mathbb{R}^{D-1}\)

The ilr transformation is defined as follows

\[ilr(x) = [\langle x, e_1 \rangle_a, \ldots, \langle x, e_{D-1} \rangle_a]\]

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

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

Parameters
  • mat (numpy.ndarray) – a matrix of proportions where rows = compositions and columns = components

  • basis (numpy.ndarray, float, optional) – orthonormal basis for Aitchison simplex defaults to J.J.Egozcue orthonormal basis

Examples

>>> import numpy as np
>>> import mushi.composition as cmp
>>> x = np.array([.1, .3, .4, .2])
>>> cmp.ilr(x)
DeviceArray([-0.7768362 , -0.68339802,  0.11704769], dtype=float64)