Gives the same widths as cluster::silhouette() with Euclidean distances from dist(), but never stores the cells x cells distance matrix: the distances from a block of cells to all cells are computed, summed by cluster for every clustering, and discarded. Memory grows linearly with the number of cells.

.mean_silhouette_widths(X, clusterings)

Arguments

X

Matrix, cells x dimensions.

clusterings

List of cluster label vectors, one per clustering.

Value

Numeric vector of mean silhouette widths, NA for a clustering with one cluster or with as many clusters as cells.