scib.metrics.isolated_labels_f1
- scib.metrics.isolated_labels_f1(adata, label_key, batch_key, embed, iso_threshold=None, verbose=True)
Isolated label score F1
Score how well isolated labels are distinguished from other labels by data-driven clustering. The F1 score is used to evaluate clustering with respect to the ground truth labels.
- Parameters
adata – anndata object
label_key – column in
adata.obs
batch_key – column in
adata.obs
embed – key in adata.obsm used for as representation for kNN graph computation. If
embed=None
, use the existing kNN graph inadata.uns['neighbors']
.iso_threshold – max number of batches per label for label to be considered as isolated, if iso_threshold is integer. If
iso_threshold=None
, consider minimum number of batches that labels are present inverbose –
- Returns
Mean of F1 scores over all isolated labels
This function performs clustering on a kNN graph and can be applied to all integration output types. For this metric the
adata
needs a kNN graph. See User Guide for more information on preprocessing.Examples
# full feature output scib.pp.reduce_data( adata, n_top_genes=2000, batch_key="batch", pca=True, neighbors=True ) scib.me.isolated_labels_f1(adata, label_key="celltype") # embedding output sc.pp.neighbors(adata, use_rep="X_emb") scib.me.isolated_labels_f1(adata, batch_key="batch", label_key="celltype") # knn output scib.me.isolated_labels_f1(adata, batch_key="batch", label_key="celltype")