pub struct StatisticalFieldAnomalyDetector {
pub window_size: usize,
pub iqr_multiplier: f64,
pub jaccard_threshold: f64,
pub staleness_threshold_secs: i64,
pub z_score_threshold: f64,
pub cardinality_shift_fraction: f64,
/* private fields */
}Expand description
Default statistical detector. Rolling-window-based: keeps the
last Self::WINDOW_SIZE observations per field per schema and
applies the five heuristics in AnomalySignal.
Fields§
§window_size: usizeSliding-window size for each (schema, field) pair.
iqr_multiplier: f64IQR multiplier for AnomalySignal::PriceDrift. Default 3.0.
jaccard_threshold: f64Jaccard-distance threshold for AnomalySignal::ListingReorder. Default 0.3.
staleness_threshold_secs: i64Staleness threshold in seconds for AnomalySignal::Staleness. Default 7 days.
z_score_threshold: f64z-score threshold for AnomalySignal::Outlier. Default 3.0.
cardinality_shift_fraction: f64Cardinality-shift threshold as a fraction (0.5 = 50%).
Implementations§
Source§impl StatisticalFieldAnomalyDetector
impl StatisticalFieldAnomalyDetector
Sourcepub const WINDOW_SIZE: usize = 64
pub const WINDOW_SIZE: usize = 64
Default sliding-window size.
Trait Implementations§
Source§impl FieldAnomalyDetector for StatisticalFieldAnomalyDetector
impl FieldAnomalyDetector for StatisticalFieldAnomalyDetector
Source§fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
field: &'life2 FieldPath,
value: &'life3 FieldValue,
) -> Pin<Box<dyn Future<Output = Result<AnomalyReport, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn observe<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
field: &'life2 FieldPath,
value: &'life3 FieldValue,
) -> Pin<Box<dyn Future<Output = Result<AnomalyReport, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Observe one field value. Returns
AnomalyReport::signal
describing any anomaly detected, or AnomalySignal::None
if the value is consistent with the rolling baseline. Read moreSource§fn baseline<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<SchemaBaseline, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn baseline<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<SchemaBaseline, AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the current baseline for a schema.
Source§fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<(), AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reset<'life0, 'life1, 'async_trait>(
&'life0 self,
schema_id: &'life1 SchemaId,
) -> Pin<Box<dyn Future<Output = Result<(), AnomalyError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Drop the rolling state for a schema. Used by callers that
want to force a fresh baseline (e.g. after a backfill).
Auto Trait Implementations§
impl !Freeze for StatisticalFieldAnomalyDetector
impl !RefUnwindSafe for StatisticalFieldAnomalyDetector
impl Send for StatisticalFieldAnomalyDetector
impl Sync for StatisticalFieldAnomalyDetector
impl Unpin for StatisticalFieldAnomalyDetector
impl UnsafeUnpin for StatisticalFieldAnomalyDetector
impl UnwindSafe for StatisticalFieldAnomalyDetector
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