Skip to contents

[Experimental] Computes the average silhouette width on batch labels using pairwise distances in the embedding space. Values near 0 indicate good batch mixing, values near 1 indicate batch separation.

Usage

rs_batch_silhouette_width(embedding, batch_vector, max_cells, verbose, seed)

Arguments

embedding

Numeric matrix. The embedding to assess (e.g. PCA or corrected embedding). Rows are cells, columns are dimensions.

batch_vector

Integer vector. The batch per cell. The codes need not be 0-based or contiguous.

max_cells

Integer or NULL. If not NULL, subsample to this many cells for performance. If NULL, all cells are used.

verbose

Boolean. Controls verbosity of the function.

seed

Integer. Seed for subsampling reproducibility.

Value

A list with the following items

  • per_cell - Per-cell silhouette scores

  • mean_asw - Mean silhouette width

  • median_asw - Median silhouette width