pub struct DriftMonitor { /* private fields */ }Expand description
Background monitor that periodically checks registered models for data drift.
Each registered model has a training distribution snapshot. The monitor re-checks the current distribution against the training snapshot at the configured interval.
Snapshots are capped at max_snapshot_size to bound memory usage.
When incoming data exceeds this limit, reservoir sampling retains a
representative subset.
Implementations§
Source§impl DriftMonitor
impl DriftMonitor
Sourcepub fn new(interval: Duration, callback: DriftCallback) -> Self
pub fn new(interval: Duration, callback: DriftCallback) -> Self
Creates a new DriftMonitor with the given check interval and callback.
Sourcepub fn with_max_snapshot_size(
interval: Duration,
callback: DriftCallback,
max_snapshot_size: usize,
) -> Self
pub fn with_max_snapshot_size( interval: Duration, callback: DriftCallback, max_snapshot_size: usize, ) -> Self
Creates a new DriftMonitor with a custom snapshot size limit.
Sourcepub fn register(
&self,
measurement: &str,
detector: DriftDetector,
training_snapshot: Vec<f64>,
)
pub fn register( &self, measurement: &str, detector: DriftDetector, training_snapshot: Vec<f64>, )
Registers a model for drift monitoring.
Sourcepub fn update_current(&self, measurement: &str, data: Vec<f64>)
pub fn update_current(&self, measurement: &str, data: Vec<f64>)
Updates the current data snapshot for a measurement.
Sourcepub fn check_all(&self) -> Vec<(String, DriftReport)>
pub fn check_all(&self) -> Vec<(String, DriftReport)>
Runs a single check cycle — evaluates all registered models for drift. Returns a list of drift reports for models where drift was detected.
Auto Trait Implementations§
impl !RefUnwindSafe for DriftMonitor
impl !UnwindSafe for DriftMonitor
impl Freeze for DriftMonitor
impl Send for DriftMonitor
impl Sync for DriftMonitor
impl Unpin for DriftMonitor
impl UnsafeUnpin for DriftMonitor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> ⓘ
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> ⓘ
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