utils.tracker#
This module gathers objects to keep track of incremental / sequential data
- class utils.tracker.ExponentialSmoothingTracker(alpha)[source]#
Bases:
TrackerA Tracker that applies Exponential Smoothing on the numeric input values.
- class utils.tracker.MultiValueTracker(base_tracker)[source]#
Bases:
TrackerA Tracker for storing multiple values at once in the form of a dict mapping from keys to individual Trackers.
- get_normalized()[source]#
Normalizes the tracked values by dividing them through the sum of the values.
- update(values)[source]#
Adds one value for tracked object to the tracker.
Note
Whenever the input dictionary contains a new key not stored in the Tracker, it will be added to its storage.
- Parameters:
values (dict) – A dictionary mapping from keys to numeric values to be added to the tracker.
- Return type:
Tracker
- class utils.tracker.SlidingWindowTracker(k)[source]#
Bases:
TrackerA 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.
- 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.
- class utils.tracker.WelfordTracker[source]#
Bases:
TrackerA Tracker that applies Welford’s Algorithm to estimate the mean and variance of a sequence.
Notes
Taken and adapted from Ian Covert’s SAGE implementation.
- property mean#
Returns the mean of the stream.
- property std#
Returns the standard deviation of the stream.
- property var#
Returns the variance of the stream.
Modules
This module contains base Trackers |
|