pub struct Adwin { /* private fields */ }Expand description
ADWIN streaming change detector.
Maintains a variable-length window of recent observations using an
exponential histogram. After each add call the
algorithm checks whether any sub-window split shows a statistically
significant mean difference (Hoeffding bound at confidence 1 - δ).
If so it shrinks the window to the more recent portion and reports
drift.
§Parameters
delta— confidence parameter (smaller = fewer false positives, slower reaction). Typical value: 0.002.
Implementations§
Source§impl Adwin
impl Adwin
Sourcepub fn new(delta: f64) -> Self
pub fn new(delta: f64) -> Self
Create a new ADWIN detector with the given confidence parameter.
Lower delta values make the detector less sensitive (fewer false
positives). 0.002 is a common choice.
Sourcepub fn add(&mut self, value: f64) -> bool
pub fn add(&mut self, value: f64) -> bool
Add a new observation and check for drift.
Returns true if drift is detected (the window was shrunk).
Non-finite values (NaN, ±Inf) are rejected and the method returns
false without modifying the window, because they would silently
poison total_sum and total_variance.
Sourcepub fn window_size(&self) -> usize
pub fn window_size(&self) -> usize
Current window size (number of observations).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Adwin
impl RefUnwindSafe for Adwin
impl Send for Adwin
impl Sync for Adwin
impl Unpin for Adwin
impl UnsafeUnpin for Adwin
impl UnwindSafe for Adwin
Blanket Implementations§
impl<T> Allocation for T
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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