stlearn.em.run_umap

stlearn.em.run_umap(adata: AnnData, min_dist: float = 0.5, spread: float = 1.0, n_components: int = 2, maxiter: Optional[int] = None, alpha: float = 1.0, gamma: float = 1.0, negative_sample_rate: int = 5, init_pos: Optional[Union[Literal['paga', 'spectral', 'random'], ndarray]] = 'spectral', random_state: Optional[Union[int, RandomState]] = 0, a: Optional[float] = None, b: Optional[float] = None, copy: bool = False, method: Literal['umap', 'rapids'] = 'umap') Optional[AnnData][source]

Wrap function scanpy.pp.umap Embed the neighborhood graph using UMAP [McInnes18]. UMAP (Uniform Manifold Approximation and Projection) is a manifold learning technique suitable for visualizing high-dimensional data. Besides tending to be faster than tSNE, it optimizes the embedding such that it best reflects the topology of the data, which we represent throughout Scanpy using a neighborhood graph. tSNE, by contrast, optimizes the distribution of nearest-neighbor distances in the embedding such that these best match the distribution of distances in the high-dimensional space. We use the implementation of umap-learn [McInnes18]. For a few comparisons of UMAP with tSNE, see this preprint. :param adata: Annotated data matrix. :param n_components: The number of dimensions of the embedding. :param random_state: If int, random_state is the seed used by the random number generator;

If RandomState, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

Returns:

  • Depending on copy, returns or updates adata with the following fields.

  • `X_umap` (numpy.ndarray (adata.obsm)) – Independent Component Analysis representation of data.