pub struct ConformalGuard { /* private fields */ }Expand description
Calibration window for conformal guard.
Implementations§
Source§impl ConformalGuard
impl ConformalGuard
Sourcepub fn new(window_size: usize, alpha: f64) -> Self
pub fn new(window_size: usize, alpha: f64) -> Self
Create a new conformal guard with the given window size and significance level.
Sourcepub fn default_config() -> Self
pub fn default_config() -> Self
Default: 1000-element window, alpha=0.1 (90% coverage guarantee).
Sourcepub fn conformal_quantile(&self) -> Option<f64>
pub fn conformal_quantile(&self) -> Option<f64>
Compute the conformal quantile from the calibration window. Returns None if the window has fewer than 2 scores.
Sourcepub fn evaluate(&mut self, record: &DecisionRecord) -> ConformalPredictionSet
pub fn evaluate(&mut self, record: &DecisionRecord) -> ConformalPredictionSet
Evaluate a decision record against the conformal guard. Returns the prediction set and whether the Bayesian action is admissible.
Sourcepub fn empirical_coverage(&self) -> f64
pub fn empirical_coverage(&self) -> f64
Current empirical coverage rate.
Sourcepub fn calibration_count(&self) -> usize
pub fn calibration_count(&self) -> usize
Number of scores in the calibration window.
Sourcepub fn is_calibrated(&self) -> bool
pub fn is_calibrated(&self) -> bool
Whether the calibration window has sufficient data.
Sourcepub fn coverage_alert(&self) -> bool
pub fn coverage_alert(&self) -> bool
Whether coverage has dropped below target for the alert threshold.
Trait Implementations§
Source§impl Clone for ConformalGuard
impl Clone for ConformalGuard
Source§fn clone(&self) -> ConformalGuard
fn clone(&self) -> ConformalGuard
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConformalGuard
impl Debug for ConformalGuard
Source§impl<'de> Deserialize<'de> for ConformalGuard
impl<'de> Deserialize<'de> for ConformalGuard
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ConformalGuard
impl RefUnwindSafe for ConformalGuard
impl Send for ConformalGuard
impl Sync for ConformalGuard
impl Unpin for ConformalGuard
impl UnsafeUnpin for ConformalGuard
impl UnwindSafe for ConformalGuard
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more