From a2a0ab1cdec3567dcad46c2000337707777aa0ca Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Wed, 13 Jun 2018 13:04:01 +0200 Subject: 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 --- resources/tools/presentation/new/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'resources/tools/presentation/new/utils.py') 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 -- cgit 1.2.3-korg