Skip to content

GPU estimators

Present only in a build with the gpu feature, which is the default. See GPU acceleration for what runs on the device and what does not.

UMAPGpu

UMAPGpu(
    n_components: int = 2,
    n_neighbors: int = 15,
    metric: str = "euclidean",
    min_dist: int | float = 0.5,
    spread: int | float = 1.0,
    n_epochs: int | None = None,
    learning_rate: int | float = 1.0,
    init: str = "spectral",
    ann: str = "nndescent_gpu",
    optimiser: str = "adam_gpu",
    randomised: bool = False,
    init_range: int | float | None = None,
    seed: int = 42,
    verbose: int = 0,
    nn_params: NeighbourParamsGpu | None = None,
    graph_params: UmapGraph | None = None,
    optim_params: UmapOptim | None = None,
)

Bases: BaseEmbedding

UMAP with a GPU neighbour search and a GPU Adam optimiser.

"nndescent_gpu" builds the kNN graph with NN-Descent on the device and is the default for good reason: it is the one that scales. "exhaustive_gpu" gives exact neighbours and is the honest choice for ground truth, at quadratic cost. "pipnn_gpu" builds a PiPNN graph on the CPU and beam-searches it on the device.

Parameters:

Name Type Description Default
n_components int

Output dimensionality.

2
n_neighbors int

Neighbours per point.

15
metric str

"euclidean"/"l2" or "cosine".

'euclidean'
min_dist int | float

How tightly points may pack. Fits the repulsion curve with spread.

0.5
spread int | float

Scale of the embedding relative to min_dist.

1.0
n_epochs int | None

Optimisation epochs. None means 500, or 200 for the SGD optimisers above 10,000 samples, as umap-learn does.

None
learning_rate int | float

Initial learning rate.

1.0
init str

"spectral", "pca", "random" or "recursive" (the umap-learn 0.6 initialisation). Computed on the CPU either way.

'spectral'
ann str

"nndescent_gpu", "ivf_gpu", "pipnn_gpu" or "exhaustive_gpu".

'nndescent_gpu'
optimiser str

"adam_gpu" keeps the update on the device, as does "adam_v06_gpu" (the umap-learn 0.6 Adam). The CPU names ("adam_parallel", "adam", "adam_v06", "sgd", "sgd_parallel") still work and run the optimisation on the CPU after the GPU neighbour search. An mlx build adds "adam_mlx" and "adam_v06_mlx" (search on wgpu, optimiser on MLX).

'adam_gpu'
randomised bool

Use randomised SVD for the PCA initialisation.

False
init_range int | float | None

Scale of the initial coordinates.

None
seed int

Fixes the initialisation and the negative sampling.

42
verbose int

0 quiet, 1 normal, 2 detailed.

0
nn_params NeighbourParamsGpu | None

See NeighbourParamsGpu.

None
graph_params UmapGraph | None

See UmapGraph.

None
optim_params UmapOptim | None

See UmapOptim.

None

DensMAPGpu

DensMAPGpu(
    n_components: int = 2,
    n_neighbors: int = 15,
    metric: str = "euclidean",
    min_dist: int | float = 0.5,
    spread: int | float = 1.0,
    lambda_: int | float = 2.0,
    n_epochs: int | None = None,
    learning_rate: int | float = 1.0,
    init: str = "spectral",
    ann: str = "nndescent_gpu",
    optimiser: str = "adam_gpu",
    randomised: bool = False,
    init_range: int | float | None = None,
    seed: int = 42,
    verbose: int = 0,
    nn_params: NeighbourParamsGpu | None = None,
    graph_params: UmapGraph | None = None,
    optim_params: UmapOptim | None = None,
    dens_params: DensParams | None = None,
)

Bases: UMAPGpu

densMAP on the GPU.

With the default "adam_gpu" optimiser the density term runs on the device alongside the rest of the update.

Parameters:

Name Type Description Default
lambda_ int | float

Weight on the density term. 0 recovers plain UMAP.

2.0
dens_params DensParams | None

Remaining density knobs. See DensParams.

None

Everything else is as UMAPGpu, bar the "adam_v06" optimisers: the umap-learn 0.6 Adam has no density term.

TSNEGpu

TSNEGpu(
    n_components: int = 2,
    perplexity: int | float = 30.0,
    metric: str = "euclidean",
    n_epochs: int = 1000,
    learning_rate: int | float | None = None,
    init: str = "pca",
    ann: str = "ivf_gpu",
    approx: str = "barnes_hut",
    randomised: bool = True,
    init_range: int | float | None = None,
    seed: int = 42,
    verbose: int = 0,
    nn_params: NeighbourParamsGpu | None = None,
    optim_params: TsneOptim | None = None,
)

Bases: BaseEmbedding

t-SNE with a GPU neighbour search and, optionally, a GPU optimiser.

With approx="barnes_hut" only the search moves to the device and the repulsion stays on the CPU. approx="fft_3k_gpu" runs the whole optimisation on the device as well: FFT-interpolated repulsion with three kernels, the embedding resident on the GPU throughout.

