use crate::WeakLearner;
use std::ops::ControlFlow;
pub trait Booster<H> {
fn name(&self) -> &str;
fn info(&self) -> Option<Vec<(&str, String)>> {
None
}
type Output;
fn run<W>(
&mut self,
weak_learner: &W,
) -> Self::Output
where W: WeakLearner<Hypothesis = H>
{
self.preprocess(weak_learner);
let _ = (1..).try_for_each(|iter| {
self.boost(weak_learner, iter)
});
self.postprocess(weak_learner)
}
fn preprocess<W>(
&mut self,
weak_learner: &W,
)
where W: WeakLearner<Hypothesis = H>;
fn boost<W>(
&mut self,
weak_learner: &W,
iteration: usize,
) -> ControlFlow<usize>
where W: WeakLearner<Hypothesis = H>;
fn postprocess<W>(
&mut self,
weak_learner: &W,
) -> Self::Output
where W: WeakLearner<Hypothesis = H>;
}