umap_from_knn()
Run UMAP on a precomputed k-nearest-neighbor graph.
Usage
umap_from_knn(
indices,
distances,
*,
n_components=2,
min_dist=0.1,
spread=1.0,
n_epochs=None,
learning_rate=1.0,
init="auto",
negative_sample_rate=5,
repulsion_strength=1.0,
local_connectivity=1.0,
set_op_mix_ratio=1.0,
a=None,
b=None,
random_state=None,
optimizer=None,
layout="0.6",
disconnection_distance=None,
n_threads=None,
gpu=False,
verbose=False
)Use this when you already have neighbors, for example from knn(), an exact search, a vector database or FAISS. The original vectors are not needed.
Parameters
indices: IntoExpr-
ArrayorListcolumn of integer row indices of each row’s nearest neighbors, sorted by ascending distance. The row itself may be included (usually first, at distance 0) or left out. Every row must have the same number of neighbors. distances: IntoExpr-
ArrayorListcolumn with the matching distances. n_components: int = 2min_dist: int = 2spread: int = 2n_epochs: int = 2learning_rate: int = 2negative_sample_rate: int = 2repulsion_strength: float = 1.0local_connectivity: float = 1.0set_op_mix_ratio: float = 1.0a: float = 1.0b: float = 1.0random_state: float = 1.0optimizer: Optimizer | None = None-
See umap().
layout: Optimizer | None = None-
See umap().
disconnection_distance: Optimizer | None = None-
See umap().
n_threads: Optimizer | None = None-
See umap().
gpu: Optimizer | None = None-
See umap().
verbose: Optimizer | None = None-
See umap().
init: InitLike = "auto"-
See umap().
"pca"is not available because it needs the vectors.
Returns
pl.Expr-
An
Array(Float32, n_components)expression.