pub struct PhaseTrainer { /* private fields */ }Expand description
Trainer state for deterministic phase training
Implementations§
Source§impl PhaseTrainer
impl PhaseTrainer
Sourcepub fn new(config: PhaseTrainingConfig) -> Result<Self, String>
pub fn new(config: PhaseTrainingConfig) -> Result<Self, String>
Create a new phase trainer
§Errors
Returns an error if:
config.correct_everyis 0- All step counts (warmup, full, predict) are 0
Sourcepub fn current_phase(&self) -> TrainingPhase
pub fn current_phase(&self) -> TrainingPhase
Get the current training phase
Sourcepub fn begin_step(&mut self) -> TrainingPhase
pub fn begin_step(&mut self) -> TrainingPhase
Begin a training step, returning the current phase
Sourcepub fn should_compute_full(&self) -> bool
pub fn should_compute_full(&self) -> bool
Check if full gradients should be computed
Sourcepub fn record_predicted_step(&mut self)
pub fn record_predicted_step(&mut self)
Record that a predicted gradient step was taken
Sourcepub fn record_gradients(&mut self, gradients: Vec<f64>)
pub fn record_gradients(&mut self, gradients: Vec<f64>)
Record full gradients for history
Sourcepub fn get_predicted_gradients(&self, param_count: usize) -> Vec<f64>
pub fn get_predicted_gradients(&self, param_count: usize) -> Vec<f64>
Get predicted gradients using closed-form least squares
This uses a weighted average of historical gradients, with more recent gradients weighted higher. This is a simplified version of the full vsa-optim-rs prediction.
Sourcepub fn stats(&self) -> &PhaseTrainingStats
pub fn stats(&self) -> &PhaseTrainingStats
Get training statistics
Sourcepub fn finalize(&mut self) -> PhaseTrainingStats
pub fn finalize(&mut self) -> PhaseTrainingStats
Finalize training and compute final stats
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhaseTrainer
impl RefUnwindSafe for PhaseTrainer
impl Send for PhaseTrainer
impl Sync for PhaseTrainer
impl Unpin for PhaseTrainer
impl UnwindSafe for PhaseTrainer
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
Mutably borrows from an owned value. Read more
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>
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 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>
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