From 684b0c050c53a1934ad322f69185bca9761b92fc Mon Sep 17 00:00:00 2001 From: Nevin Kollanoor Date: Wed, 2 May 2018 16:30:31 +0530 Subject: [PATCH] corrected minor bug where anomaly score returned could be negative when stdev is 0 --- .../algorithms/anomaly_detector_algorithms/exp_avg_detector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luminol/algorithms/anomaly_detector_algorithms/exp_avg_detector.py b/src/luminol/algorithms/anomaly_detector_algorithms/exp_avg_detector.py index f7870f9..39be708 100644 --- a/src/luminol/algorithms/anomaly_detector_algorithms/exp_avg_detector.py +++ b/src/luminol/algorithms/anomaly_detector_algorithms/exp_avg_detector.py @@ -77,7 +77,7 @@ def _compute_anom_data_decay_all(self): ema = utils.compute_ema(self.smoothing_factor, values) stdev = numpy.std(values) for i, (timestamp, value) in enumerate(self.time_series_items): - anom_score = abs((value - ema[i]) / stdev) if stdev else value - ema[i] + anom_score = abs((value - ema[i]) / stdev) if stdev else abs(value - ema[i]) anom_scores[timestamp] = anom_score self.anom_scores = TimeSeries(self._denoise_scores(anom_scores))