diff options
author | Vratko Polak <vrpolak@cisco.com> | 2018-06-13 10:23:06 +0200 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2018-06-13 10:25:44 +0200 |
commit | 0e8d8a59fd6b8477b17a9222a5cfb0d94d24ff22 (patch) | |
tree | 4c0ed6254fc1f4db4d0d1a39d8fe949c9670cfdf /resources/tools/presentation/new/utils.py | |
parent | 6928c2b1620e5d020a19e944f416df6a1f4b85ad (diff) |
CSIT-1110: Fix dashboard anomaly count range
+ Dashboard tables should now report anomalies from last week only.
+ Changed handling of Nan to report regression.
Change-Id: I624b0bc84a93702a31fc79fd670bd645b963f1f7
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.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/resources/tools/presentation/new/utils.py b/resources/tools/presentation/new/utils.py index 83f4f6249b..a688928cda 100644 --- a/resources/tools/presentation/new/utils.py +++ b/resources/tools/presentation/new/utils.py @@ -211,17 +211,19 @@ def archive_input_data(spec): def classify_anomalies(data): """Process the data and return anomalies and trending values. - Gathers data into groups with common trend value. - Decorates first value in the group to be an outlier, regression, - normal or progression. + Gather data into groups with average as trend value. + Decorate values within groups to be normal, + the first value of changed average as a regression, or a progression. :param data: Full data set with unavailable samples replaced by nan. :type data: pandas.Series :returns: Classification and trend values :rtype: 2-tuple, list of strings and list of floats """ - bare_data = [sample for _, sample in data.iteritems() - if not np.isnan(sample)] + # Nan mean something went wrong. + # Use 0.0 to cause that being reported as a severe regression. + 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.reverse() # Just to use .pop() for FIFO. |