pub mod knn;
pub mod knn_utils;
pub mod nn_bound;
pub mod frequentist;
pub mod convergence;
pub use self::knn::KNNEstimator;
pub use self::nn_bound::NNBoundEstimator;
pub use self::frequentist::FrequentistEstimator;
pub use self::convergence::ForwardChecker;
pub use self::knn_utils::*;
use crate::Label;
use ndarray::prelude::*;
#[derive(Deserialize)]
#[serde(rename_all="lowercase")]
pub enum Estimate {
NN,
KNN,
Frequentist,
#[serde(rename="nn-bound")]
NNBound,
}
pub trait BayesEstimator {
fn add_example(&mut self, x: &ArrayView1<f64>, y: Label) -> Result<(), ()>;
fn get_error_count(&self) -> usize;
fn get_error(&self) -> f64;
fn get_individual_errors(&self) -> Vec<bool>;
}
fn some_or_error<T>(opt: Option<T>) -> Result<T, ()> {
match opt {
Some(x) => Ok(x),
None => Err(()),
}
}