Struct changeforest::ClassifierGain
source · [−]pub struct ClassifierGain<T: Classifier> {
pub classifier: T,
}Fields
classifier: TTrait Implementations
sourceimpl<T> ApproxGain for ClassifierGain<T> where
T: Classifier,
impl<T> ApproxGain for ClassifierGain<T> where
T: Classifier,
sourcefn gain_approx(
&self,
start: usize,
stop: usize,
guess: usize,
_: &[usize]
) -> ApproxGainResult
fn gain_approx(
&self,
start: usize,
stop: usize,
guess: usize,
_: &[usize]
) -> ApproxGainResult
Return an approximation of the classifier-likelihood based gain when splitting
segment [start, stop) for each split in split_candidates.
A single fit is generated with a split at guess.
sourceimpl<T> Gain for ClassifierGain<T> where
T: Classifier,
impl<T> Gain for ClassifierGain<T> where
T: Classifier,
sourcefn gain(&self, start: usize, stop: usize, split: usize) -> f64
fn gain(&self, start: usize, stop: usize, split: usize) -> f64
Return classifier-likelihood based gain when splitting segment [start, stop)
at split.
sourcefn model_selection(
&self,
optimizer_result: &OptimizerResult
) -> ModelSelectionResult
fn model_selection(
&self,
optimizer_result: &OptimizerResult
) -> ModelSelectionResult
Perform a permutation test.
We test whether the maximum observed gain from the first step in the
TwoStepSearch optimizer is significant. Using the maximum gain from the first
step instead allows us to do a proper permutation test with control of type I
error without fitting additional classifiers.
In the first step of the TwoStepSearch optimizer, three gain curves and
corresponding maximal gains are computed. The maximum gain of the first step
of TwoStepSearch is the maximum of these three gains, which are available as
the first three elements of optimizer_result.gain_results.
For each permutation, we shuffle the predictions (and thus the likelihoods) of each of the three initial classifier fits (using the same permutation), and compute the maximum of the three resulting maximal gains. We count the number of permutations where the resulting maximal gain was larger than the observed maximal gain to compute a p-value.
Auto Trait Implementations
impl<T> RefUnwindSafe for ClassifierGain<T> where
T: RefUnwindSafe,
impl<T> Send for ClassifierGain<T> where
T: Send,
impl<T> Sync for ClassifierGain<T> where
T: Sync,
impl<T> Unpin for ClassifierGain<T> where
T: Unpin,
impl<T> UnwindSafe for ClassifierGain<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more