scib.metrics.isolated_labels_asw
- scib.metrics.isolated_labels_asw(adata, label_key, batch_key, embed, iso_threshold=None, scale=True, verbose=True)
Isolated label score ASW
Score how well isolated labels are distinguished from all other labels using the average-width silhouette score (ASW)
silhouette()
.- Parameters:
adata – anndata object
label_key – column in
adata.obs
batch_key – column in
adata.obs
embed – key in
adata.obsm
used for func:~scib.metrics.silhouetteiso_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 inscale – Whether to scale the score between 0 and 1. Only relevant for ASW scores.
verbose –
- Params **kwargs:
additional arguments to be passed to
cluster_optimal_resolution()
- Returns:
Mean of ASW over all isolated labels
The function requires an embedding to be stored in
adata.obsm
and can only be applied to feature and embedding integration outputs. Please note, that the metric cannot be used to evaluate kNN graph outputs. 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=False ) scib.me.isolated_labels_asw(adata, label_key="celltype", embed="X_pca") # embedding output scib.me.isolated_labels_asw( adata, batch_key="batch", label_key="celltype", embed="X_emb" )