pub struct ValidationMetrics {
pub validations_passed: AtomicU64,
pub validations_failed: AtomicU64,
pub relevancy_stats: HashMap<String, F64Stats>,
pub running_aggregates: HashMap<String, Mutex<RunningAgg>>,
}Expand description
Metrics for result validation, shared across fibers.
Fields§
§validations_passed: AtomicU64§validations_failed: AtomicU64§relevancy_stats: HashMap<String, F64Stats>Per-function lossless f64 statistics accumulators for relevancy scores. Exact precision — no quantization, no bucket rounding.
running_aggregates: HashMap<String, Mutex<RunningAgg>>Live aggregates (moving-window + all-time) per relevancy metric. These read non-destructively, so progress views can sample them every frame without disturbing the exact-precision stats above.
Implementations§
Source§impl ValidationMetrics
impl ValidationMetrics
Sourcepub fn new(
labels: &Labels,
functions: &[RelevancyFn],
k: usize,
r: Option<usize>,
) -> Self
pub fn new( labels: &Labels, functions: &[RelevancyFn], k: usize, r: Option<usize>, ) -> Self
Create metrics for the given relevancy functions.
The metric family name is the bare function name
(recall, precision, f1, …) — k and r are
carried as labels rather than baked into the
family identifier. This collapses every per-k
variant into a single family that consumers can
query with recall{k="10",r="10"} instead of the
awkward recall_at_10 synthesised name. r
defaults to k when the relevancy config doesn’t
declare it (r: was unset → first-k semantics).
Sourcepub fn assertions_only() -> Self
pub fn assertions_only() -> Self
Create metrics with no relevancy functions (assertions only).
Sourcepub fn record_relevancy(&self, metric_name: &str, score: f64)
pub fn record_relevancy(&self, metric_name: &str, score: f64)
Record a relevancy score for a named function. Updates both the lossless stats accumulator and the live running aggregate.
Sourcepub fn live_snapshot(&self) -> Vec<RelevancyLive>
pub fn live_snapshot(&self) -> Vec<RelevancyLive>
Snapshot all live relevancy aggregates without disturbing the accumulators. Safe to call every frame from the progress thread.
Auto Trait Implementations§
impl !Freeze for ValidationMetrics
impl RefUnwindSafe for ValidationMetrics
impl Send for ValidationMetrics
impl Sync for ValidationMetrics
impl Unpin for ValidationMetrics
impl UnsafeUnpin for ValidationMetrics
impl UnwindSafe for ValidationMetrics
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