pub struct AccuracyTracker { /* private fields */ }Expand description
Accuracy tracker that monitors multiple models.
Thread-safe — models wrapped in RwLock.
Implementations§
Source§impl AccuracyTracker
impl AccuracyTracker
Sourcepub fn new(config: AccuracyTrackerConfig) -> Self
pub fn new(config: AccuracyTrackerConfig) -> Self
Creates a new accuracy tracker with the given configuration.
Sourcepub fn register_model(
&self,
measurement: &str,
model_name: &str,
created_at_epoch_secs: i64,
)
pub fn register_model( &self, measurement: &str, model_name: &str, created_at_epoch_secs: i64, )
Register a model for tracking.
Sourcepub fn add_observation(
&self,
measurement: &str,
model_name: &str,
actual: f64,
predicted: f64,
)
pub fn add_observation( &self, measurement: &str, model_name: &str, actual: f64, predicted: f64, )
Add an observation (actual vs predicted) for a tracked model.
Sourcepub fn metrics(
&self,
measurement: &str,
model_name: &str,
) -> Option<VersionAccuracy>
pub fn metrics( &self, measurement: &str, model_name: &str, ) -> Option<VersionAccuracy>
Get current accuracy metrics for a model.
Sourcepub fn needs_refit(&self, measurement: &str, model_name: &str) -> bool
pub fn needs_refit(&self, measurement: &str, model_name: &str) -> bool
Check if a model needs re-fitting based on sustained accuracy degradation.
Sourcepub fn is_stale(
&self,
measurement: &str,
model_name: &str,
now_epoch_secs: i64,
) -> bool
pub fn is_stale( &self, measurement: &str, model_name: &str, now_epoch_secs: i64, ) -> bool
Check if a model is stale (older than max_model_age_secs).
Sourcepub fn model_age_secs(
&self,
measurement: &str,
model_name: &str,
now_epoch_secs: i64,
) -> Option<i64>
pub fn model_age_secs( &self, measurement: &str, model_name: &str, now_epoch_secs: i64, ) -> Option<i64>
Get model age in seconds.
Sourcepub fn tracked_model_count(&self) -> usize
pub fn tracked_model_count(&self) -> usize
Number of tracked models.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AccuracyTracker
impl !RefUnwindSafe for AccuracyTracker
impl Send for AccuracyTracker
impl Sync for AccuracyTracker
impl Unpin for AccuracyTracker
impl UnsafeUnpin for AccuracyTracker
impl UnwindSafe for AccuracyTracker
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
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> ⓘ
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