pub struct PlateauDetector {
pub window_size: usize,
pub variance_threshold: f64,
/* private fields */
}Expand description
Plateau detector: detects when a metric has plateaued.
A plateau is detected when the variance of the most recent values within a sliding window falls below a configurable threshold.
Fields§
§window_size: usizeSize of the sliding window.
variance_threshold: f64Variance threshold below which a plateau is declared.
Implementations§
Source§impl PlateauDetector
impl PlateauDetector
Sourcepub fn is_plateau(&self) -> bool
pub fn is_plateau(&self) -> bool
Whether the metric has plateaued (window full and variance below threshold).
Sourcepub fn current_variance(&self) -> Option<f64>
pub fn current_variance(&self) -> Option<f64>
Compute the variance of the values in the current window.
Returns None if there are fewer values than the window size.
Sourcepub fn values_in_window(&self) -> &[f64]
pub fn values_in_window(&self) -> &[f64]
The values currently in the sliding window.
Trait Implementations§
Source§impl Clone for PlateauDetector
impl Clone for PlateauDetector
Source§fn clone(&self) -> PlateauDetector
fn clone(&self) -> PlateauDetector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PlateauDetector
impl RefUnwindSafe for PlateauDetector
impl Send for PlateauDetector
impl Sync for PlateauDetector
impl Unpin for PlateauDetector
impl UnsafeUnpin for PlateauDetector
impl UnwindSafe for PlateauDetector
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> 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>
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