Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "stats/incr/ewmean/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

accumulator

accumulator: (x?: undefined | number) => number | null

If provided a value, the accumulator function returns an updated mean. If not provided a value, the accumulator function returns the current mean.

Notes

  • If provided NaN or a value which, when used in computations, results in NaN, the accumulated value is NaN for all future invocations.
param

value

returns

mean value

Type declaration

    • (x?: undefined | number): number | null
    • Parameters

      • Optional x: undefined | number

      Returns number | null

Functions

Export assignment increwmean

  • Returns an accumulator function which incrementally computes an exponentially weighted mean.

    throws

    alpha must be on the interval [0,1]

    Parameters

    • alpha: number

      smoothing factor

    Returns accumulator

    accumulator function

    Example

    var accumulator = increwmean( 0.5 );
    
    var v = accumulator();
    // returns null
    
    v = accumulator( 2.0 );
    // returns 2.0
    
    v = accumulator( -5.0 );
    // returns -1.5
    
    v = accumulator();
    // returns -1.5