Skip to content

Parameter groups

The escape hatch for every knob that is not a constructor argument. A field left at None is not sent, and the crate's default applies.

NeighbourParams dataclass

NeighbourParams(
    n_tree: int | None = None,
    search_budget: int | None = None,
    m: int | None = None,
    ef_construction: int | None = None,
    ef_search: int | None = None,
    delta: int | float | None = None,
    nnd_n_trees: int | None = None,
    bt_budget: int | float | None = None,
    n_list: int | None = None,
    n_probes: int | None = None,
    k_means: str | None = None,
    pipnn_r: int | None = None,
    pipnn_ef_search: int | None = None,
)

Backend-specific knobs for the CPU neighbour search.

Only the fields belonging to the backend you chose have any effect; the rest are ignored by the core. metric is not here because it is a constructor argument on every estimator.

Attributes:

Name Type Description
n_tree int | None

Annoy. Trees in the forest. More means better recall and a slower build.

search_budget int | None

Annoy. Candidates inspected per query. None gives k * n_tree * 20.

m int | None

HNSW. Edges per node on the upper layers, 2 * m on layer 0.

ef_construction int | None

HNSW. Candidate list width during the build.

ef_search int | None

HNSW. Beam width at query time, the recall knob.

delta int | float | None

NN-Descent and rinnd. Convergence threshold, as a fraction of neighbours updated in an iteration.

nnd_n_trees int | None

NN-Descent and rinnd. Random projection trees seeding the graph. None gives 5 + sqrt(n) / 20, capped at 64, for "nndescent" (the umap-learn / scanpy rule) and clamp(round(2 * log10(n)), 3, 12) for "rinnd".

bt_budget int | float | None

Ball tree. Fraction of the dataset to visit per query.

n_list int | None

IVF. Voronoi cells. None gives sqrt(n).

n_probes int | None

IVF. Cells visited per query. None gives sqrt(n_list).

k_means str | None

IVF and KmKNN. k-means training the centroids, "emeans" or "lloyd". None gives e-means.

pipnn_r int | None

PiPNN. Maximum out-degree of the graph. None gives 32.

pipnn_ef_search int | None

PiPNN. Beam width of the self-query, the recall knob. None gives 64.

NeighbourParamsGpu dataclass

NeighbourParamsGpu(
    n_list: int | None = None,
    n_probes: int | None = None,
    k_means: str | None = None,
    k_build: int | None = None,
    n_tree: int | None = None,
    delta: int | float | None = None,
    rho: int | float | None = None,
    pipnn_r: int | None = None,
    beam_width: int | None = None,
)

Backend-specific knobs for the GPU neighbour search.

A different set from NeighbourParams, not a subset: the device NN-Descent has its own working degree and sampling knobs.

Attributes:

Name Type Description
n_list int | None

IVF-GPU. Voronoi cells. None gives sqrt(n).

n_probes int | None

IVF-GPU. Cells visited per query.

k_means str | None

IVF-GPU. k-means training the centroids, "emeans" or "lloyd". None gives e-means.

k_build int | None

NN-Descent-GPU. Working degree of the descent. None gives 1.5 * k.

n_tree int | None

NN-Descent-GPU. Trees used to seed the graph.

delta int | float | None

NN-Descent-GPU. Convergence threshold.

rho int | float | None

NN-Descent-GPU. Sampling rate per iteration.

pipnn_r int | None

PiPNN. Maximum out-degree of the graph, built on the CPU. None gives 32.

beam_width int | None

PiPNN. Beam width of the device search, the recall knob. None picks it from k.

UmapGraph dataclass

UmapGraph(
    bandwidth: int | float | None = None,
    local_connectivity: int | float | None = None,
    mix_weight: int | float | None = None,
)

Fuzzy simplicial set construction.

Attributes:

Name Type Description
bandwidth int | float | None

Convergence tolerance for the smooth-kNN binary search that finds each point's sigma.

local_connectivity int | float | None

Neighbours assumed to sit at distance zero. Raising it makes the local neighbourhood denser and the embedding tighter.

mix_weight int | float | None

Balance between the fuzzy union and the directed graph during symmetrisation. 1.0 is the plain union.

UmapOptim dataclass

UmapOptim(
    a: int | float | None = None,
    b: int | float | None = None,
    gamma: int | float | None = None,
    neg_sample_rate: int | None = None,
    beta1: int | float | None = None,
    beta2: int | float | None = None,
    eps: int | float | None = None,
)

UMAP optimiser knobs beyond the epochs and learning rate.

Attributes:

Name Type Description
a int | float | None

Repulsion curve numerator. Fitted from min_dist and spread unless you set it, and setting one of a / b without the other is rarely what you want.

b int | float | None

Repulsion curve exponent. See a.

gamma int | float | None

Weight on the repulsive term.

neg_sample_rate int | None

Negative samples drawn per positive edge.

beta1 int | float | None

Adam first-moment decay. The crate uses 0.5 for UMAP rather than the usual 0.9. Ignored by "adam_v06" / "adam_v06_gpu", which keep umap-learn's constants.

