Skip to main content

spatialrust_episode/
eval.rs

1//! Lightweight evaluation metrics for episodes.
2
3/// Named scalar evaluation metric.
4#[derive(Clone, Debug, PartialEq)]
5pub struct EvalMetric {
6    /// Metric name.
7    pub name: String,
8    /// Metric value.
9    pub value: f64,
10}
11
12/// Bundle of evaluation metrics.
13#[derive(Clone, Debug, Default, PartialEq)]
14pub struct EvalReport {
15    /// Metrics.
16    pub metrics: Vec<EvalMetric>,
17}
18
19impl EvalReport {
20    /// Creates an empty report.
21    #[must_use]
22    pub fn new() -> Self {
23        Self::default()
24    }
25
26    /// Pushes a metric.
27    pub fn push(&mut self, name: impl Into<String>, value: f64) {
28        self.metrics.push(EvalMetric { name: name.into(), value });
29    }
30}