rapids_singlecell.tl.umap#
- rapids_singlecell.tl.umap(adata, *, min_dist=0.5, spread=1.0, n_components=2, maxiter=None, alpha=1.0, negative_sample_rate=5, init_pos='auto', rng=None, a=None, b=None, use=None, rep=None, out=False, key_added=None, neighbors_key=None, copy=False)[source]#
Embed the neighborhood graph using UMAP [MHM18] [NLR+21].
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 rapids-singlecell 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.
- Parameters:
- adata
AnnData Annotated data matrix.
- min_dist
float(default:0.5) The effective minimum distance between embedded points. Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even dispersal of points. The value should be set relative to the
spreadvalue, which determines the scale at which embedded points will be spread out.- spread
float(default:1.0) The effective scale of embedded points. In combination with
min_distthis determines how clustered/clumped the embedded points are.- n_components
int(default:2) The number of dimensions of the embedding.
- maxiter
int|None(default:None) The number of iterations (epochs) of the optimization. Called
n_epochsin the original UMAP. Defaults to 500 for up to 10,000 cells, else 200.- alpha
float(default:1.0) The initial learning rate for the embedding optimization.
- negative_sample_rate
int(default:5) The number of negative edge/1-simplex samples to use per positive edge/1-simplex sample in optimizing the low dimensional embedding.
- init_pos
Literal['auto','spectral','random','paga'] |ndarray|ndarray|str|None(default:'auto') How to initialize the low dimensional embedding. Called
initin the original UMAP. Options are:Note
If your embedding looks odd it’s recommended setting
init_posto ‘random’.- rng
int|integer|Sequence[int] |SeedSequence|Generator|BitGenerator|None(default:None) Random seed or
Generatorused by the random number generator. The supersededrandom_stateargument is still accepted.rng=Noneruns unseeded, which is faster but not reproducible.- a
float|None(default:None) More specific parameters controlling the embedding. If
Nonethese values are set automatically as determined bymin_distandspread.- b
float|None(default:None) More specific parameters controlling the embedding. If
Nonethese values are set automatically as determined bymin_distandspread.- use
GraphAcc|str|None(default:None) The neighborhood graph (connectivities) to embed, e.g.
A.obsp['k']afterrsc.pp.neighbors(adata, out=A.obsp['k']). Strings are resolved byanndata.acc.AdAcc.resolve(), e.g.'obsp.k'. IfNone, the oneneighbors()wrote by default.- rep
MultiAcc|str|None(default:None) Accepted for compatibility with
scanpy.tl.umap(), which lays out the graph’s connected components with it. cuML lays them out from the graph alone, so it is not read.- out
MultiAcc|str|bool(default:False) Where to write the embedding, e.g.
A.obsm['umap2']; the parameters go to.unsunder the same key. IfTrue, the embedding is returned instead. IfFalse, it is written to.obsm['X_umap']and.uns['umap']('umap'for both ifrapids_singlecell.settings.presetisscanpy-v2-preview).
- adata
- Return type:
- Returns:
The embedding if
out=True, elseNone. By default sets (seeoutfor other keys):