pub struct AnomalyDetectionService { /* private fields */ }Expand description
Service for detecting anomalous embeddings.
Implementations§
Source§impl AnomalyDetectionService
impl AnomalyDetectionService
Sourcepub fn new(threshold: f32, k_neighbors: usize) -> Self
pub fn new(threshold: f32, k_neighbors: usize) -> Self
Create a new anomaly detection service.
§Arguments
threshold- Score threshold above which points are considered anomalousk_neighbors- Number of neighbors for LOF computation
Sourcepub fn default_service() -> Self
pub fn default_service() -> Self
Create with default settings.
Sourcepub async fn detect_anomalies(
&self,
embeddings: &[EmbeddingWithId],
clusters: &[Cluster],
) -> Result<Vec<Anomaly>>
pub async fn detect_anomalies( &self, embeddings: &[EmbeddingWithId], clusters: &[Cluster], ) -> Result<Vec<Anomaly>>
Sourcepub async fn compute_lof(
&self,
embeddings: &[EmbeddingWithId],
) -> Result<HashMap<EmbeddingId, f32>>
pub async fn compute_lof( &self, embeddings: &[EmbeddingWithId], ) -> Result<HashMap<EmbeddingId, f32>>
Compute local outlier factor for embeddings.
Sourcepub fn classify_anomaly(
&self,
anomaly: &Anomaly,
cluster_member_count: usize,
) -> AnomalyType
pub fn classify_anomaly( &self, anomaly: &Anomaly, cluster_member_count: usize, ) -> AnomalyType
Classify the type of anomaly based on context.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AnomalyDetectionService
impl RefUnwindSafe for AnomalyDetectionService
impl Send for AnomalyDetectionService
impl Sync for AnomalyDetectionService
impl Unpin for AnomalyDetectionService
impl UnwindSafe for AnomalyDetectionService
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