pub struct RealtimeAdaptationController<T>{ /* private fields */ }Expand description
Online controller that adapts the learning rate and momentum in response to drift detected on the loss and gradient-norm streams.
Implementations§
Source§impl<T> RealtimeAdaptationController<T>
impl<T> RealtimeAdaptationController<T>
Sourcepub fn new(config: RealtimeAdaptationConfig<T>) -> Result<Self>
pub fn new(config: RealtimeAdaptationConfig<T>) -> Result<Self>
Build a controller from a configuration.
§Errors
Returns OptimError::InvalidConfig if
RealtimeAdaptationConfig::validate fails.
Sourcepub fn learning_rate(&self) -> T
pub fn learning_rate(&self) -> T
Current learning rate.
Sourcepub fn step_count(&self) -> usize
pub fn step_count(&self) -> usize
Number of observations processed so far.
Sourcepub fn cooldown_remaining(&self) -> usize
pub fn cooldown_remaining(&self) -> usize
Steps remaining in the current cooldown window (zero when not cooling).
Sourcepub fn loss_detector(&self) -> &DriftDetector<T>
pub fn loss_detector(&self) -> &DriftDetector<T>
Immutable access to the loss-stream detector.
Sourcepub fn grad_detector(&self) -> &DriftDetector<T>
pub fn grad_detector(&self) -> &DriftDetector<T>
Immutable access to the gradient-norm-stream detector.
Sourcepub fn observe(&mut self, loss: T, grad_norm: T) -> AdaptationDecision<T>
pub fn observe(&mut self, loss: T, grad_norm: T) -> AdaptationDecision<T>
Process one (loss, grad_norm) observation and adapt the hyperparameters.
The two detectors are always updated (so their internal statistics stay current even during cooldown), but at most one learning-rate adjustment is applied per call, and none while a cooldown window is active.
Sourcepub fn apply_to(&self, optimizer: &mut dyn AdvancedOptimizer<T>)
pub fn apply_to(&self, optimizer: &mut dyn AdvancedOptimizer<T>)
Push the controller’s current learning rate onto an
AdvancedOptimizer, a thin bridge for wiring the controller into a
training loop.
Trait Implementations§
Source§impl<T> Clone for RealtimeAdaptationController<T>
impl<T> Clone for RealtimeAdaptationController<T>
Auto Trait Implementations§
impl<T> Freeze for RealtimeAdaptationController<T>
impl<T> RefUnwindSafe for RealtimeAdaptationController<T>where
RealtimeAdaptationConfig<T>: RefUnwindSafe,
DriftDetector<T>: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for RealtimeAdaptationController<T>
impl<T> Sync for RealtimeAdaptationController<T>
impl<T> Unpin for RealtimeAdaptationController<T>
impl<T> UnsafeUnpin for RealtimeAdaptationController<T>
impl<T> UnwindSafe for RealtimeAdaptationController<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.