scib_metrics.silhouette_label

scib_metrics.silhouette_label#

scib_metrics.silhouette_label(X, labels, rescale=True, chunk_size=256, metric='euclidean')[source]#

Average silhouette width (ASW) [Luecken et al., 2022].

Default parameters (‘euclidean’) match scIB implementation.

Parameters:
  • X (ndarray) – Array of shape (n_cells, n_features).

  • labels (ndarray) – Array of shape (n_cells,) representing label values

  • rescale (bool (default: True)) – Scale asw into the range [0, 1].

  • chunk_size (int (default: 256)) – Size of chunks to process at a time for distance computation

  • metric (Literal['euclidean', 'cosine'] (default: 'euclidean')) – The distance metric to use. The distance function can be ‘euclidean’ (default) or ‘cosine’.

Return type:

float

Returns:

silhouette score