pub struct ScoringEngine { /* private fields */ }Expand description
Engine that defines scoring axes and computes multi-axis scores.
Implementations§
Source§impl ScoringEngine
impl ScoringEngine
Sourcepub fn define_axes(&mut self, axes: Vec<(&str, f64)>)
pub fn define_axes(&mut self, axes: Vec<(&str, f64)>)
Define the scoring axes and their weights.
Replaces any previously defined axes.
Sourcepub fn score(
&self,
entity_id: &str,
values: &HashMap<String, f64>,
) -> ContinuousScore
pub fn score( &self, entity_id: &str, values: &HashMap<String, f64>, ) -> ContinuousScore
Score an entity by providing values for each defined axis.
Values not present in values default to 0.0. The composite score
is the weighted average of all axes. Confidence is the fraction of
defined axes that had values provided.
Sourcepub fn rank(scores: &mut [ContinuousScore])
pub fn rank(scores: &mut [ContinuousScore])
Sort a slice of scores by composite score in descending order.
Sourcepub fn get_outliers(
scores: &[ContinuousScore],
threshold: f64,
) -> Vec<&ContinuousScore>
pub fn get_outliers( scores: &[ContinuousScore], threshold: f64, ) -> Vec<&ContinuousScore>
Return scores whose composite value deviates from the mean by more
than threshold (in absolute terms).
Trait Implementations§
Source§impl Clone for ScoringEngine
impl Clone for ScoringEngine
Source§fn clone(&self) -> ScoringEngine
fn clone(&self) -> ScoringEngine
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 moreSource§impl Debug for ScoringEngine
impl Debug for ScoringEngine
Source§impl Default for ScoringEngine
impl Default for ScoringEngine
Source§impl<'de> Deserialize<'de> for ScoringEngine
impl<'de> Deserialize<'de> for ScoringEngine
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 ScoringEngine
impl RefUnwindSafe for ScoringEngine
impl Send for ScoringEngine
impl Sync for ScoringEngine
impl Unpin for ScoringEngine
impl UnsafeUnpin for ScoringEngine
impl UnwindSafe for ScoringEngine
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