pub struct DriftDetector { /* private fields */ }Expand description
Drift detector using statistical distance measures.
§Examples
use aprender::metrics::drift::{DriftDetector, DriftConfig, DriftStatus};
use aprender::primitives::Vector;
let reference = Vector::from_slice(&[1.0, 2.0, 3.0, 4.0, 5.0]);
let detector = DriftDetector::new(DriftConfig::default());
// Similar distribution - no drift
let current = Vector::from_slice(&[1.1, 2.1, 3.0, 4.0, 5.1]);
let status = detector.detect_univariate(&reference, ¤t);
assert!(matches!(status, DriftStatus::NoDrift | DriftStatus::Warning { .. }));Implementations§
Source§impl DriftDetector
impl DriftDetector
Sourcepub fn new(config: DriftConfig) -> Self
pub fn new(config: DriftConfig) -> Self
Create a new drift detector.
Sourcepub fn detect_univariate(
&self,
reference: &Vector<f32>,
current: &Vector<f32>,
) -> DriftStatus
pub fn detect_univariate( &self, reference: &Vector<f32>, current: &Vector<f32>, ) -> DriftStatus
Detect drift in univariate data using normalized mean difference.
Uses (|mean_ref - mean_cur| / std_ref) as drift measure.
Sourcepub fn detect_multivariate(
&self,
reference: &Matrix<f32>,
current: &Matrix<f32>,
) -> (DriftStatus, Vec<DriftStatus>)
pub fn detect_multivariate( &self, reference: &Matrix<f32>, current: &Matrix<f32>, ) -> (DriftStatus, Vec<DriftStatus>)
Detect drift in multivariate data using feature-wise analysis.
Returns drift status for each feature and overall status.
Sourcepub fn detect_performance_drift(
&self,
baseline_scores: &[f32],
current_scores: &[f32],
) -> DriftStatus
pub fn detect_performance_drift( &self, baseline_scores: &[f32], current_scores: &[f32], ) -> DriftStatus
Detect performance drift using accuracy/score degradation.
Compares baseline performance to current performance.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DriftDetector
impl RefUnwindSafe for DriftDetector
impl Send for DriftDetector
impl Sync for DriftDetector
impl Unpin for DriftDetector
impl UnwindSafe for DriftDetector
Blanket Implementations§
§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
Mutably borrows from an owned value. Read more
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