scib_metrics.utils.diffusion_nn

Contents

scib_metrics.utils.diffusion_nn#

scib_metrics.utils.diffusion_nn(X, k, n_comps=100)[source]#

Diffusion-based neighbors.

This function generates a nearest neighbour list from a connectivities matrix. This allows us to select a consistent number of nearest neighbors across all methods.

This differs from the original scIB implemenation by leveraging diffusion maps. Here we embed the data with diffusion maps in which euclidean distance represents well the diffusion distance. We then use pynndescent to find the nearest neighbours in this embedding space.

Parameters:
  • X (csr_matrix) – Array of shape (n_cells, n_cells) with non-zero values representing connectivities.

  • k (int) – Number of nearest neighbours to select.

  • n_comps (int (default: 100)) – Number of components for diffusion map

Return type:

NeighborsResults

Returns:

Neighbors results