pub struct Calibration { /* private fields */ }Expand description
Process-wide calibration store. Concurrent updates are serialized via
a single RwLock because update events are rare (one per keyhog calibrate invocation or per verifier outcome) and the locked region is
constant-time. We deliberately don’t shard via DashMap — the persisted
artifact is small enough that contention is a non-issue.
Implementations§
Source§impl Calibration
impl Calibration
pub fn empty() -> Self
pub fn load(path: &Path) -> Self
pub fn save(&self, path: &Path) -> Result<()>
Sourcepub fn record_true_positive(&self, detector_id: &str)
pub fn record_true_positive(&self, detector_id: &str)
Record a true positive for detector_id (α += 1).
Sourcepub fn record_false_positive(&self, detector_id: &str)
pub fn record_false_positive(&self, detector_id: &str)
Record a false positive for detector_id (β += 1).
Sourcepub fn confidence_multiplier(&self, detector_id: &str) -> f64
pub fn confidence_multiplier(&self, detector_id: &str) -> f64
Return the posterior mean for detector_id, falling back to 0.5
when no observations exist (uniform prior over a never-calibrated
detector). Callers MAY use this value as a confidence multiplier
inside the scanner’s confidence-scoring path; the live integration
is staged separately.
Sourcepub fn counters(&self, detector_id: &str) -> BetaCounters
pub fn counters(&self, detector_id: &str) -> BetaCounters
Return the full counters for detector_id (defaults to Beta(1, 1)).
Sourcepub fn entries(&self) -> Vec<(String, BetaCounters)>
pub fn entries(&self) -> Vec<(String, BetaCounters)>
Iterate every recorded (detector_id, counters). Useful for
keyhog calibrate --show.
Trait Implementations§
Source§impl Debug for Calibration
impl Debug for Calibration
Source§impl Default for Calibration
impl Default for Calibration
Source§fn default() -> Calibration
fn default() -> Calibration
Auto Trait Implementations§
impl !Freeze for Calibration
impl !RefUnwindSafe for Calibration
impl Send for Calibration
impl Sync for Calibration
impl Unpin for Calibration
impl UnsafeUnpin for Calibration
impl UnwindSafe for Calibration
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> 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<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>
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>
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