scib_metrics.silhouette_batch

scib_metrics.silhouette_batch#

scib_metrics.silhouette_batch(X, labels, batch, rescale=True, chunk_size=256)[source]#

Average silhouette width (ASW) with respect to batch ids within each label [Luecken et al., 2022].

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

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

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

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

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

Return type:

float

Returns:

silhouette score