pub struct LabeledAnomaly {Show 16 fields
pub anomaly_id: String,
pub anomaly_type: AnomalyType,
pub document_id: String,
pub document_type: String,
pub company_code: String,
pub anomaly_date: NaiveDate,
pub detection_timestamp: NaiveDateTime,
pub confidence: f64,
pub severity: u8,
pub description: String,
pub related_entities: Vec<String>,
pub monetary_impact: Option<Decimal>,
pub metadata: HashMap<String, String>,
pub is_injected: bool,
pub injection_strategy: Option<String>,
pub cluster_id: Option<String>,
}Expand description
A labeled anomaly for supervised learning.
Fields§
§anomaly_id: StringUnique anomaly identifier.
anomaly_type: AnomalyTypeType of anomaly.
document_id: StringDocument or entity that contains the anomaly.
document_type: StringDocument type (JE, PO, Invoice, etc.).
company_code: StringCompany code.
anomaly_date: NaiveDateDate the anomaly occurred.
detection_timestamp: NaiveDateTimeTimestamp when detected/injected.
confidence: f64Confidence score (0.0 - 1.0) for injected anomalies.
severity: u8Severity (1-5).
description: StringDescription of the anomaly.
Related entities (user IDs, account codes, etc.).
monetary_impact: Option<Decimal>Monetary impact if applicable.
metadata: HashMap<String, String>Additional metadata.
is_injected: boolWhether this was injected (true) or naturally occurring (false).
injection_strategy: Option<String>Injection strategy used (if injected).
cluster_id: Option<String>Cluster ID if part of an anomaly cluster.
Implementations§
Source§impl LabeledAnomaly
impl LabeledAnomaly
Sourcepub fn new(
anomaly_id: String,
anomaly_type: AnomalyType,
document_id: String,
document_type: String,
company_code: String,
anomaly_date: NaiveDate,
) -> Self
pub fn new( anomaly_id: String, anomaly_type: AnomalyType, document_id: String, document_type: String, company_code: String, anomaly_date: NaiveDate, ) -> Self
Creates a new labeled anomaly.
Sourcepub fn with_description(self, description: &str) -> Self
pub fn with_description(self, description: &str) -> Self
Sets the description.
Sourcepub fn with_monetary_impact(self, impact: Decimal) -> Self
pub fn with_monetary_impact(self, impact: Decimal) -> Self
Sets the monetary impact.
Adds a related entity.
Sourcepub fn with_metadata(self, key: &str, value: &str) -> Self
pub fn with_metadata(self, key: &str, value: &str) -> Self
Adds metadata.
Sourcepub fn with_injection_strategy(self, strategy: &str) -> Self
pub fn with_injection_strategy(self, strategy: &str) -> Self
Sets the injection strategy.
Sourcepub fn with_cluster(self, cluster_id: &str) -> Self
pub fn with_cluster(self, cluster_id: &str) -> Self
Sets the cluster ID.
Sourcepub fn to_features(&self) -> Vec<f64>
pub fn to_features(&self) -> Vec<f64>
Converts to a feature vector for ML.
Trait Implementations§
Source§impl Clone for LabeledAnomaly
impl Clone for LabeledAnomaly
Source§fn clone(&self) -> LabeledAnomaly
fn clone(&self) -> LabeledAnomaly
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more