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,
    diversify_prob: float | None = None,
    delta: float | None = None,
    ef_budget: int | None = None,
    extract_knn: bool | None = None,
    bt_budget: float | None = None,
    n_list: int | None = None,
    n_probes: 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.

diversify_prob float | None

NN-Descent. Diversification probability applied to the finished graph.

delta float | None

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

ef_budget int | None

NN-Descent. Beam budget when querying. None picks one. No effect when extract_knn is on, since no search runs.

extract_knn bool | None

NN-Descent. Return the graph the descent already built instead of searching it. On by default: a self-kNN query re-searches a graph that is already a kNN graph. Measured on 20k points in 50D, identical recall and about 25% faster at k=15; at k=50 the graph is widened to cover the request, which is slower to build but reaches perfect recall where the beam search drops to 0.989.

bt_budget 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).

NeighbourParamsGpu dataclass

NeighbourParamsGpu(
    n_list: int | None = None,
    n_probes: int | None = None,
    k: int | None = None,
    k_build: int | None = None,
    n_tree: int | None = None,
    delta: float | None = None,
    rho: float | None = None,
    beam_width: int | None = None,
    max_beam_iters: int | None = None,
    n_entry_points: int | None = None,
    extract_knn: bool | None = None,
)

Backend-specific knobs for the GPU neighbour search.

A different set from NeighbourParams, not a subset: the device backends build a CAGRA graph and search it with a beam, neither of which has a CPU counterpart.

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 int | None

NN-Descent-GPU. Node degree after pruning. None gives 30, except under t-SNE where it is backfilled to 3 * perplexity.

k_build int | None

NN-Descent-GPU. Node degree before pruning.

n_tree int | None

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

delta float | None

NN-Descent-GPU. Convergence threshold.

rho float | None

NN-Descent-GPU. Sampling rate per iteration.

beam_width int | None

NN-Descent-GPU. Beam width when querying.

max_beam_iters int | None

NN-Descent-GPU. Beam iterations when querying.

n_entry_points int | None

NN-Descent-GPU. Entry points per query.

extract_knn bool | None

NN-Descent-GPU. Return the built CAGRA graph instead of searching it. On by default, as for the CPU backend, and worth about a third off a full GPU embedding: 0.74s to 0.48s at 20k points in 50D. It can cost bit-reproducibility on some inputs; see the reproducibility section of the guide. beam_width, max_beam_iters and n_entry_points do nothing when it is on.

UmapGraph dataclass

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

Fuzzy simplicial set construction.

Attributes:

Name Type Description
bandwidth float | None

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

local_connectivity float | None

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

mix_weight float | None

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

UmapOptim dataclass

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

UMAP optimiser knobs beyond the epochs and learning rate.

Attributes:

Name Type Description
a 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 float | None

Repulsion curve exponent. See a.

gamma float | None

Weight on the repulsive term.

neg_sample_rate int | None

Negative samples drawn per positive edge.

beta1 float | None

Adam first-moment decay. The crate uses 0.5 for UMAP rather than the usual 0.9.

beta2 float | None

Adam second-moment decay.

eps float | None

Adam denominator epsilon.

TsneOptim dataclass

TsneOptim(
    early_exag_iter: int | None = None,
    early_exag_factor: float | None = None,
    late_exag_factor: float | None = None,
    theta: float | None = None,
    n_interp_points: 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 float | None

Multiplier on the affinities during those iterations.

late_exag_factor 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 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.

PacmapOptim dataclass

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

PaCMAP 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 to zero across phase 2, and phase 3 is near pairs and repulsion alone.

Attributes:

Name Type Description
beta1 float | None

Adam first-moment decay.

beta2 float | None

Adam second-moment decay.

eps 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.

DensParams dataclass

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

Density-preservation knobs beyond the weight.

Attributes:

Name Type Description
frac 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 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: float | None = None,
    thresh: float | None = None,
    graph_symmetry: str | None = None,
    n_landmarks: int | None = None,
    landmark_method: str | None = None,
    n_svd: int | None = None,
    t_max: int | None = None,
)

PHATE diffusion operator knobs beyond decay, gamma and t.

Attributes:

Name Type Description
bandwidth_scale float | None

Multiplier on the adaptive kernel bandwidth.

thresh float | None

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

graph_symmetry str | None

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

n_landmarks int | None

Landmarks to diffuse on instead of the full graph. Worth setting above roughly 50k points.

landmark_method str | None

"spectral", "random" or "density".

n_svd int | None

Components for spectral landmark selection.

t_max int | None

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