Skip to content

Commit

Permalink
fixed key error loading device detector
Browse files Browse the repository at this point in the history
  • Loading branch information
hahahannes committed Apr 24, 2024
1 parent 402543d commit c0c8d2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion algo/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_device_detectors(self, input_ids):
if device_detector:
return device_detector

self.device_detectors[input_ids] = AnomalyDetector(
device_detector = AnomalyDetector(
input_ids,
self.config.check_receive_time_outlier,
self.config.check_data_schema,
Expand All @@ -87,6 +87,8 @@ def get_device_detectors(self, input_ids):
self.config.data_path,
self.produce
)
self.device_detectors[input_ids] = device_detector
return device_detector

def setup_operator_start(self, data_path):
self.operator_start_time = utils.load_operator_start_time(data_path)
Expand Down
8 changes: 4 additions & 4 deletions algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ def load_data(self, current_stddev, current_mean, num_datepoints, first_data_tim
def point_is_anomalous_high(self, point):
if self.num_datepoints < 2:
return False
return point > self.current_mean + 3*self.current_stddev
return point > self.current_mean + 5*self.current_stddev

def point_is_anomalous_low(self, point):
if self.num_datepoints < 2:
return False
return point < self.current_mean - 3*self.current_stddev
return point < self.current_mean - 5*self.current_stddev

def get_upper_threshold(self):
return self.current_mean + 3*self.current_stddev
return self.current_mean + 5*self.current_stddev

def get_lower_threshold(self):
return self.current_mean + 3*self.current_stddev
return self.current_mean + 5*self.current_stddev

def update(self, point):
self.current_stddev = self.calculate_std(point, self.current_stddev, self.current_mean, self.num_datepoints)
Expand Down

0 comments on commit c0c8d2f

Please sign in to comment.