repl.txt (883B)
1 2 {{alias}}( α ) 3 Returns an accumulator function which incrementally computes an 4 exponentially weighted mean, where α is a smoothing factor between 0 and 1. 5 6 If provided a value, the accumulator function returns an updated mean. If 7 not provided a value, the accumulator function returns the current mean. 8 9 If provided `NaN` or a value which, when used in computations, results in 10 `NaN`, the accumulated value is `NaN` for all future invocations. 11 12 Parameters 13 ---------- 14 α: number 15 Smoothing factor (value between 0 and 1). 16 17 Returns 18 ------- 19 acc: Function 20 Accumulator function. 21 22 Examples 23 -------- 24 > var accumulator = {{alias}}( 0.5 ); 25 > var v = accumulator() 26 null 27 > v = accumulator( 2.0 ) 28 2.0 29 > v = accumulator( -5.0 ) 30 -1.5 31 > v = accumulator() 32 -1.5 33 34 See Also 35 -------- 36