FACSPy.ml.supervisedGating#
- class FACSPy.ml.supervisedGating(adata)#
Class for supervised gating. This class implements the learning of a gating strategy based on pregated samples with according prediction of ungated samples.
- Parameters:
adata (
AnnData) – The anndata object of shape n_obs x n_vars where rows correspond to cells and columns to the channels.- Return type:
A
AnnDataobject where the identified populations are stored in adata.obsm[“gating”].
Examples
>>> adata = fp.create_dataset([...]) >>> gating = fp.ml.supervisedGating(dataset) >>> gating.run_data_setup( ... gated_samples = ["1", "2", "3"], ... layer = "compensated", ... scaling = "StandardScaler" ... ) >>> gating.setup_classifier("DecisionTreeClassifier") >>> gating.tune_hyperparameters( >>> method = "HalvingRandomSearchCV", ... grid = {"max_depth": [10,20,100]} ... ) >>> gating.setup_classifier("DecisionTreeClassifier") >>> gating.train() >>> gating.gate_dataset()
Methods
Method to apply the classifier to ungated samples and gate these samples.
Returns a
AnnDataobjectrun_data_setup(gated_samples, layer[, ...])Public method to run the data setup.
sample_cells(sampler)Method to sample the cells.
setup_classifier(classifier, **kwargs)Setup method.
train()Trains the classifier.
tune_hyperparameters(method, grid, ...)Method to tune hyperparameters of the classifier.