tasccoda.tree_agg_model_sslasso.TreeModelSSLasso¶
-
class
tasccoda.tree_agg_model_sslasso.TreeModelSSLasso(node_names, reference_nodes, A, T, reg='scaled_3', pen_args={'lambda': 5}, *args, **kwargs)¶ Statistical model for tree-aggregated differential composition analysis (tascCODA, Ostner et al., 2021).
The hierarchical formulation of the model for one sample is:
\[\begin{split}\begin{align*} Y_i &\sim \textrm{DirMult}(\bar{Y}_i, \textbf{a}(\textbf{x})_i)\\ \log(\textbf{a}(X))_i &= \alpha + X_{i, \cdot} \beta\\ \alpha_j &\sim \mathcal{N}(0, 10) & \forall j\in[p]\\ \beta &= \hat{\beta} A^T \\ \hat{\beta}_{l, k} &= 0 & \forall k \in \hat{v}, l \in [d]\\ \hat{\beta}_{l, k} &= \theta \tilde{\beta}_{1, l, k} + (1- \theta) \tilde{\beta}_{0, l, k} \quad & \forall k\in\{[v] \smallsetminus \hat{v}\}, l \in [d]\\ \tilde{\beta}_{m, l, k} &= \sigma_{m, l, k} * b_{m, l, k} \quad & \forall k\in\{[v] \smallsetminus \hat{v}\}, m \in \{0, 1\}, l \in [d]\\ \sigma_{m, l, k} &\sim \textrm{Exp}(\lambda_{m, l, k}^2/2) \quad & \forall k\in\{[v] \smallsetminus \hat{v}\}, l \in \{0, 1\}, l \in [d]\\ b_{m, l, k} &\sim N(0,1) \quad & \forall k\in\{[v] \smallsetminus \hat{v}\}, l \in \{0, 1\}, l \in [d]\\ \theta &\sim \textrm{Beta}(1, \frac{1}{|\{[v] \smallsetminus \hat{v}\}|}) \end{align*}\end{split}\]with Y being the cell counts, X the covariates, and v the set of nodes of the underlying tree structure.
For further information, see
tascCODA: Bayesian Tree-Aggregated Analysis of Compositional Amplicon and Single-Cell Data(Ostner et al., 2021)Methods
get_chains_after_burnin(samples, …[, is_nuts])Application of burn-in after MCMC sampling.
get_y_hat(states_burnin, num_results, num_burnin)Calculate posterior mode of cell counts (for analysis purposes) and add intermediate parameters that are no priors to MCMC results.
make_result(states_burnin, sample_stats, …)Result object generating function.
sample_hmc([num_results, num_burnin, …])Hamiltonian Monte Carlo (HMC) sampling in tensorflow 2.
sample_hmc_da([num_results, num_burnin, …])HMC sampling with dual-averaging step size adaptation (Nesterov, 2009)
sample_nuts([num_results, num_burnin, …])HMC with No-U-turn (NUTS) sampling.
sampling(num_results, num_burnin, kernel, …)MCMC sampling process (tensorflow 2)