stereo.core.StPipeline.silhouette_score

StPipeline.silhouette_score(cluster_res_key, used_pca_cluster_res_key='pca', metric='euclidean', sample_size=None, random_number=10086, use_raw=True)[source]

Calculate the mean Silhouette Coefficient for a cluster result.

Parameters:
  • cluster_res_key (str) – the key to get cluster result from cells, defaults to None.

  • used_pca_cluster_res_key (str) – the key to get pca result used for clustering, defaults to ‘pca’, if it is None, use the express matrix.

  • metric (str) – The metric to use when calculating distance between cells/bins based on exp_matrix, defaults to ‘euclidean’. It must be one of the options allowed by <sklearn.metrics.pairwise.pairwise_distances>.

  • sample_size (Optional[int]) – The size of the sample to use when computing the Silhouette Coefficient on a random subset of the data, if it is None, no sampling is used.

  • random_number (int) – random number for selecting a subset of samples, used when sample_size is not None, defaults to 10086, give fixed value in multiple calls for reproducible results.

  • use_raw (bool) – whether to use the raw express matrix when used_pca_cluster_res_key is None, default to True.