pub struct ConfidenceCalibrator { /* private fields */ }Expand description
Confidence calibrator — computes overall system confidence (0.0–1.0) from current metric values and forecast accuracy.
Confidence is used by the dispatch pipeline:
- <0.5 → conservative mode (prefer cached results, avoid risky operations)
- ≥0.5 → normal mode
The calibrator weights metrics by importance:
- Error rate (30%) — high weight, directly impacts reliability
- Coherence (20%) — cognitive stability
- CPU load (15%) — resource headroom
- Memory pressure (15%) — resource headroom
- Latency (10%) — responsiveness
- Swap/disk I/O (10%) — I/O health
Implementations§
Source§impl ConfidenceCalibrator
impl ConfidenceCalibrator
Sourcepub const fn with_smoothing(smoothing: f32) -> Self
pub const fn with_smoothing(smoothing: f32) -> Self
Create with custom smoothing factor.
Sourcepub fn update(&mut self, metrics: &[(MetricKind, f32)], forecast_accuracy: f32)
pub fn update(&mut self, metrics: &[(MetricKind, f32)], forecast_accuracy: f32)
Update the calibrator with current metric values and forecast accuracy.
Sourcepub const fn confidence(&self) -> f32
pub const fn confidence(&self) -> f32
Get the current confidence value (0.0–1.0).
Sourcepub fn is_conservative(&self) -> bool
pub fn is_conservative(&self) -> bool
Whether the system is in conservative mode (confidence < 0.5).
Sourcepub const fn state(&self) -> (f32, f32)
pub const fn state(&self) -> (f32, f32)
Current calibrator state (last_confidence, smoothing) for persistence.
Sourcepub const fn restore_state(&mut self, last_confidence: f32, smoothing: f32)
pub const fn restore_state(&mut self, last_confidence: f32, smoothing: f32)
Restore calibrator state from persisted values.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfidenceCalibrator
impl RefUnwindSafe for ConfidenceCalibrator
impl Send for ConfidenceCalibrator
impl Sync for ConfidenceCalibrator
impl Unpin for ConfidenceCalibrator
impl UnsafeUnpin for ConfidenceCalibrator
impl UnwindSafe for ConfidenceCalibrator
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
Mutably borrows from an owned value. Read more