scib.metrics.silhouette

scib.metrics.silhouette(adata, group_key, embed, metric='euclidean', scale=True)

Average silhouette width (ASW)

Wrapper for sklearn silhouette function values range from [-1, 1] with

  • 1 indicates distinct, compact clusters

  • 0 indicates overlapping clusters

  • -1 indicates core-periphery (non-cluster) structure

By default, the score is scaled between 0 and 1 (scale=True).

Parameters
  • group_key – key in adata.obs of cell labels

  • embed – embedding key in adata.obsm, default: ‘X_pca’

  • scale – default True, scale between 0 (worst) and 1 (best)