Struct fbleau::estimates::nn_bound::NNBoundEstimator[][src]

pub struct NNBoundEstimator<D> where
    D: Fn(&ArrayView1<'_, f64>, &ArrayView1<'_, f64>) -> f64 + Send + Sync + Copy
{ /* fields omitted */ }

Defines an estimator that returns the NN bound by Cover&Hart.

This estimate is asymptotically guaranteed to lower bound the true Bayes risk.

Implementations

impl<D> NNBoundEstimator<D> where
    D: Fn(&ArrayView1<'_, f64>, &ArrayView1<'_, f64>) -> f64 + Send + Sync + Copy
[src]

pub fn new(
    test_x: &ArrayView2<'_, f64>,
    test_y: &ArrayView1<'_, Label>,
    distance: D,
    nlabels: usize
) -> NNBoundEstimator<D>
[src]

Create a new NN bound estimator.

Trait Implementations

impl<D> BayesEstimator for NNBoundEstimator<D> where
    D: Fn(&ArrayView1<'_, f64>, &ArrayView1<'_, f64>) -> f64 + Send + Sync + Copy
[src]

This implementation maps exactly that of KNNEstimator, except for get_error(), which returns the bound.

fn add_example(&mut self, x: &ArrayView1<'_, f64>, y: Label) -> Result<(), ()>[src]

Adds a new example.

fn get_error_count(&self) -> usize[src]

Returns the error count.

fn get_error(&self) -> f64[src]

Returns the error for the current k.

fn get_individual_errors(&self) -> Vec<bool>[src]

Returns the current errors for each test point.

Auto Trait Implementations

impl<D> !RefUnwindSafe for NNBoundEstimator<D>

impl<D> !Send for NNBoundEstimator<D>

impl<D> !Sync for NNBoundEstimator<D>

impl<D> Unpin for NNBoundEstimator<D> where
    D: Unpin

impl<D> !UnwindSafe for NNBoundEstimator<D>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.