pub struct TrainingSimulation { /* private fields */ }Expand description
Simulated training scenario for reproducible ML experiments.
Implements Toyota Way principles:
- Jidoka: Stop-on-anomaly via
AnomalyDetector - Heijunka: Load-balanced batch iteration
- Kaizen: Continuous improvement tracking
Implementations§
Source§impl TrainingSimulation
impl TrainingSimulation
Sourcepub fn with_config(seed: u64, config: TrainingConfig) -> Self
pub fn with_config(seed: u64, config: TrainingConfig) -> Self
Create with custom configuration.
Sourcepub fn set_anomaly_detector(&mut self, detector: AnomalyDetector)
pub fn set_anomaly_detector(&mut self, detector: AnomalyDetector)
Set anomaly detector.
Sourcepub fn config(&self) -> &TrainingConfig
pub fn config(&self) -> &TrainingConfig
Get current training configuration.
Sourcepub fn trajectory(&self) -> &TrainingTrajectory
pub fn trajectory(&self) -> &TrainingTrajectory
Get current trajectory.
Sourcepub fn step(
&mut self,
loss: f64,
gradient_norm: f64,
) -> SimResult<Option<TrainingState>>
pub fn step( &mut self, loss: f64, gradient_norm: f64, ) -> SimResult<Option<TrainingState>>
Simulate a single training step with given loss and gradient norm.
This is a simplified simulation - real training would compute actual forward/backward passes. This enables testing training dynamics without actual model computation.
§Errors
Returns error if a training anomaly is detected (Jidoka).
Sourcepub fn simulate<F>(
&mut self,
epochs: u64,
loss_fn: F,
) -> SimResult<&TrainingTrajectory>
pub fn simulate<F>( &mut self, epochs: u64, loss_fn: F, ) -> SimResult<&TrainingTrajectory>
Simulate training for specified epochs using a loss function.
The loss_fn takes (epoch, rng) and returns (loss, gradient_norm).
§Errors
Returns error if a training anomaly is detected.
Sourcepub fn replay_from(&mut self, checkpoint: &TrainingState) -> SimResult<()>
pub fn replay_from(&mut self, checkpoint: &TrainingState) -> SimResult<()>
Sourcepub fn journal(&self) -> &EventJournal
pub fn journal(&self) -> &EventJournal
Get the event journal.
Auto Trait Implementations§
impl Freeze for TrainingSimulation
impl RefUnwindSafe for TrainingSimulation
impl Send for TrainingSimulation
impl Sync for TrainingSimulation
impl Unpin for TrainingSimulation
impl UnsafeUnpin for TrainingSimulation
impl UnwindSafe for TrainingSimulation
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