pub struct CalibrationHistory {
pub schema_version: String,
pub objective_metric: String,
pub steps: Vec<StepReport>,
pub best_loss_mean: Option<f64>,
pub best_loss_std: Option<f64>,
pub best_knob_values: BTreeMap<String, KnobValue>,
}Expand description
Persistable snapshot of a CalibrationLoop’s trajectory.
Fields§
§schema_version: StringSchema version of the file format. See
HISTORY_SCHEMA_VERSION.
objective_metric: StringObjective the loop was minimising — recorded so resume can refuse to load history whose objective differs from the runtime’s (would yield meaningless comparisons).
steps: Vec<StepReport>Per-step trajectory in order. Empty until the first
loop.step() returns.
best_loss_mean: Option<f64>Best loss mean seen so far. None if no step has produced
a measurement yet.
best_loss_std: Option<f64>Best loss std at the same time best_loss_mean was
recorded.
best_knob_values: BTreeMap<String, KnobValue>Knob values at the best-loss point. Maps config-tree path
→ value (stringified via KnobValue::to_yaml_string).
Implementations§
Source§impl CalibrationHistory
impl CalibrationHistory
Sourcepub fn from_loop(loop_: &CalibrationLoop) -> Self
pub fn from_loop(loop_: &CalibrationLoop) -> Self
Build a history snapshot from the current state of a
running CalibrationLoop. Cheap — clones the steps Vec
- best-tracker maps.
Sourcepub fn save(&self, path: &Path) -> Result<(), HistoryError>
pub fn save(&self, path: &Path) -> Result<(), HistoryError>
Serialise to path as pretty-printed JSON. Atomic: writes
to path.tmp first then renames, so an interruption mid-
write doesn’t corrupt the existing file.
Sourcepub fn load(path: &Path) -> Result<Self, HistoryError>
pub fn load(path: &Path) -> Result<Self, HistoryError>
Load from path. Rejects mismatched schema versions so a
resume against an incompatible file fails loud rather than
silent.
Sourcepub fn apply_to(&self, loop_: &mut CalibrationLoop) -> Result<(), HistoryError>
pub fn apply_to(&self, loop_: &mut CalibrationLoop) -> Result<(), HistoryError>
Apply this history to a fresh CalibrationLoop so the
loop resumes from where it stopped.
Caller is responsible for ensuring the loop’s objective + knob set + config match what was used when the history was produced; we check the objective metric name as a soft guard but full structural equality on the knob vector is out of scope for the first cut (the design doc deferred strict resume safety to Piece 5).
Trait Implementations§
Source§impl Clone for CalibrationHistory
impl Clone for CalibrationHistory
Source§fn clone(&self) -> CalibrationHistory
fn clone(&self) -> CalibrationHistory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CalibrationHistory
impl Debug for CalibrationHistory
Source§impl<'de> Deserialize<'de> for CalibrationHistory
impl<'de> Deserialize<'de> for CalibrationHistory
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CalibrationHistory
impl RefUnwindSafe for CalibrationHistory
impl Send for CalibrationHistory
impl Sync for CalibrationHistory
impl Unpin for CalibrationHistory
impl UnsafeUnpin for CalibrationHistory
impl UnwindSafe for CalibrationHistory
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.