utils.tracker.sliding_window#

Classes

SlidingWindowTracker(k)

A sliding window tracker that stores the k last elements of the stream allowing for computation of the mean and variance of the last k values.

class utils.tracker.sliding_window.SlidingWindowTracker(k)[source]#

Bases: Tracker

A sliding window tracker that stores the k last elements of the stream allowing for computation of the mean and variance of the last k values.

__call__(*args, **kwargs)[source]#

Returns the current mean of the sliding window.

update(value_i)[source]#

Adds one value to the Tracker

Parameters:

value_i (int or float) – The numeric value to be added to the tracker.

Return type:

Tracker

property mean#

Returns the current mean of the sliding window.

property std#

Returns the standard deviation of the sliding window.

property var#

Returns the variance of the sliding window.