Skip to main content

Classifier

Trait Classifier 

Source
pub trait Classifier {
    // Required methods
    fn id(&self, feature: &str) -> Option<u32>;
    fn score(&self, features: &[u32]) -> f64;
}
Expand description

Scores the features of a decision: a source depends on a target when the score is above 0.

Required Methods§

Source

fn id(&self, feature: &str) -> Option<u32>

The number of a feature.

§Arguments
  • feature - The feature string.
§Returns

The number, or None for a feature the classifier does not know, which the parser then leaves out.

Source

fn score(&self, features: &[u32]) -> f64

The score of a decision.

§Arguments
  • features - The numbers of the features of the decision, in ascending order, each once.
§Returns

The score: above 0 when the source depends on the target.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C: Classifier + ?Sized> Classifier for &C

Source§

fn id(&self, feature: &str) -> Option<u32>

Source§

fn score(&self, features: &[u32]) -> f64

Implementors§