The search defaults to "ivf_gpu" rather than "nndescent_gpu": t-SNE asks for 3 * perplexity neighbours, and IVF holds up better at that k.

Parameters:

Name Type Description Default
n_components int

Output dimensionality. Must be 2.

2
perplexity int | float

Effective neighbourhood size.

30.0
metric str

"euclidean"/"l2" or "cosine".

'euclidean'
n_epochs int

Optimisation epochs.

1000
learning_rate int | float | None

None applies the max(N / 12, 200) heuristic.

None
init str

"pca", "spectral" or "random".

'pca'
ann str

"nndescent_gpu", "ivf_gpu", "pipnn_gpu" or "exhaustive_gpu".

'ivf_gpu'
approx str

"barnes_hut", "qd", "fft" or "fft_3k" (CPU optimisers, see TSNE), or "fft_3k_gpu" (GPU optimiser).

'barnes_hut'
randomised bool

Use randomised SVD for the PCA initialisation.

True
init_range int | float | None

Scale of the initial coordinates.

None
seed int

Fixes the initialisation.

42
verbose int

0 quiet, 1 normal, 2 detailed.

0
nn_params NeighbourParamsGpu | None

See NeighbourParamsGpu.

None
optim_params TsneOptim | None

See TsneOptim.

None

DREAMSGpu

DREAMSGpu(
    n_components: int = 2,
    perplexity: int | float = 30.0,
    metric: str = "euclidean",
    lambda_: int | float = 0.15,
    n_epochs: int = 1000,
    learning_rate: int | float | None = None,
    init: str = "pca",
    ann: str = "ivf_gpu",
    approx: str = "barnes_hut",
    randomised: bool = True,
    init_range: int | float | None = None,
    seed: int = 42,
    verbose: int = 0,
    nn_params: NeighbourParamsGpu | None = None,
    optim_params: TsneOptim | None = None,
)

Bases: ReferenceEmbedding

DREAMS with a GPU neighbour search and, optionally, a GPU optimiser.

t-SNE regularised towards a global reference embedding, as DREAMS, with the device split of TSNEGpu. approx="fft_3k_gpu" runs the whole optimisation on the device.

Parameters:

Name Type Description Default
lambda_ int | float

Regularisation strength, in [0, 1].

0.15
init str

Ignored; accepted so the signature matches TSNEGpu.

'pca'

Everything else is as TSNEGpu. The reference is passed to fit, see fit.

PHATEGpu

PHATEGpu(
    n_components: int = 2,
    k: int = 5,
    metric: str = "euclidean",
    decay: int | float | None = 40.0,
    t: int | None = None,
    gamma: int | float = 1.0,
    n_landmarks: int | None = 2048,
    landmark_method: str = "spectral",
    mds: str = "sgd_dense",
    mds_iter: int | None = None,
    ann: str = "nndescent_gpu",
    randomised: bool = True,
    seed: int = 42,
    verbose: int = 0,
    nn_params: NeighbourParamsGpu | None = None,
    diffusion_params: PhateDiffusion | None = None,
)

Bases: BaseEmbedding

PHATE with the neighbour search and landmark selection on the GPU.

Same embedding as PHATE. The kNN search and, for spectral landmarks, the randomised SVD and the k-means run on the device. The diffusion time, the powering, the MDS and the interpolation stay on the CPU.

Parameters:

Name Type Description Default
n_components int

Output dimensionality.

2
k int

Neighbours that set the kernel bandwidth. The search runs 6k + 5 wide, so give a precomputed graph that width as well.

5
metric str

"euclidean"/"l2" or "cosine".

'euclidean'
decay int | float | None

Alpha-decay exponent of the kernel. None gives a binary connectivity kernel instead.

40.0
t int | None

Diffusion time. None picks the VNE knee.

None
gamma int | float

Informational distance constant, in [-1, 1].

1.0
n_landmarks int | None

Landmarks to diffuse on. None, or a value at least n_samples, runs the full operator, whose dense potential distances grow with the square of n_samples.

2048
landmark_method str

"spectral", "random" or "density". An mlx build adds "spectral_mlx", which keeps the search on wgpu and runs the landmark selection on MLX.

'spectral'
mds str

"sgd_dense" (also "dense") or "classic".

'sgd_dense'
mds_iter int | None

MDS iterations. None uses the backend default.

None
ann str

"nndescent_gpu", "ivf_gpu", "pipnn_gpu" or "exhaustive_gpu".

'nndescent_gpu'
randomised bool

Use randomised SVD for the initialisation.

True
seed int

Fixes the sketch, the k-means initialisation and the MDS.

42
verbose int

0 quiet, 1 normal, 2 detailed.

0
nn_params NeighbourParamsGpu | None

See NeighbourParamsGpu.

None
diffusion_params PhateDiffusion | None

Remaining operator knobs. See PhateDiffusion.

None