mushi.composition.power
- power(x, a)[source]
Performs the power operation.
This operation is defined as follows
\[`x \odot a = C[x_1^a, \ldots, x_D^a]\]\(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
- Returns
A matrix of proportions where all of the values are nonzero and each composition (row) adds up to 1
- Return type
numpy.ndarray, np.float64
Examples
>>> import numpy as np >>> import mushi.composition as cmp >>> x = np.array([.1,.3,.4, .2]) >>> cmp.power(x, .1) DeviceArray([0.23059566, 0.25737316, 0.26488486, 0.24714631], dtype=float64)