pub struct OptimizationParams {Show 15 fields
pub n_epochs: usize,
pub batch_size: usize,
pub learning_rate: f64,
pub beta1: f64,
pub beta2: f64,
pub penalty: f32,
pub repulsion_strength: f32,
pub patience: Option<i32>,
pub loss_reduction: LossReduction,
pub min_desired_loss: Option<f64>,
pub timeout: Option<u64>,
pub verbose: bool,
pub neg_sample_rate: usize,
pub cooldown_ms: u64,
pub figures_dir: Option<PathBuf>,
}Expand description
Configuration for stochastic gradient descent optimization.
These parameters control the embedding optimization process.
Fields§
§n_epochs: usizeNumber of optimization epochs.
Default: 100
batch_size: usizeThe number of samples to process in each training batch.
Default: 1000
learning_rate: f64Initial learning rate for the Adam optimizer.
Default: 0.001
beta1: f64Beta1 parameter for the Adam optimizer.
Default: 0.9
beta2: f64Beta2 parameter for the Adam optimizer.
Default: 0.999
penalty: f32L2 regularization (weight decay) penalty.
Default: 1e-5
repulsion_strength: f32Weight applied to the repulsion term of the UMAP cross-entropy loss.
Default: 1.0
patience: Option<i32>Number of epochs to wait for improvement before triggering early stopping.
None disables early stopping.
Default: None
loss_reduction: LossReductionThe method used to reduce the loss (mean or sum).
Default: Sum
min_desired_loss: Option<f64>Minimum desired loss to achieve before stopping early.
Default: None
timeout: Option<u64>Maximum training time in seconds. None means no limit.
Default: None
verbose: boolWhether to show detailed progress information during training.
Default: false
neg_sample_rate: usizeNumber of negative (repulsion) samples drawn per positive (attraction) edge each epoch.
Higher values produce stronger repulsion and better cluster separation at the cost of more computation per epoch.
Default: 5
cooldown_ms: u64Milliseconds to sleep at the end of every training epoch.
Inserting a small pause between epochs lets the GPU scheduler breathe, preventing the device from being pinned at 100 % utilisation for the entire run. Typical values:
cooldown_ms | Effect |
|---|---|
0 (default) | No pause — maximum throughput |
1–5 | Barely perceptible pause, ~10–20 % GPU headroom |
10–50 | Noticeable slowdown, significant GPU headroom |
Default: 0 (disabled)
figures_dir: Option<PathBuf>Directory where loss-curve and embedding snapshot plots are written
when verbose is true (or the verbose feature flag is enabled).
Defaults to "figures" (relative to the current working directory).
Set this to an absolute path — or any writable location — if the
process runs on a read-only filesystem.
When None the default "figures" directory is used.
Trait Implementations§
Source§impl Clone for OptimizationParams
impl Clone for OptimizationParams
Source§fn clone(&self) -> OptimizationParams
fn clone(&self) -> OptimizationParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OptimizationParams
impl Debug for OptimizationParams
Source§impl Default for OptimizationParams
impl Default for OptimizationParams
Source§impl<'de> Deserialize<'de> for OptimizationParams
impl<'de> Deserialize<'de> for OptimizationParams
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for OptimizationParams
impl RefUnwindSafe for OptimizationParams
impl Send for OptimizationParams
impl Sync for OptimizationParams
impl Unpin for OptimizationParams
impl UnsafeUnpin for OptimizationParams
impl UnwindSafe for OptimizationParams
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