Pivot logratio transform
plr_transform(df)
Perform a pivot logratio transformation on the dataframe, returning the full set of transforms.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe of shape [N, D] of compositional data. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
A dataframe of shape [N, D-1] containing the set of PLR transformed data. |
Raises:
Type | Description |
---|---|
InvalidColumnException
|
The data contains one or more zeros. |
InvalidCompositionException
|
Data is not normalized to the expected value. |
NumericValueSignException
|
Data contains zeros or negative values. |
Source code in eis_toolkit/transformations/coda/plr.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
single_plr_transform(df, column)
Perform a pivot logratio transformation on the selected column.
Pivot logratio is a special case of ILR, where the numerator in the ratio is always a single part and the denominator all of the parts to the right in the ordered list of parts.
Column order matters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe of shape [N, D] of compositional data. |
required |
column |
str
|
The name of the numerator column to use for the transformation. |
required |
Returns:
Type | Description |
---|---|
Series
|
A series of length N containing the transforms. |
Raises:
Type | Description |
---|---|
InvalidColumnException
|
The input column isn't found in the dataframe, or there are no columns to the right of the given column. |
InvalidCompositionException
|
Data is not normalized to the expected value. |
NumericValueSignException
|
Data contains zeros or negative values. |
Source code in eis_toolkit/transformations/coda/plr.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|