pub struct RunContext {
pub run_id: RunId,
pub root_seed: Option<u64>,
pub variant_id: Option<VariantId>,
pub prediction_store: InMemoryPredictionStore,
pub aggregated_prediction_store: InMemoryAggregatedPredictionStore,
pub lineage: InMemoryLineageRecorder,
pub score_collector: Vec<RegressionMetricReport>,
pub regression_target_records: Vec<RegressionTargetRecord>,
pub oof_average_blocks: Vec<OofAverageBlock>,
}Fields§
§run_id: RunId§root_seed: Option<u64>§variant_id: Option<VariantId>§prediction_store: InMemoryPredictionStore§aggregated_prediction_store: InMemoryAggregatedPredictionStore§lineage: InMemoryLineageRecorder§score_collector: Vec<RegressionMetricReport>Native per-fold/per-partition score reports collected during the run (when the host emits
regression_targets).
regression_target_records: Vec<RegressionTargetRecord>Per-fold y_true records, kept so cross-fold ensembles (the OOF average) can be scored.
oof_average_blocks: Vec<OofAverageBlock>The per-sample cross-fold OOF average blocks (+ y_true) collected alongside the scalar OOF
average reports — one per scored producer. Surfaced so the host can fill the (validation, avg)
row’s per-sample y_pred; populated by collect_cross_fold_validation_scores, empty otherwise.
Implementations§
Source§impl RunContext
impl RunContext
pub fn new(run_id: RunId, root_seed: Option<u64>) -> Self
Sourcepub fn collect_cross_fold_validation_scores(
&mut self,
partition_mode: FoldPartitionMode,
) -> Result<()>
pub fn collect_cross_fold_validation_scores( &mut self, partition_mode: FoldPartitionMode, ) -> Result<()>
Score the cross-fold OOF average from the collected per-fold validation predictions + targets
and append the reports (one per producer, fold_id = "avg") to the score collector, plus —
additively — the per-sample OOF average block + y_true each report was computed from to
oof_average_blocks (so the host can fill the (validation, avg)
row’s per-sample y_pred). Call after FIT_CV; a no-op when nothing was scored or no producer has
more than one fold.
partition_mode is the campaign’s FoldPartitionMode: Partition (KFold) requires a unique
per-producer OOF set, while Resampled (ShuffleSplit / repeated CV) permits a sample to be
validated in multiple folds (averaged when scored). Pass the plan’s
fold_set mode (default Partition when there is no fold set).
Sourcepub fn build_score_set(
&self,
plan_id: impl Into<String>,
selection_metric: Option<String>,
) -> Option<ScoreSet>
pub fn build_score_set( &self, plan_id: impl Into<String>, selection_metric: Option<String>, ) -> Option<ScoreSet>
Build a ScoreSet from the collected reports (or None if scoring was off / produced
nothing), e.g. to attach to the ExecutionBundle.
Trait Implementations§
Source§impl Clone for RunContext
impl Clone for RunContext
Source§fn clone(&self) -> RunContext
fn clone(&self) -> RunContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more