accumulator

This module accumulates statistical values to analyze its mean, standard deviation and moments.

class accumulator.Accumulator(num_moments=3, values=None)[source]

Accumulate values.

num_moments()[source]

Return the number of moments.

add(value)[source]

Add a value or values to the moments.

num_values()[source]

Return the number of values.

mean()[source]

Return the mean.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator()
>>> acc.add(1.)
>>> acc.add(2.)
>>> acc.add(4.)
>>> acc.add([3, 5, 7])
>>> acc.mean()
3.6666666666666665
stdev()[source]

Return the standard deviation.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator(values=[1, 2, 3, 4, 5, 7])
>>> acc.stdev()
2.160246899469287
sum_moment(power)[source]

Return the sum of the moment, x**power.

>>> from pyfeasst import accumulator
>>> acc = accumulator.Accumulator(values=[1, 2, 3, 4, 5, 7])
>>> acc.sum_moment(0)
6.0
>>> acc.sum_moment(1)
22.0
>>> acc.sum_moment(2)
104.0