discountAverage

utils.discountAverage(data, discount)[source]

An accumulating mean

Parameters:
  • data (list or 1-D array of floats) – The set of values to be averaged
  • discount (float) – The value by which each previous value is discounted
Returns:

results – The values from the moving average

Return type:

ndArray of length data

Examples

>>> discountAverage([1, 2, 3, 4], 1)
array([1. , 1.5, 2. , 2.5])
>>> discountAverage([1, 2, 3, 4], 0.25)
array([1.        , 1.8       , 2.71428571, 3.68235294])