grassp.tl.tagm_map_train#
- tagm_map_train(adata, gt_col='markers', method='MAP', numIter=100, mu0=None, lambda0=0.01, nu0=None, S0=None, beta0=None, u=2, v=10, seed=None, inplace=True)[source]#
 Train a TAGM-MAP (T-Augmented Gaussian Mixture, MAP variant) model.
The training procedure follows Crook et al. 2018 and estimates component parameters for known marker classes while accommodating an outlier component modelled by a multivariate t distribution.
Workflow#
Split observations into labelled (markers) and unlabelled according to
adata.obs[gt_col].Compute empirical hyper-priors if not supplied.
Run an EM algorithm to obtain maximum-a-posteriori (MAP) estimates of component means, covariances and mixing proportions.
Store the fitted parameters in
adata.uns['tagm.map.params']wheninplaceisTrue.
- type adata:
 - param adata:
 anndata.AnnDatawith proteins as observations and fractions as variables.- type gt_col:
 str(default:'markers')- param gt_col:
 Column name identifying marker proteins (default
"markers").- type method:
 str(default:'MAP')- param method:
 Currently only
"MAP"is implemented; reserved for future.- type numIter:
 int(default:100)- param numIter:
 EM iterations (default
100).- type mu0:
 - param mu0:
 Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If
Nonesensible empirical defaults are inferred.- type lambda0:
 float(default:0.01)- param lambda0:
 Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If
Nonesensible empirical defaults are inferred.- type nu0:
 - param nu0:
 Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If
Nonesensible empirical defaults are inferred.- type S0:
 - param S0:
 Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If
Nonesensible empirical defaults are inferred.- type beta0:
 - param beta0:
 Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If
Nonesensible empirical defaults are inferred.- type u:
 int(default:2)- param u:
 Beta prior parameters for the outlier mixing proportion.
- type v:
 int(default:10)- param v:
 Beta prior parameters for the outlier mixing proportion.
- type seed:
 - param seed:
 Random seed for reproducibility.
- type inplace:
 bool(default:True)- param inplace:
 If
True(default) write parameters toadataand returnNone; otherwise return the parameter dictionary.- rtype:
 - returns:
 MAP parameter dictionary when
inplaceisFalse.