pub struct RunningStatsVec { /* private fields */ }Expand description
Per-dimension online running statistics using Welford’s algorithm.
Maintains independent mean/variance accumulators for each dimension,
enabling proper per-feature observation normalization as in SB3’s
RunningMeanStd.
Implementations§
Source§impl RunningStatsVec
impl RunningStatsVec
Sourcepub fn new(dim: usize) -> Self
pub fn new(dim: usize) -> Self
Create a new accumulator for vectors of the given dimensionality.
Sourcepub fn update(&mut self, values: &[f64])
pub fn update(&mut self, values: &[f64])
Update with a single sample of length dim (Welford per dimension).
§Panics
Panics if values.len() != dim.
Sourcepub fn batch_update(&mut self, data: &[f64], batch_size: usize)
pub fn batch_update(&mut self, data: &[f64], batch_size: usize)
Update with a flat batch of batch_size samples, each of dim dimensions.
data must have length batch_size * dim, laid out as
[sample0_dim0, sample0_dim1, ..., sample1_dim0, ...].
§Panics
Panics if data.len() != batch_size * dim.
Sourcepub fn normalize(&self, values: &[f64]) -> Vec<f64>
pub fn normalize(&self, values: &[f64]) -> Vec<f64>
Normalize a single sample: (values - mean) / max(std, 1e-8) per dimension.
§Panics
Panics if values.len() != dim.
Trait Implementations§
Source§impl Clone for RunningStatsVec
impl Clone for RunningStatsVec
Source§fn clone(&self) -> RunningStatsVec
fn clone(&self) -> RunningStatsVec
Returns a duplicate of the value. Read more
1.0.0 · 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 RunningStatsVec
impl RefUnwindSafe for RunningStatsVec
impl Send for RunningStatsVec
impl Sync for RunningStatsVec
impl Unpin for RunningStatsVec
impl UnwindSafe for RunningStatsVec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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