pub struct DdmDetector<A: Float + Send + Sync> { /* private fields */ }Expand description
DDM (Drift Detection Method) detector.
C3: implemented per Gama et al., “Learning with Drift Detection” (2004).
The detector tracks the online error rate p_i and its standard deviation
s_i = sqrt(p_i (1 - p_i) / i), remembers the pair (p_min, s_min) observed
at the minimum of p_i + s_i, and compares the current p_i + s_i
against p_min + 2*s_min (warning) and p_min + 3*s_min (drift).
The previous implementation instead tracked min(p_i + 2*s_i) in
min_error_plus_2_std and set min_error_plus_3_std to p_i + 3*s_i at
that same moment. The published 2*s_min / 3*s_min margins were
therefore never applied: the warning test degenerated to “is the current
level above the smallest level ever seen”, which fires on essentially any
upward noise, and the drift test compared p + 2s against p_min + 3*s_min
where both terms came from different definitions. It also seeded
error_std = 1.0, which is not a possible standard deviation for a rate in
[0, 1].
Implementations§
Source§impl<A: Float + Send + Sync> DdmDetector<A>
impl<A: Float + Send + Sync> DdmDetector<A>
Sourcepub const DEFAULT_WARMUP: usize = 30
pub const DEFAULT_WARMUP: usize = 30
Minimum samples before the DDM statistics are meaningful (the value used in the original paper).
Sourcepub fn with_warmup(warmup: usize) -> Self
pub fn with_warmup(warmup: usize) -> Self
Create a DDM detector with a custom warm-up length.
Sourcepub fn error_rate(&self) -> A
pub fn error_rate(&self) -> A
Current error rate estimate.
Sourcepub fn warning_level(&self) -> Option<A>
pub fn warning_level(&self) -> Option<A>
Current warning level p_min + 2*s_min, if the baseline is established.
Sourcepub fn drift_level(&self) -> Option<A>
pub fn drift_level(&self) -> Option<A>
Current drift level p_min + 3*s_min, if the baseline is established.
Sourcepub fn update(&mut self, iserror: bool) -> DriftStatus
pub fn update(&mut self, iserror: bool) -> DriftStatus
Update with prediction result
Trait Implementations§
Source§impl<A: Clone + Float + Send + Sync> Clone for DdmDetector<A>
impl<A: Clone + Float + Send + Sync> Clone for DdmDetector<A>
Source§fn clone(&self) -> DdmDetector<A>
fn clone(&self) -> DdmDetector<A>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<A> Freeze for DdmDetector<A>where
A: Freeze,
impl<A> RefUnwindSafe for DdmDetector<A>where
A: RefUnwindSafe,
impl<A> Send for DdmDetector<A>
impl<A> Sync for DdmDetector<A>
impl<A> Unpin for DdmDetector<A>where
A: Unpin,
impl<A> UnsafeUnpin for DdmDetector<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for DdmDetector<A>where
A: UnwindSafe,
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
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.