pub struct ScoreWithConfidence {
pub score: AnomalyScore,
pub trees_evaluated: usize,
pub stddev: f64,
pub stderr: f64,
}Expand description
Scored point plus the per-tree sample statistics behind it.
Serialisable under the serde feature so SIEM / audit sinks
can emit the full confidence context alongside the raw score.
Fields§
§score: AnomalyScoreMean anomaly score — identical to
crate::RandomCutForest::score’s output.
trees_evaluated: usizeNumber of trees that contributed (= ensemble size minus any empty trees).
stddev: f64Unbiased sample standard deviation across per-tree scores.
0.0 when only one tree contributed.
stderr: f64Standard error of the mean: stddev / sqrt(n). The width of
the z = 1.96 confidence interval is 2 · z · stderr.
Implementations§
Source§impl ScoreWithConfidence
impl ScoreWithConfidence
Sourcepub fn ci(&self, z: f64) -> (f64, f64)
pub fn ci(&self, z: f64) -> (f64, f64)
Symmetric confidence interval (lower, upper) at factor z.
The interval is clamped at zero on the lower side — anomaly
scores are non-negative by construction.
Sourcepub fn ci95(&self) -> (f64, f64)
pub fn ci95(&self) -> (f64, f64)
95 % CI — convenience wrapper around Self::ci with
DEFAULT_Z_FACTOR.
Sourcepub fn relative_stderr(&self) -> f64
pub fn relative_stderr(&self) -> f64
Relative stderr — stderr / max(|mean|, ε). Mirrors the
metric used by crate::RandomCutForest::score_early_term
so callers can compare the two paths.
Trait Implementations§
Source§impl Clone for ScoreWithConfidence
impl Clone for ScoreWithConfidence
Source§fn clone(&self) -> ScoreWithConfidence
fn clone(&self) -> ScoreWithConfidence
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScoreWithConfidence
impl Debug for ScoreWithConfidence
Source§impl<'de> Deserialize<'de> for ScoreWithConfidence
impl<'de> Deserialize<'de> for ScoreWithConfidence
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>,
Source§impl PartialEq for ScoreWithConfidence
impl PartialEq for ScoreWithConfidence
Source§impl Serialize for ScoreWithConfidence
impl Serialize for ScoreWithConfidence
impl Copy for ScoreWithConfidence
impl StructuralPartialEq for ScoreWithConfidence
Auto Trait Implementations§
impl Freeze for ScoreWithConfidence
impl RefUnwindSafe for ScoreWithConfidence
impl Send for ScoreWithConfidence
impl Sync for ScoreWithConfidence
impl Unpin for ScoreWithConfidence
impl UnsafeUnpin for ScoreWithConfidence
impl UnwindSafe for ScoreWithConfidence
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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