pub struct ResultAggregator {
pub strategy: AggregationStrategy,
pub confidence_threshold: f64,
pub detector_weights: HashMap<String, f64>,
}Expand description
Combines multiple DetectorResults into a single verdict.
Fields§
§strategy: AggregationStrategy§confidence_threshold: f64§detector_weights: HashMap<String, f64>Implementations§
Source§impl ResultAggregator
impl ResultAggregator
pub fn new(strategy: AggregationStrategy) -> Self
pub fn with_weights( strategy: AggregationStrategy, weights: HashMap<String, f64>, ) -> Self
pub fn with_threshold(self, threshold: f64) -> Self
Sourcepub fn aggregate(&self, results: &[DetectorResult]) -> AggregatedResult
pub fn aggregate(&self, results: &[DetectorResult]) -> AggregatedResult
Dispatch to the appropriate strategy implementation.
Sourcepub fn aggregate_majority_vote(
&self,
results: &[DetectorResult],
) -> AggregatedResult
pub fn aggregate_majority_vote( &self, results: &[DetectorResult], ) -> AggregatedResult
Majority vote: the most commonly reported threat category wins.
Only categories above confidence_threshold participate.
Sourcepub fn aggregate_weighted_vote(
&self,
results: &[DetectorResult],
) -> AggregatedResult
pub fn aggregate_weighted_vote( &self, results: &[DetectorResult], ) -> AggregatedResult
Weighted vote: each detector’s confidence is scaled by its weight. The threat category with the highest total weighted score wins.
Sourcepub fn aggregate_conservative(
&self,
results: &[DetectorResult],
) -> AggregatedResult
pub fn aggregate_conservative( &self, results: &[DetectorResult], ) -> AggregatedResult
Conservative: any detector flagging a threat above threshold -> threat. Picks the highest-severity threat found.
Sourcepub fn aggregate_permissive(
&self,
results: &[DetectorResult],
) -> AggregatedResult
pub fn aggregate_permissive( &self, results: &[DetectorResult], ) -> AggregatedResult
Permissive: all detectors above threshold must agree on the same threat category for it to be flagged.
Sourcepub fn aggregate_cascade(&self, results: &[DetectorResult]) -> AggregatedResult
pub fn aggregate_cascade(&self, results: &[DetectorResult]) -> AggregatedResult
Cascade: the first result whose confidence exceeds the threshold wins. Order is determined by input slice order.
Trait Implementations§
Source§impl Clone for ResultAggregator
impl Clone for ResultAggregator
Source§fn clone(&self) -> ResultAggregator
fn clone(&self) -> ResultAggregator
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResultAggregator
impl RefUnwindSafe for ResultAggregator
impl Send for ResultAggregator
impl Sync for ResultAggregator
impl Unpin for ResultAggregator
impl UnsafeUnpin for ResultAggregator
impl UnwindSafe for ResultAggregator
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