beta2 int | float | None

Adam second-moment decay. Ignored by the 0.6 Adam, as beta1.

eps int | float | None

Adam denominator epsilon. Ignored by the 0.6 Adam, as beta1.

TsneOptim dataclass

TsneOptim(
    early_exag_iter: int | None = None,
    early_exag_factor: int | float | None = None,
    late_exag_factor: int | float | None = None,
    theta: int | float | None = None,
    n_interp_points: int | None = None,
    max_depth: int | None = None,
)

t-SNE optimiser knobs beyond the epochs and learning rate.

Attributes:

Name Type Description
early_exag_iter int | None

Iterations of early exaggeration.

early_exag_factor int | float | None

Multiplier on the affinities during those iterations.

late_exag_factor int | float | None

Multiplier for the remaining iterations. None disables it. Above roughly 100k points a value near 4 keeps cluster structure from dispersing once early exaggeration ends.

theta int | float | None

Barnes-Hut opening angle. Larger is faster and coarser; 0 makes it exact and very slow.

n_interp_points int | None

Interpolation points per box on the FFT path. No effect under Barnes-Hut.

max_depth int | None

Tree depth cap for approx="qd". Smaller is faster and coarser; qdtsne recommends 7 to 10. No effect on the other optimisers.

PacmapOptim dataclass

PacmapOptim(
    beta1: int | float | None = None,
    beta2: int | float | None = None,
    eps: int | float | None = None,
    phase1_end: int | None = None,
    phase2_end: int | None = None,
)

PaCMAP and LocalMAP optimiser knobs beyond the epochs and learning rate.

The three phases are what PaCMAP does instead of early exaggeration: the mid-near weight starts high, decays across phase 1, holds low through phase 2, and phase 3 is near pairs and repulsion alone.

Attributes:

Name Type Description
beta1 int | float | None

Adam first-moment decay.

beta2 int | float | None

Adam second-moment decay.

eps int | float | None

Adam denominator epsilon.

phase1_end int | None

Last epoch of the mid-near dominant phase.

phase2_end int | None

Last epoch of the decay phase.

Fa2Optim dataclass

Fa2Optim(
    strong_gravity: bool | None = None,
    dissuade_hubs: bool | None = None,
    edge_weight_influence: int | float | None = None,
    jitter_tolerance: int | float | None = None,
    theta: int | float | None = None,
)

ForceAtlas2 knobs beyond the epochs, scaling ratio, gravity and LinLog.

Defaults follow Gephi.

Attributes:

Name Type Description
strong_gravity bool | None

Distance-independent gravity, scaled by the scaling ratio. Pulls the periphery in much harder than the linear default.

dissuade_hubs bool | None

Divide attraction by node mass, pushing hubs to the periphery.

edge_weight_influence int | float | None

Exponent applied to the edge weights. 0 ignores the weights.

jitter_tolerance int | float | None

Tolerated swinging. Larger is faster and less precise.

theta int | float | None

Barnes-Hut opening parameter on Gephi's scale. Larger is faster and coarser; 0 makes the repulsion exact and very slow.

NcvisOptim dataclass

NcvisOptim(
    a: int | float | None = None,
    b: int | float | None = None,
    lr_q: int | float | None = None,
)

NCVis optimiser knobs beyond the epochs, negatives and learning rate.

Attributes:

Name Type Description
a int | float | None

Kernel numerator of q(d) = 1 / (1 + a d^(2b)). Fitted from min_dist and spread unless you set it. a = b = 1 is the Cauchy kernel, which skips a powf per sample.

b int | float | None

Kernel exponent. See a.

lr_q int | float | None

Step size of the learned log normalisation constant.

DensParams dataclass

DensParams(
    frac: int | float | None = None,
    var_shift: int | float | None = None,
)

Density-preservation knobs beyond the weight.

Attributes:

Name Type Description
frac int | float | None

Fraction of the run, at the end, over which the density term is active. It is switched on late so the embedding has settled first.

var_shift int | float | None

Additive shift on the variance of the embedding log-radii, which keeps the correlation defined when the spread is tiny.

PhateDiffusion dataclass

PhateDiffusion(
    bandwidth_scale: int | float | None = None,
    thresh: int | float | None = None,
    graph_symmetry: str | None = None,
    n_svd: int | None = None,
    landmark_k_means: str | None = None,
    t_max: int | None = None,
)

PHATE diffusion operator knobs beyond decay, gamma, t and the landmarks.

Attributes:

Name Type Description
bandwidth_scale int | float | None

Multiplier on the adaptive kernel bandwidth.

thresh int | float | None

Affinities below this are zeroed, which is what keeps the operator sparse.

graph_symmetry str | None

"add", "multiply", "mnn" or "none".

n_svd int | None

Singular vectors for spectral landmark selection.

landmark_k_means str | None

k-means of the spectral landmark selection (not the IVF one in NeighbourParams), "emeans" or "lloyd". None gives e-means.

t_max int | None

Largest diffusion time the VNE knee search will consider. Ignored when t is pinned.