pub struct DecisionEvidence {
pub log_bayes_factor: f64,
pub regime_contribution: f64,
pub timing_contribution: f64,
pub rate_contribution: f64,
pub explanation: String,
}Expand description
Evidence supporting a scheduler decision with Bayes factors.
This captures the mathematical reasoning behind coalesce/apply decisions, providing explainability for the regime-adaptive scheduler.
§Bayes Factor Interpretation
The log_bayes_factor represents log10(P(evidence|apply_now) / P(evidence|coalesce)):
- Positive values favor immediate apply (respond quickly)
- Negative values favor coalescing (wait for more events)
- |LBF| > 1 is “strong” evidence, |LBF| > 2 is “decisive”
§Example
let evidence = DecisionEvidence {
log_bayes_factor: 1.5, // Strong evidence to apply now
regime_contribution: 0.8,
timing_contribution: 0.5,
rate_contribution: 0.2,
explanation: "Steady regime with long idle interval".to_string(),
};Fields§
§log_bayes_factor: f64Log10 Bayes factor: positive favors apply, negative favors coalesce.
regime_contribution: f64Contribution from regime detection (Steady vs Burst).
timing_contribution: f64Contribution from timing (dt_ms, time since last render).
rate_contribution: f64Contribution from event rate.
explanation: StringHuman-readable explanation of the decision.
Implementations§
Source§impl DecisionEvidence
impl DecisionEvidence
Sourcepub fn favor_apply(regime: Regime, dt_ms: f64, event_rate: f64) -> Self
pub fn favor_apply(regime: Regime, dt_ms: f64, event_rate: f64) -> Self
Evidence strongly favoring immediate apply (Steady regime, long idle).
Sourcepub fn favor_coalesce(regime: Regime, dt_ms: f64, event_rate: f64) -> Self
pub fn favor_coalesce(regime: Regime, dt_ms: f64, event_rate: f64) -> Self
Evidence favoring coalescing (Burst regime, high rate).
Sourcepub fn forced_deadline(deadline_ms: f64) -> Self
pub fn forced_deadline(deadline_ms: f64) -> Self
Evidence for a forced deadline decision.
Sourcepub fn to_jsonl(
&self,
run_id: &str,
screen_mode: ScreenMode,
cols: u16,
rows: u16,
event_idx: u64,
) -> String
pub fn to_jsonl( &self, run_id: &str, screen_mode: ScreenMode, cols: u16, rows: u16, event_idx: u64, ) -> String
Serialize to JSONL format.
Sourcepub fn is_decisive(&self) -> bool
pub fn is_decisive(&self) -> bool
Check if evidence decisively supports the action (|LBF| > 2).
Trait Implementations§
Source§impl Clone for DecisionEvidence
impl Clone for DecisionEvidence
Source§fn clone(&self) -> DecisionEvidence
fn clone(&self) -> DecisionEvidence
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more