scib_rapids.silhouette_batch

scib_rapids.silhouette_batch#

scib_rapids.silhouette_batch(X, labels, batch, rescale=True, chunk_size=256, metric='euclidean', between_cluster_distances='nearest')[source]#

Average silhouette width (ASW) with respect to batch ids within each label.

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].

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

  • metric (Literal['euclidean', 'cosine'] (default: 'euclidean')) – ‘euclidean’ (default) or ‘cosine’.

  • between_cluster_distances (Literal['nearest', 'mean_other', 'furthest'] (default: 'nearest')) – ‘nearest’, ‘mean_other’, or ‘furthest’.

Return type:

float

Returns:

silhouette score