Browse Source

minor fixes

pull/1/head
rozetko 7 years ago
parent
commit
37d7516dc5
  1. 2
      analytics/anomaly_model.py
  2. 2
      analytics/step_detector.py

2
analytics/anomaly_model.py

@ -76,7 +76,7 @@ class AnomalyModel:
self.model = self.create_algorithm()
self.model.fit(train_augmented, confidence)
if len(anomalies) > 0:
last_dataframe_time = dataframe.iloc[- 1]['timestamp']
last_dataframe_time = dataframe.iloc[-1]['timestamp']
last_prediction_time = int(last_dataframe_time.timestamp() * 1000)
else:
last_prediction_time = 0

2
analytics/step_detector.py

@ -138,7 +138,7 @@ class StepDetector:
self.__optimize_threshold(data, self.window_size, segments, contamination)
def __optimize_threshold(self, data, window_size, segments, contamination):
step_size = 3
step_size = window_size // 2
pattern = np.concatenate([[-1] * step_size, [1] * step_size])
corr_res = np.correlate(data, pattern, mode='same') / window_size
corr_res = np.concatenate((np.zeros(step_size), corr_res, np.zeros(step_size)))

Loading…
Cancel
Save