Skip to main content

StatisticalAnalyzer

Struct StatisticalAnalyzer 

Source
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>

Source

pub fn analysis_methods(&self) -> &[AnalysisMethod]

Analyses this analyzer performs, in order.

Source

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.

Source

pub fn analyze(&self, values: &[T]) -> Result<AnalysisReport<T>>

Run every enabled analysis over values.

Source

pub fn tests(&self) -> &[StatisticalTest<T>]

Recorded statistical tests, in the order they were added.

Source

pub fn multiple_comparison(&self) -> &MultipleComparisonCorrection

Multiple-comparison correction applied by StatisticalAnalyzer::adjusted_p_values.

Source

pub fn set_multiple_comparison( &mut self, correction: MultipleComparisonCorrection, )

Choose the multiple-comparison correction.

Source

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-up m * p / (i + 1), made monotone.
  • BenjaminiYekutieli — Benjamini-Hochberg scaled by the harmonic number sum_{k=1..m} 1/k, which is the dependence-robust variant.
Source

pub fn significant_tests(&self, alpha: T) -> Result<Vec<usize>>

Indices of the tests whose adjusted p-value is at or below alpha.

Source

pub fn add_test(&mut self, test: StatisticalTest<T>)

Add a statistical test

Source

pub fn get_threshold(&self, name: &str) -> Option<T>

Get significance threshold

Source

pub fn set_threshold(&mut self, name: String, value: T)

Set significance threshold

Source

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§

Source§

impl<T: Debug + Float + Debug + Send + Sync + 'static> Debug for StatisticalAnalyzer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V