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