grassp.tl.tagm_map_train

Contents

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#

  1. Split observations into labelled (markers) and unlabelled according to adata.obs[gt_col].

  2. Compute empirical hyper-priors if not supplied.

  3. Run an EM algorithm to obtain maximum-a-posteriori (MAP) estimates of component means, covariances and mixing proportions.

  4. Store the fitted parameters in adata.uns['tagm.map.params'] when inplace is True.

type adata:

AnnData

param adata:

anndata.AnnData with 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:

ndarray | None (default: None)

param mu0:

Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If None sensible empirical defaults are inferred.

type lambda0:

float (default: 0.01)

param lambda0:

Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If None sensible empirical defaults are inferred.

type nu0:

int | None (default: None)

param nu0:

Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If None sensible empirical defaults are inferred.

type S0:

ndarray | None (default: None)

param S0:

Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If None sensible empirical defaults are inferred.

type beta0:

ndarray | None (default: None)

param beta0:

Hyper-parameters of the Normal–Inverse-Wishart–Dirichlet prior. If None sensible 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:

int | None (default: None)

param seed:

Random seed for reproducibility.

type inplace:

bool (default: True)

param inplace:

If True (default) write parameters to adata and return None; otherwise return the parameter dictionary.

rtype:

dict | None

returns:

MAP parameter dictionary when inplace is False.

Parameters:
adata AnnData

gt_col str

method str

numIter int

mu0 ndarray | None

lambda0 float

nu0 int | None

S0 ndarray | None

beta0 ndarray | None

u int

v int

seed int | None

inplace bool

Return type:

dict | None