pub struct CusumDetector { /* private fields */ }Expand description
Two-sided tabular CUSUM detector.
Detects shifts in the mean of a time series by accumulating deviations from a reference mean. Suitable for streaming (O(1) per point after fitting).
Implementations§
Source§impl CusumDetector
impl CusumDetector
Sourcepub fn new(h: Option<f64>, k: Option<f64>) -> Self
pub fn new(h: Option<f64>, k: Option<f64>) -> Self
Creates a new CUSUM detector.
h: Decision threshold (default: 4.0 × σ). Higher = fewer false alarms.k: Slack parameter (default: 0.5 × σ). The minimum shift to detect.
Sourcepub fn with_reset_after_alarm(self, reset: bool) -> Self
pub fn with_reset_after_alarm(self, reset: bool) -> Self
Set whether cumulative sums are reset after each alarm.
true = Western Electric variant (default); false = Page (1954).
Trait Implementations§
Source§impl AnomalyDetector for CusumDetector
impl AnomalyDetector for CusumDetector
Source§fn fit(
&mut self,
_timestamps: &[i64],
values: &[f64],
) -> Result<(), AnomalyError>
fn fit( &mut self, _timestamps: &[i64], values: &[f64], ) -> Result<(), AnomalyError>
Fit the detector on historical data.
Source§fn detect(
&mut self,
timestamps: &[i64],
values: &[f64],
) -> Result<Vec<AnomalyScore>, AnomalyError>
fn detect( &mut self, timestamps: &[i64], values: &[f64], ) -> Result<Vec<AnomalyScore>, AnomalyError>
Score every point in the provided data.
Source§fn detect_point(
&mut self,
timestamp: i64,
value: f64,
) -> Result<AnomalyScore, AnomalyError>
fn detect_point( &mut self, timestamp: i64, value: f64, ) -> Result<AnomalyScore, AnomalyError>
Score a single streaming point (O(1) after fitting).
Source§fn detector_type(&self) -> DetectorType
fn detector_type(&self) -> DetectorType
What kind of detector this is.
Source§impl<'de> Deserialize<'de> for CusumDetector
impl<'de> Deserialize<'de> for CusumDetector
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
Auto Trait Implementations§
impl Freeze for CusumDetector
impl RefUnwindSafe for CusumDetector
impl Send for CusumDetector
impl Sync for CusumDetector
impl Unpin for CusumDetector
impl UnsafeUnpin for CusumDetector
impl UnwindSafe for CusumDetector
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
Converts
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> ⓘ
Converts
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