Elastic net regularized multi-regression (https://link.springer.com/chapter/10.1007/978-3-031-57515-0_13)
EleMi is used to infer soil ecological networks using abundance data.
EleMi can be easily installed via pip:
pip install elemi| Parameter | Type | Description |
|---|---|---|
X |
ndarray | Input abundance matrix of shape (n_samples, n_taxa). |
miu1 |
float | L1 regularization parameter controlling network sparsity. |
miu2 |
float | L2 regularization parameter controlling coefficient shrinkage. |
| Return | Type | Description |
|---|---|---|
A |
ndarray | Estimated adjacency matrix. |
Sample-wise normalization and CLR transformation.
| Parameter | Type | Description |
|---|---|---|
X |
ndarray | Input abundance matrix of shape (n_samples, n_taxa). |
pseudo |
float | Pseudocount used for zero replacement. If set to 0, 10% of the minimum non-zero abundance in each sample is used. |
pseudo_switch |
bool | Whether to perform zero replacement before normalization. |
pre_norm |
str | Pre-normalization method. Supported options are "TSS" and "CSS". |
pre_norm_switch |
bool | Whether to perform pre-normalization. |
clr_switch |
bool | Whether to apply CLR transformation. |
| Return | Type | Description |
|---|---|---|
X_normalized |
ndarray | Normalized abundance matrix after optional zero replacement, scaling, and CLR transformation. |
Column-wise normalization.
| Parameter | Type | Description |
|---|---|---|
X |
ndarray | Input matrix. |
| Return | Type | Description |
|---|---|---|
X_normalized |
ndarray | Matrix with each column normalized. |
EleMi takes as input an abundance matrix shaped like n × p where n is the number of samples and p is the number of taxa. You can find an example dataset in example_data/otu.csv.
from elemi import EleMi, row_clr, col_normalize
import pandas as pd
data = pd.read_csv("example_data/otu.csv", index_col=0)
data = data.astype(float).values
data = row_clr(data)
data = col_normalize(data)
A = EleMi(data, 0.1, 0.01)
A = (A + A.T) / 2