pub struct ForecastAccuracyTracker { /* private fields */ }Expand description
Forecast accuracy tracker — stores and queries accuracy metrics.
Implementations§
Source§impl ForecastAccuracyTracker
impl ForecastAccuracyTracker
Sourcepub fn with_max_staleness_nanos(self, nanos: i64) -> Self
pub fn with_max_staleness_nanos(self, nanos: i64) -> Self
Set the maximum staleness.
Sourcepub fn with_max_entries(self, max: usize) -> Self
pub fn with_max_entries(self, max: usize) -> Self
Set maximum stored metrics (FIFO eviction when exceeded).
Sourcepub fn record(&self, metrics: AccuracyMetrics)
pub fn record(&self, metrics: AccuracyMetrics)
Record an accuracy evaluation.
Sourcepub fn evaluate(
&self,
forecasted: &[f64],
actual: &[f64],
model_type: &str,
measurement: &str,
version: &str,
) -> Result<AccuracyMetrics, AnalyticsError>
pub fn evaluate( &self, forecasted: &[f64], actual: &[f64], model_type: &str, measurement: &str, version: &str, ) -> Result<AccuracyMetrics, AnalyticsError>
Evaluate accuracy from forecasted vs actual values and record.
§Errors
Returns AnalyticsError::Config if forecasted and actual have
different lengths.
Sourcepub fn all(&self) -> Vec<AccuracyMetrics>
pub fn all(&self) -> Vec<AccuracyMetrics>
Get all accuracy metrics.
Sourcepub fn for_measurement(&self, measurement: &str) -> Vec<AccuracyMetrics>
pub fn for_measurement(&self, measurement: &str) -> Vec<AccuracyMetrics>
Get accuracy metrics for a measurement.
Sourcepub fn latest(&self, measurement: &str) -> Option<AccuracyMetrics>
pub fn latest(&self, measurement: &str) -> Option<AccuracyMetrics>
Get the latest accuracy metric for a measurement.
Sourcepub fn stale_measurements(&self, known_measurements: &[&str]) -> Vec<String>
pub fn stale_measurements(&self, known_measurements: &[&str]) -> Vec<String>
Check for stale forecasts — returns measurements with no recent evaluation.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ForecastAccuracyTracker
impl !RefUnwindSafe for ForecastAccuracyTracker
impl Send for ForecastAccuracyTracker
impl Sync for ForecastAccuracyTracker
impl Unpin for ForecastAccuracyTracker
impl UnsafeUnpin for ForecastAccuracyTracker
impl UnwindSafe for ForecastAccuracyTracker
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