pub struct StatisticalAnalyzer<T: Float + Debug + Send + Sync + 'static> { /* private fields */ }Expand description
Statistical analyzer for evaluation results
analysis_methods and multiple_comparison were configuration the analyzer
stored and never consulted: it always produced descriptive statistics and
never corrected a p-value, whatever they said. Both now drive behaviour —
see StatisticalAnalyzer::analyze and
StatisticalAnalyzer::adjusted_p_values — and the recorded
StatisticalTests they operate on are readable through
StatisticalAnalyzer::tests.
Implementations§
Source§impl<T: Float + Debug + Default + Sum + Send + Sync> StatisticalAnalyzer<T>
impl<T: Float + Debug + Default + Sum + Send + Sync> StatisticalAnalyzer<T>
Sourcepub fn analysis_methods(&self) -> &[AnalysisMethod]
pub fn analysis_methods(&self) -> &[AnalysisMethod]
Analyses this analyzer performs, in order.
Sourcepub fn set_analysis_methods(
&mut self,
methods: Vec<AnalysisMethod>,
) -> Result<()>
pub fn set_analysis_methods( &mut self, methods: Vec<AnalysisMethod>, ) -> Result<()>
Choose which analyses StatisticalAnalyzer::analyze performs.
Only the methods this analyzer actually implements are accepted. Enabling
one it cannot perform is reported as OptimError::NotImplemented rather
than accepted and silently skipped, which would let a caller believe a
regression or cluster analysis had run.
Sourcepub fn analyze(&self, values: &[T]) -> Result<AnalysisReport<T>>
pub fn analyze(&self, values: &[T]) -> Result<AnalysisReport<T>>
Run every enabled analysis over values.
Sourcepub fn tests(&self) -> &[StatisticalTest<T>]
pub fn tests(&self) -> &[StatisticalTest<T>]
Recorded statistical tests, in the order they were added.
Sourcepub fn multiple_comparison(&self) -> &MultipleComparisonCorrection
pub fn multiple_comparison(&self) -> &MultipleComparisonCorrection
Multiple-comparison correction applied by
StatisticalAnalyzer::adjusted_p_values.
Sourcepub fn set_multiple_comparison(
&mut self,
correction: MultipleComparisonCorrection,
)
pub fn set_multiple_comparison( &mut self, correction: MultipleComparisonCorrection, )
Choose the multiple-comparison correction.
Sourcepub fn adjusted_p_values(&self) -> Result<Vec<T>>
pub fn adjusted_p_values(&self) -> Result<Vec<T>>
p-values of the recorded tests after the configured multiple-comparison correction, in the order the tests were added.
Every correction is closed-form and clamped to [0, 1]:
None— the raw p-values.Bonferroni—m * p.Sidak—1 - (1 - p)^m.HolmBonferroni— step-down(m - i) * p, made monotone.BenjaminiHochberg— step-upm * p / (i + 1), made monotone.BenjaminiYekutieli— Benjamini-Hochberg scaled by the harmonic numbersum_{k=1..m} 1/k, which is the dependence-robust variant.
Sourcepub fn significant_tests(&self, alpha: T) -> Result<Vec<usize>>
pub fn significant_tests(&self, alpha: T) -> Result<Vec<usize>>
Indices of the tests whose adjusted p-value is at or below alpha.
Sourcepub fn add_test(&mut self, test: StatisticalTest<T>)
pub fn add_test(&mut self, test: StatisticalTest<T>)
Add a statistical test
Sourcepub fn get_threshold(&self, name: &str) -> Option<T>
pub fn get_threshold(&self, name: &str) -> Option<T>
Get significance threshold
Sourcepub fn set_threshold(&mut self, name: String, value: T)
pub fn set_threshold(&mut self, name: String, value: T)
Set significance threshold
Sourcepub fn compute_descriptive_stats(
&self,
values: &[T],
) -> Result<DescriptiveStats<T>>
pub fn compute_descriptive_stats( &self, values: &[T], ) -> Result<DescriptiveStats<T>>
Compute descriptive statistics.
An empty sample yields an all-zero summary with count == 0, which the
caller can distinguish from a genuine all-zero sample. Fallible because the
sample size has to reach the element type to be a divisor; there is no
fallback divisor that would not silently report a different statistic.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for StatisticalAnalyzer<T>
impl<T> RefUnwindSafe for StatisticalAnalyzer<T>
impl<T> Send for StatisticalAnalyzer<T>
impl<T> Sync for StatisticalAnalyzer<T>
impl<T> Unpin for StatisticalAnalyzer<T>
impl<T> UnsafeUnpin for StatisticalAnalyzer<T>
impl<T> UnwindSafe for StatisticalAnalyzer<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more