Skip to content

Commit

Permalink
Merge pull request #369 from lscheinkman/NUP-2576
Browse files Browse the repository at this point in the history
NUP-2576: Make sure anomalyScore is between 0 and 1
  • Loading branch information
lscheinkman authored Jul 22, 2020
2 parents a8cacbf + 1ee40e1 commit 408b677
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nab/detectors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def run(self):

detectorValues = self.handleRecord(inputData)

# Make sure anomalyScore is between 0 and 1
if not 0 <= detectorValues[0] <= 1:
raise ValueError(
f"anomalyScore must be a number between 0 and 1. "
f"Please verify if '{self.handleRecord.__qualname__}' method is "
f"returning a value between 0 and 1")

outputRow = list(row) + list(detectorValues)

rows.append(outputRow)
Expand Down

0 comments on commit 408b677

Please sign in to comment.