Skip to content

Commit

Permalink
lower threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
shi-yu-wang committed Jun 12, 2024
1 parent 47e013c commit 0c0eb87
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/anomaly/test_dpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, *args, **kwargs):
transform=TransformSequence(
[TemporalResample("15min"), Shingle(size=3, stride=2), DifferenceTransform()]
),
threshold = AdaptiveAggregateAlarms(0.1)
threshold = AdaptiveAggregateAlarms(0.0001)
)
)

Expand Down Expand Up @@ -81,12 +81,7 @@ def test_full(self):
self.model.save(dirname=join(rootdir, "tmp", "dpad"))
loaded_model = DeepPointAnomalyDetector.load(dirname=join(rootdir, "tmp", "dpad"))
loaded_alarms = loaded_model.get_anomaly_label(self.test_data)
if sys.version_info[1] < 8:
n_loaded_alarms = sum(loaded_alarms.to_pd().values != 0)

if sys.version_info[1] >= 8:
n_loaded_alarms = np.sum(loaded_alarms.to_pd().values != 0)

n_loaded_alarms = sum(loaded_alarms.to_pd().values != 0)
self.assertAlmostEqual(n_loaded_alarms, n_alarms, delta=1)

# Evaluation
Expand All @@ -100,5 +95,4 @@ def test_full(self):
logging.basicConfig(
format="%(asctime)s (%(module)s:%(lineno)d) %(levelname)s: %(message)s", stream=sys.stdout, level=logging.DEBUG
)
unittest.main()

unittest.main()

0 comments on commit 0c0eb87

Please sign in to comment.