pub struct MetaDriftDetector { /* private fields */ }Expand description
CUSUM drift detector.
Feed anomaly scores through Self::observe one by one; the
detector returns a DriftVerdict every time. Reset the
accumulators via Self::reset once the caller has acted on a
drift event; reset the whole state (including the reference EMA)
via Self::reset_stats after a config change.
Implementations§
Source§impl MetaDriftDetector
impl MetaDriftDetector
Sourcepub fn new(config: CusumConfig) -> RcfResult<Self>
pub fn new(config: CusumConfig) -> RcfResult<Self>
Build a detector with the supplied config.
§Errors
Forwards CusumConfig::validate and EmaStats::new
errors.
Sourcepub fn with_metrics_sink(self, sink: Arc<dyn MetricsSink>) -> Self
pub fn with_metrics_sink(self, sink: Arc<dyn MetricsSink>) -> Self
Install a crate::MetricsSink — emits
rcf_drift_s_high / rcf_drift_s_low histograms per call
and increments rcf_drift_fires_total on fire verdicts.
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 with_defaults() -> RcfResult<Self>
pub fn with_defaults() -> RcfResult<Self>
Sourcepub fn config(&self) -> &CusumConfig
pub fn config(&self) -> &CusumConfig
Read-only CUSUM config.
Sourcepub fn observe(&mut self, score: f64) -> DriftVerdict
pub fn observe(&mut self, score: f64) -> DriftVerdict
Fold score into the detector and emit a verdict.
Non-finite inputs are silently ignored and return a verdict flagged as not-ready without mutating the detector.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear the CUSUM accumulators while keeping the EMA reference intact. Call this after reacting to a drift event — the new distribution becomes the next reference.
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Clear everything — accumulators and EMA reference. Returns the detector to its warmup state.
Trait Implementations§
Source§impl Clone for MetaDriftDetector
impl Clone for MetaDriftDetector
Source§fn clone(&self) -> MetaDriftDetector
fn clone(&self) -> MetaDriftDetector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetaDriftDetector
impl Debug for MetaDriftDetector
Source§impl<'de> Deserialize<'de> for MetaDriftDetector
impl<'de> Deserialize<'de> for MetaDriftDetector
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 MetaDriftDetector
impl !RefUnwindSafe for MetaDriftDetector
impl Send for MetaDriftDetector
impl Sync for MetaDriftDetector
impl Unpin for MetaDriftDetector
impl UnsafeUnpin for MetaDriftDetector
impl !UnwindSafe for MetaDriftDetector
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