Skip to main content

ErrorMinimizer

Struct ErrorMinimizer 

Source
pub struct ErrorMinimizer<E>
where E: ErrorWrapper + ?Sized,
{ /* private fields */ }
Expand description

Depth-2 solver that minimises the error of the tree: the optimal tree of depth at most 2.

Implementations§

Source§

impl<E> ErrorMinimizer<E>
where E: ErrorWrapper + ?Sized,

Source

pub fn new(error_function: Box<E>) -> Self

A solver using error_function for the error of a leaf.

Trait Implementations§

Source§

impl Default for ErrorMinimizer<NativeError>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<E> OptimalDepth2Tree for ErrorMinimizer<E>
where E: ErrorWrapper + ?Sized,

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.
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.

Auto Trait Implementations§

§

impl<E> Freeze for ErrorMinimizer<E>
where E: ?Sized,

§

impl<E> RefUnwindSafe for ErrorMinimizer<E>
where E: RefUnwindSafe + ?Sized,

§

impl<E> Send for ErrorMinimizer<E>
where E: ?Sized,

§

impl<E> Sync for ErrorMinimizer<E>
where E: ?Sized,

§

impl<E> Unpin for ErrorMinimizer<E>
where E: ?Sized,

§

impl<E> UnsafeUnpin for ErrorMinimizer<E>
where E: ?Sized,

§

impl<E> UnwindSafe for ErrorMinimizer<E>
where E: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.