linkedin/luminol

Warn user on automatic modify of algorithm or parameters

devinaconley opened this issue · 0 comments

Please throw a warning message to the user when automatically modifying parameters or algorithms. Doing this silently makes it extremely difficulty to debug and fine-tune.

def _sanity_check(self):
"""
Check if there are enough data points.
"""
windows = self.lag_window_size + self.future_window_size
if (not self.lag_window_size or not self.future_window_size or self.time_series_length < windows or windows < DEFAULT_BITMAP_MINIMAL_POINTS_IN_WINDOWS):
raise exceptions.NotEnoughDataPoints
# If window size is too big, too many data points will be assigned a score of 0 in the first lag window
# and the last future window.
if self.lag_window_size > DEFAULT_BITMAP_MAXIMAL_POINTS_IN_WINDOWS:
self.lag_window_size = DEFAULT_BITMAP_MAXIMAL_POINTS_IN_WINDOWS
if self.future_window_size > DEFAULT_BITMAP_MAXIMAL_POINTS_IN_WINDOWS:
self.future_window_size = DEFAULT_BITMAP_MAXIMAL_POINTS_IN_WINDOWS

def _detect(self, score_only):
"""
Detect anomaly periods.
:param bool score_only: if true, only anomaly scores are computed.
"""
try:
algorithm = self.algorithm(**self.algorithm_params)
self.anom_scores = algorithm.run()
except exceptions.NotEnoughDataPoints:
algorithm = anomaly_detector_algorithms['default_detector'](self.time_series)
self.threshold = self.threshold or ANOMALY_THRESHOLD['default_detector']
self.anom_scores = algorithm.run()
if not score_only:
self._detect_anomalies()