aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/new/utils.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2018-06-13 13:04:01 +0200
committerTibor Frank <tifrank@cisco.com>2018-06-15 10:16:43 +0000
commita2a0ab1cdec3567dcad46c2000337707777aa0ca (patch)
tree8d6147d2fda535c5c32c432a4ea7f3ec3124c8d9 /resources/tools/presentation/new/utils.py
parent5120b1082aa70f6e75511e9d95a2a7c303e25f9a (diff)
CSIT-1110: Prepare for migrating the new detection
+ Do not declare BitCountingClassifier.classify() as class method. + Make BitCountingGroupList subclass of list. + Inherit from abstract classes whenever possible. + Drop unneeded imports. + Add module docstrings and class docstrings anywhere. + Add TODOs hinting at possible improvements. Change-Id: Iccfff5c0e7be0607d6cfa74314083fcfe5a4d7d9 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/tools/presentation/new/utils.py')
-rw-r--r--resources/tools/presentation/new/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/resources/tools/presentation/new/utils.py b/resources/tools/presentation/new/utils.py
index a688928cda..a4e24663b5 100644
--- a/resources/tools/presentation/new/utils.py
+++ b/resources/tools/presentation/new/utils.py
@@ -225,7 +225,7 @@ def classify_anomalies(data):
bare_data = [0.0 if np.isnan(sample) else sample
for _, sample in data.iteritems()]
# TODO: Put analogous iterator into jumpavg library.
- groups = BitCountingClassifier.classify(bare_data)
+ groups = BitCountingClassifier().classify(bare_data)
groups.reverse() # Just to use .pop() for FIFO.
classification = []
avgs = []
@@ -239,7 +239,7 @@ def classify_anomalies(data):
continue
if values_left < 1 or active_group is None:
values_left = 0
- while values_left < 1: # To ignore empty groups.
+ while values_left < 1: # Ignore empty groups (should not happen).
active_group = groups.pop()
values_left = len(active_group.values)
avg = active_group.metadata.avg