Skip to main content

Heuristic

Trait Heuristic 

Source
pub trait Heuristic: Send + Sync {
    // Required method
    fn compute(
        &self,
        cover: &mut Cover,
        candidates: &mut Vec<usize>,
    ) -> Vec<f64>;

    // Provided method
    fn compute_with_scorer(
        &self,
        parent_entropy: f64,
        cover: &mut Cover,
        candidates: &mut Vec<usize>,
        scorer: Box<dyn Fn(&[usize], &[usize], &[usize], f64) -> f64>,
        lower_is_better: bool,
    ) -> Vec<f64> { ... }
}
Expand description

Ranks candidate features at a node.

Required Methods§

Source

fn compute(&self, cover: &mut Cover, candidates: &mut Vec<usize>) -> Vec<f64>

Sorts candidates best first and returns their scores in the same order (empty when the heuristic does not score).

Provided Methods§

Source

fn compute_with_scorer( &self, parent_entropy: f64, cover: &mut Cover, candidates: &mut Vec<usize>, scorer: Box<dyn Fn(&[usize], &[usize], &[usize], f64) -> f64>, lower_is_better: bool, ) -> Vec<f64>

Scores each candidate with scorer and sorts them, ascending when lower_is_better and descending otherwise.

Trait Implementations§

Source§

impl From<SearchHeuristic> for Box<dyn Heuristic>

Source§

fn from(value: SearchHeuristic) -> Self

Converts to this type from the input type.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§