Skip to main content

Adwin

Struct Adwin 

Source
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

Source

pub fn new() -> Self

Create a new ADWIN detector with the default confidence delta = 0.002.

Source

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).

Source

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.

Source

pub fn with_min_window(self, min: u64) -> Self

Set the minimum window size before drift checking begins (default 32).

Source

pub fn width(&self) -> u64

Current window width (number of original observations).

Trait Implementations§

Source§

impl Clone for Adwin

Source§

fn clone(&self) -> Adwin

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Adwin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Adwin

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Adwin

Source§

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 Display for Adwin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DriftDetector for Adwin

Source§

fn update(&mut self, value: f64) -> DriftSignal

Feed a new value and get the current drift signal.
Source§

fn reset(&mut self)

Reset to initial state.
Source§

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>

Clone this detector including its internal state. Read more
Source§

fn estimated_mean(&self) -> f64

Current estimated mean of the monitored stream.
Source§

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

Restore the detector’s internal state from a serialized snapshot. Read more
Source§

impl Serialize for Adwin

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,