pub struct Adwin { /* private fields */ }Available on crate feature
alloc only.Expand description
ADWIN (ADaptive WINdowing) drift detector.
Maintains an adaptive-size window over a stream of real-valued observations using an exponential histogram. Detects distribution shift by comparing sub-window means with a Hoeffding-style bound.
§Examples
use irithyll_core::drift::{DriftDetector, DriftSignal};
use irithyll_core::drift::adwin::Adwin;
let mut det = Adwin::new();
// Feed stable values
for _ in 0..200 {
let sig = det.update(0.0);
assert_ne!(sig, DriftSignal::Drift);
}Implementations§
Source§impl Adwin
impl Adwin
Sourcepub fn with_delta(delta: f64) -> Self
pub fn with_delta(delta: f64) -> Self
Create a new ADWIN detector with the given confidence parameter.
delta controls sensitivity: smaller values mean fewer false positives but
slower reaction to real drift. Typical range: 0.0001 to 0.1.
§Panics
Panics if delta is not in (0, 1).
Sourcepub fn with_max_buckets(self, m: usize) -> Self
pub fn with_max_buckets(self, m: usize) -> Self
Set the maximum number of buckets per row (default 5).
Higher values use more memory but give finer granularity for split-point testing. Must be at least 2.
Sourcepub fn with_min_window(self, min: u64) -> Self
pub fn with_min_window(self, min: u64) -> Self
Set the minimum window size before drift checking begins (default 32).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Adwin
impl<'de> Deserialize<'de> for Adwin
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DriftDetector for Adwin
impl DriftDetector for Adwin
Source§fn update(&mut self, value: f64) -> DriftSignal
fn update(&mut self, value: f64) -> DriftSignal
Feed a new value and get the current drift signal.
Source§fn clone_fresh(&self) -> Box<dyn DriftDetector>
fn clone_fresh(&self) -> Box<dyn DriftDetector>
Create a fresh detector with the same configuration but no state.
Source§fn clone_boxed(&self) -> Box<dyn DriftDetector>
fn clone_boxed(&self) -> Box<dyn DriftDetector>
Clone this detector including its internal state. Read more
Source§fn estimated_mean(&self) -> f64
fn estimated_mean(&self) -> f64
Current estimated mean of the monitored stream.
Source§fn serialize_state(&self) -> Option<DriftDetectorState>
fn serialize_state(&self) -> Option<DriftDetectorState>
Serialize the detector’s internal state for model persistence. Read more
Source§fn restore_state(&mut self, state: &DriftDetectorState) -> bool
fn restore_state(&mut self, state: &DriftDetectorState) -> bool
Restore the detector’s internal state from a serialized snapshot. Read more
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§
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