pub struct ExponentiallyWeightedMean { /* private fields */ }Expand description
Exponentially weighted moving average.
alpha must satisfy 0 < alpha <= 1. Smaller values give more weight to
the past; alpha = 1 reduces to a LastValue-like
tracker.
§Examples
use rill_ml::stats::ExponentiallyWeightedMean;
use rill_ml::OnlineStatistic;
let mut ew = ExponentiallyWeightedMean::new(0.5).unwrap();
ew.update(10.0).unwrap();
ew.update(20.0).unwrap();
// 10.0, then 0.5*20 + 0.5*10 = 15.0
assert!((ew.value() - 15.0).abs() < 1e-12);Implementations§
Trait Implementations§
Source§impl Clone for ExponentiallyWeightedMean
impl Clone for ExponentiallyWeightedMean
Source§fn clone(&self) -> ExponentiallyWeightedMean
fn clone(&self) -> ExponentiallyWeightedMean
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 moreSource§impl Debug for ExponentiallyWeightedMean
impl Debug for ExponentiallyWeightedMean
Auto Trait Implementations§
impl Freeze for ExponentiallyWeightedMean
impl RefUnwindSafe for ExponentiallyWeightedMean
impl Send for ExponentiallyWeightedMean
impl Sync for ExponentiallyWeightedMean
impl Unpin for ExponentiallyWeightedMean
impl UnsafeUnpin for ExponentiallyWeightedMean
impl UnwindSafe for ExponentiallyWeightedMean
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