#[repr(C)]pub struct BehavioralBaseline {Show 22 fields
pub id: Uuid,
pub account_id: u16,
pub period_count: u16,
pub _pad: u32,
pub mean: f64,
pub median: f64,
pub std_dev: f64,
pub mad: f64,
pub q1: f64,
pub q3: f64,
pub iqr: f64,
pub min_value: f64,
pub max_value: f64,
pub p5: f64,
pub p95: f64,
pub skewness: f64,
pub kurtosis: f64,
pub avg_transaction_count: f64,
pub transaction_count_std_dev: f64,
pub last_updated: HybridTimestamp,
pub period_start: HybridTimestamp,
pub period_end: HybridTimestamp,
}Expand description
Behavioral baseline for anomaly detection. Captures “normal” patterns for an account.
Fields§
§id: UuidBaseline identifier
account_id: u16Account this baseline belongs to
period_count: u16Number of historical periods used
_pad: u32Padding
mean: f64Arithmetic mean
median: f64Median (50th percentile)
std_dev: f64Standard deviation
mad: f64Median Absolute Deviation (robust to outliers)
q1: f64First quartile (25th percentile)
q3: f64Third quartile (75th percentile)
iqr: f64Interquartile range (Q3 - Q1)
min_value: f64Minimum observed value
max_value: f64Maximum observed value
p5: f645th percentile
p95: f6495th percentile
skewness: f64Skewness (0 = symmetric, >0 = right tail, <0 = left tail)
kurtosis: f64Kurtosis (3 = normal, >3 = heavy tails)
avg_transaction_count: f64Average transaction count per period
transaction_count_std_dev: f64Std dev of transaction counts
last_updated: HybridTimestampWhen baseline was last computed
period_start: HybridTimestampStart of baseline period
period_end: HybridTimestampEnd of baseline period
Implementations§
Source§impl BehavioralBaseline
impl BehavioralBaseline
Sourcepub fn modified_z_score(&self, value: f64) -> f64
pub fn modified_z_score(&self, value: f64) -> f64
Compute modified z-score (robust, uses MAD).
Sourcepub fn is_iqr_outlier(&self, value: f64) -> bool
pub fn is_iqr_outlier(&self, value: f64) -> bool
Check if value is an IQR outlier.
Sourcepub fn is_percentile_outlier(&self, value: f64) -> bool
pub fn is_percentile_outlier(&self, value: f64) -> bool
Check if value is a percentile outlier.
Sourcepub fn is_anomaly(&self, value: f64) -> (bool, f32)
pub fn is_anomaly(&self, value: f64) -> (bool, f32)
Multi-method anomaly check.
Trait Implementations§
Source§impl Archive for BehavioralBaseline
impl Archive for BehavioralBaseline
Source§type Archived = ArchivedBehavioralBaseline
type Archived = ArchivedBehavioralBaseline
Source§type Resolver = BehavioralBaselineResolver
type Resolver = BehavioralBaselineResolver
Source§impl Clone for BehavioralBaseline
impl Clone for BehavioralBaseline
Source§fn clone(&self) -> BehavioralBaseline
fn clone(&self) -> BehavioralBaseline
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BehavioralBaseline
impl Debug for BehavioralBaseline
Source§impl<__D: Fallible + ?Sized> Deserialize<BehavioralBaseline, __D> for Archived<BehavioralBaseline>where
Uuid: Archive,
Archived<Uuid>: Deserialize<Uuid, __D>,
u16: Archive,
Archived<u16>: Deserialize<u16, __D>,
u32: Archive,
Archived<u32>: Deserialize<u32, __D>,
f64: Archive,
Archived<f64>: Deserialize<f64, __D>,
HybridTimestamp: Archive,
Archived<HybridTimestamp>: Deserialize<HybridTimestamp, __D>,
impl<__D: Fallible + ?Sized> Deserialize<BehavioralBaseline, __D> for Archived<BehavioralBaseline>where
Uuid: Archive,
Archived<Uuid>: Deserialize<Uuid, __D>,
u16: Archive,
Archived<u16>: Deserialize<u16, __D>,
u32: Archive,
Archived<u32>: Deserialize<u32, __D>,
f64: Archive,
Archived<f64>: Deserialize<f64, __D>,
HybridTimestamp: Archive,
Archived<HybridTimestamp>: Deserialize<HybridTimestamp, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<BehavioralBaseline, __D::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<BehavioralBaseline, __D::Error>
Auto Trait Implementations§
impl Freeze for BehavioralBaseline
impl RefUnwindSafe for BehavioralBaseline
impl Send for BehavioralBaseline
impl Sync for BehavioralBaseline
impl Unpin for BehavioralBaseline
impl UnwindSafe for BehavioralBaseline
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be unsized. Read moreSource§type MetadataResolver = ()
type MetadataResolver = ()
Source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, S> SerializeUnsized<S> for T
impl<T, S> SerializeUnsized<S> for T
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.