scib_metrics.bras#
- scib_metrics.bras(X, labels, batch, chunk_size=256, metric='cosine', between_cluster_distances='mean_other')[source]#
Batch removal adapted silhouette (BRAS) for single-cell data integration assessment [Rautenstrauch and Ohler, 2025].
BRAS evaluates batch effect removal with respect to batch ids within each label (cell type cluster), using a modified silhouette score that accounts for nested batch effects. Unlike standard silhouette, BRAS computes between-cluster distances using the
between_cluster_distancesmethod rather than nearest-cluster approach. A higher scores indicates better batch mixing.- Parameters:
X (
ndarray) – Array of shape (n_cells, n_features).labels (
ndarray) – Array of shape (n_cells,) representing label valuesbatch (
ndarray) – Array of shape (n_cells,) representing batch valuesrescale – 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.metric (
Literal['euclidean','cosine'] (default:'cosine')) – The distance metric to use. The distance function can be ‘euclidean’ (default) or ‘cosine’.between_cluster_distances (
Literal['mean_other','furthest'] (default:'mean_other')) – Method for computing inter-cluster distances. - ‘mean_other’: Mean distance to all cells in other clusters (default) - ‘furthest’: Distance to furthest cluster (conservative estimate)
- Return type:
- Returns:
BRAS score