pub struct UmapConfig {
pub n_neighbors: usize,
pub n_epochs: usize,
pub learning_rate: f64,
pub negative_sample_rate: usize,
pub category_weight: f64,
pub min_dist: f64,
pub warm_start_anchor: f64,
pub seed: u64,
}Expand description
Knobs for UmapSphereProjection::fit. All defaults match the
canonical UMAP paper unless noted.
Fields§
§n_neighbors: usizeNeighbors per point in the kNN graph that supplies the attractive term. Higher = preserve global structure, lower = preserve local clusters. UMAP default 15.
n_epochs: usizeOptimizer iterations. ~200 is enough for n<=2000; scale up roughly logarithmically.
learning_rate: f64Adam base learning rate. Tangent-space gradients are bounded so 0.05 is safe even for tiny corpora.
negative_sample_rate: usizeNegative samples drawn per attractive edge per epoch.
category_weight: f64Weight on the supervised category term (0.0 = disabled). When
active, every epoch samples for each point one same-category
partner (cohesion, attractive) and one different-category
partner (separation, repulsive) — stratified so the cohesion
half fires regardless of how many categories the corpus has.
Only meaningful when categories is supplied to fit.
min_dist: f64How tightly neighbors may pack in the layout — the canonical
UMAP knob. At fit time the kernel parameters (a, b) of
Phi(d) = 1/(1 + a·d^(2b)) are least-squares fitted from it
(spread fixed at 1.0). On S², whose total area is fixed, this
directly sets how much territory a cluster occupies; 0.0
reproduces near-maximal clumping (close to the historical
hardcoded a = b = 1). UMAP default 0.1.
warm_start_anchor: f64Weight on an attractive pull toward each point’s PCA warm-start position (0.0 = disabled). Use small values (~0.01–0.1) on sparse corpora whose kNN graphs fragment into disconnected components: the warm start places the components sensibly relative to each other, but with zero attraction between them, uniform negative sampling drifts them into an arbitrary arrangement over many epochs. The anchor keeps that global arrangement from drifting under unopposed repulsion.
seed: u64PRNG seed for kNN tie-breaking, negative sampling, and fallback random init when PCA warm-start is degenerate.
Trait Implementations§
Source§impl Clone for UmapConfig
impl Clone for UmapConfig
Source§fn clone(&self) -> UmapConfig
fn clone(&self) -> UmapConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for UmapConfig
impl Debug for UmapConfig
Auto Trait Implementations§
impl Freeze for UmapConfig
impl RefUnwindSafe for UmapConfig
impl Send for UmapConfig
impl Sync for UmapConfig
impl Unpin for UmapConfig
impl UnsafeUnpin for UmapConfig
impl UnwindSafe for UmapConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more