Skip to main content

OptimalDepth2Tree

Trait OptimalDepth2Tree 

Source
pub trait OptimalDepth2Tree {
    // Required methods
    fn find_optimal_depth_one_tree(
        &self,
        min_sup: usize,
        cover: &mut Cover,
        provided_candidates: Option<&[usize]>,
    ) -> Result<Tree, FitError>;
    fn find_optimal_depth_two_tree(
        &self,
        min_sup: usize,
        cover: &mut Cover,
        provided_candidates: Option<&[usize]>,
    ) -> Result<Tree, FitError>;
    fn error(&self, distribution: &[usize]) -> (f64, f64);

    // Provided methods
    fn fit(
        &self,
        min_sup: usize,
        depth: usize,
        cover: &mut Cover,
        provided_candidates: Option<&[usize]>,
    ) -> Result<Tree, FitError> { ... }
    fn get_candidates(
        &self,
        cover: &mut Cover,
        min_sup: usize,
        provided_candidates: Option<&[usize]>,
    ) -> Vec<usize> { ... }
}
Expand description

A solver for trees of depth at most 2.

Required Methods§

Source

fn find_optimal_depth_one_tree( &self, min_sup: usize, cover: &mut Cover, provided_candidates: Option<&[usize]>, ) -> Result<Tree, FitError>

The best tree with a single test.

Source

fn find_optimal_depth_two_tree( &self, min_sup: usize, cover: &mut Cover, provided_candidates: Option<&[usize]>, ) -> Result<Tree, FitError>

The best tree with at most two levels of tests.

Source

fn error(&self, distribution: &[usize]) -> (f64, f64)

(error, prediction) of a leaf with the given class counts.

Provided Methods§

Source

fn fit( &self, min_sup: usize, depth: usize, cover: &mut Cover, provided_candidates: Option<&[usize]>, ) -> Result<Tree, FitError>

Finds the best tree of the given depth (1 or 2) on the instances of cover, using only provided_candidates when given.

Source

fn get_candidates( &self, cover: &mut Cover, min_sup: usize, provided_candidates: Option<&[usize]>, ) -> Vec<usize>

Features that split the instances of cover with at least min_sup instances on each side.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§