pub struct EnsembleAnomalyDetector { /* private fields */ }Expand description
Ensemble anomaly detector combining multiple methods
Implementations§
Source§impl EnsembleAnomalyDetector
impl EnsembleAnomalyDetector
Sourcepub fn new(
detector_weights: HashMap<String, f64>,
voting_threshold: f64,
confidence_threshold: f64,
) -> Self
pub fn new( detector_weights: HashMap<String, f64>, voting_threshold: f64, confidence_threshold: f64, ) -> Self
Create a new ensemble anomaly detector
Sourcepub fn detect_ensemble_anomalies(
&self,
metrics: &HashMap<String, f64>,
detector_results: &HashMap<String, HashMap<String, AnomalyRecord>>,
timestamp: u64,
) -> Result<Vec<AnomalyRecord>>
pub fn detect_ensemble_anomalies( &self, metrics: &HashMap<String, f64>, detector_results: &HashMap<String, HashMap<String, AnomalyRecord>>, timestamp: u64, ) -> Result<Vec<AnomalyRecord>>
Detect ensemble anomalies by combining the actual results of the individual member detectors that ran for each metric.
detector_results maps metric_name -> (detector_name -> the AnomalyRecord that detector produced for this metric); a detector
that did not flag a metric (or was never configured for it) simply
has no entry, rather than a fabricated zero. The expected
detector_name keys match the private detector_weights field (by
convention, "statistical", "ml", "time_series" – see
AdvancedAnomalyDetector::detect_anomalies, the sole real caller,
which builds this map from its own per-metric detector runs).
For each metric with at least one flagging detector:
vote_fraction= (sum of weights of flagging detectors) / (sum of all configured weights). Must be>= self.voting_threshold.confidence= a saturating[0, 1)transform of the mean rawanomaly_scorereported by the flagging detectors (their scores live on different, unbounded scales – z-score, IQR-distance-ratio, etc. – so this puts them on a common, comparable footing). Must be>= self.confidence_threshold.
Only metrics that clear both real, configured thresholds produce an
ensemble AnomalyRecord (detection_method = "ensemble_weighted_vote").
Auto Trait Implementations§
impl Freeze for EnsembleAnomalyDetector
impl RefUnwindSafe for EnsembleAnomalyDetector
impl Send for EnsembleAnomalyDetector
impl Sync for EnsembleAnomalyDetector
impl Unpin for EnsembleAnomalyDetector
impl UnsafeUnpin for EnsembleAnomalyDetector
impl UnwindSafe for EnsembleAnomalyDetector
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.