pub struct QuantileNormF64 { /* private fields */ }Expand description
Quantile normalizer via P² estimator grid.
Maps values to approximate uniform [0, 1] by maintaining a grid of P² percentile estimators at uniformly spaced quantile points. The normalized value is the interpolated rank within the grid.
O(resolution) per update. Requires alloc.
§Examples
use nexus_stats_core::normalization::QuantileNormF64;
let mut qn = QuantileNormF64::builder().resolution(9).build().unwrap();
for i in 0..500 {
let _ = qn.update(i as f64);
}
let v = qn.update(250.0).unwrap();
assert!(v.is_some());Implementations§
Source§impl QuantileNormF64
impl QuantileNormF64
Sourcepub fn builder() -> QuantileNormF64Builder
pub fn builder() -> QuantileNormF64Builder
Creates a builder.
Sourcepub fn update(&mut self, sample: f64) -> Result<Option<f64>, DataError>
pub fn update(&mut self, sample: f64) -> Result<Option<f64>, DataError>
Feeds a sample to all grid estimators. Returns the approximate normalized rank in [0, 1] once primed.
§Errors
Returns DataError::NotANumber if the sample is NaN, or
DataError::Infinite if the sample is infinite.
Sourcepub fn normalize(&self, value: f64) -> Option<f64>
pub fn normalize(&self, value: f64) -> Option<f64>
Ranks an arbitrary value against current grid without updating state.
Returns None if not primed.
Sourcepub fn resolution(&self) -> usize
pub fn resolution(&self) -> usize
Number of quantile grid points.
Trait Implementations§
Source§impl Clone for QuantileNormF64
impl Clone for QuantileNormF64
Source§fn clone(&self) -> QuantileNormF64
fn clone(&self) -> QuantileNormF64
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QuantileNormF64
impl RefUnwindSafe for QuantileNormF64
impl Send for QuantileNormF64
impl Sync for QuantileNormF64
impl Unpin for QuantileNormF64
impl UnsafeUnpin for QuantileNormF64
impl UnwindSafe for QuantileNormF64
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
Mutably borrows from an owned value. Read more