//! The core library for the weak learner in the boosting protocol.
use crate::Sample;
/// An interface that returns a struct of type `Hypothesis`.
pub trait WeakLearner {
/// Returned hypothesis generated by `self`.
type Hypothesis;
/// Defines the name of weak-learning algorithm.
fn name(&self) -> &str {
"Not specified"
}
/// Returns the information of boosting algorithm as `String`.
/// This method is used for [`Logger`](crate::research::Logger).
/// By default, this method returns `None`.
fn info(&self) -> Option<Vec<(&str, String)>> {
None
}
/// For classification, `WeakLearner::produce`
/// outputs an instance of `Classifier` trait
/// that achieves high accuracy
/// on the given distribution `dist`.
fn produce(&self, sample: &Sample, dist: &[f64])
-> Self::Hypothesis;
}