Skip to main content

UmapConfig

Struct UmapConfig 

Source
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: usize

Neighbors per point in the kNN graph that supplies the attractive term. Higher = preserve global structure, lower = preserve local clusters. UMAP default 15.

§n_epochs: usize

Optimizer iterations. ~200 is enough for n<=2000; scale up roughly logarithmically.

§learning_rate: f64

Adam base learning rate. Tangent-space gradients are bounded so 0.05 is safe even for tiny corpora.

§negative_sample_rate: usize

Negative samples drawn per attractive edge per epoch.

§category_weight: f64

Weight 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: f64

How 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: f64

Weight 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: u64

PRNG seed for kNN tie-breaking, negative sampling, and fallback random init when PCA warm-start is degenerate.

Trait Implementations§

Source§

impl Clone for UmapConfig

Source§

fn clone(&self) -> UmapConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UmapConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for UmapConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more