pub struct AdwinDetector { /* private fields */ }Expand description
ADWIN-style streaming change-point detector.
Implementations§
Source§impl AdwinDetector
impl AdwinDetector
Sourcepub fn new(range: f64, delta: f64, window_cap: usize) -> RcfResult<Self>
pub fn new(range: f64, delta: f64, window_cap: usize) -> RcfResult<Self>
Build a detector with caller-chosen stream amplitude.
§Errors
Returns RcfError::InvalidConfig on non-finite / non-
positive range, delta outside (0, 1), or
window_cap < 2 · MIN_SUBWINDOW_LEN.
Sourcepub fn with_metrics_sink(self, sink: Arc<dyn MetricsSink>) -> Self
pub fn with_metrics_sink(self, sink: Arc<dyn MetricsSink>) -> Self
Install a metrics sink — every update emits an observed
counter, and every drift fire bumps a drift-fires counter.
Sourcepub fn metrics_sink(&self) -> &Arc<dyn MetricsSink>
pub fn metrics_sink(&self) -> &Arc<dyn MetricsSink>
Read-only handle to the installed sink.
Sourcepub fn default_bounded() -> Self
pub fn default_bounded() -> Self
Convenience: range 1.0, DEFAULT_DELTA,
DEFAULT_WINDOW_CAP.
§Panics
Never — the default values pass new’s validation.
Sourcepub fn drift_fires(&self) -> u64
pub fn drift_fires(&self) -> u64
Lifetime drift fires since construction.
Sourcepub fn update(&mut self, value: f64) -> bool
pub fn update(&mut self, value: f64) -> bool
Fold value into the window. Evaluates every split point
against the Hoeffding bound; if any split flags drift, the
older sub-window is dropped and the return is true.
Returns false otherwise (no drift on this update).
Non-finite values are silently dropped.
Sourcepub fn reset_window(&mut self)
pub fn reset_window(&mut self)
Drop every observation. Counters are preserved.
Trait Implementations§
Source§impl Clone for AdwinDetector
impl Clone for AdwinDetector
Source§fn clone(&self) -> AdwinDetector
fn clone(&self) -> AdwinDetector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AdwinDetector
impl Debug for AdwinDetector
Source§impl<'de> Deserialize<'de> for AdwinDetector
impl<'de> Deserialize<'de> for AdwinDetector
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 AdwinDetector
impl !RefUnwindSafe for AdwinDetector
impl Send for AdwinDetector
impl Sync for AdwinDetector
impl Unpin for AdwinDetector
impl UnsafeUnpin for AdwinDetector
impl !UnwindSafe for AdwinDetector
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> 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