scib_metrics.utils.compute_simpson_index

scib_metrics.utils.compute_simpson_index#

scib_metrics.utils.compute_simpson_index(knn_dists, knn_idx, row_idx, labels, n_labels, perplexity=30, tol=1e-05)[source]#

Compute the Simpson index for each cell.

Parameters:
  • knn_dists (Union[ndarray, Array]) – KNN distances of size (n_cells, n_neighbors).

  • knn_idx (Union[ndarray, Array]) – KNN indices of size (n_cells, n_neighbors) corresponding to distances.

  • row_idx (Union[ndarray, Array]) – Idx of each row (n_cells, 1).

  • labels (Union[ndarray, Array]) – Cell labels of size (n_cells,).

  • n_labels (int) – Number of labels.

  • perplexity (float (default: 30)) – Measure of the effective number of neighbors.

  • tol (float (default: 1e-05)) – Tolerance for binary search.

Return type:

ndarray

Returns:

simpson_index Simpson index of size (n_cells,).