Browse Source

fix AutoReg

master
lhenry15 4 years ago
parent
commit
ad605d7ab2
3 changed files with 10 additions and 3 deletions
  1. +0
    -1
      README.md
  2. +6
    -0
      tods/detection_algorithm/core/MultiAutoRegOD.py
  3. +4
    -2
      tods/tests/detection_algorithm/test_AutoRegODetect.py

+ 0
- 1
README.md View File

@@ -1,4 +1,3 @@

# TODS: Automated Time-series Outlier Detection System

<img width="500" src="./docs/img/tods_logo.png" alt="Logo" />


+ 6
- 0
tods/detection_algorithm/core/MultiAutoRegOD.py View File

@@ -154,6 +154,12 @@ class MultiAutoRegOD(CollectiveBaseDetector):
self.decision_scores_ = self._score_combination(
self._decison_mat_scalaled)

# print(self.decision_scores_.shape, self.left_inds_.shape, self.right_inds_.shape)
self.decision_scores_ = np.concatenate((np.zeros((self.window_size,)), self.decision_scores_))
self.left_inds_ = np.concatenate(((-self.window_size) * np.ones((self.window_size,)).astype(np.int), self.left_inds_))
self.right_inds_ = np.concatenate((np.zeros((self.window_size,)).astype(np.int), self.right_inds_))
# print(self.decision_scores_.shape, self.left_inds_.shape, self.right_inds_.shape)

self._process_decision_scores()
return self



+ 4
- 2
tods/tests/detection_algorithm/test_AutoRegODetect.py View File

@@ -28,10 +28,10 @@ class AutoRegODetectTestCase(unittest.TestCase):

self.X_train = d3m_dataframe({'data': [3., 4., 8., 16, 18, 13., 22., 36., 59., 128, 62, 67, 78, 100]},
columns=['data'], generate_metadata=True)
self.y_train = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
self.y_train = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
self.X_test = d3m_dataframe({'data': [3., 4., 8.6, 13.4, 22.5, 17, 19.2, 36.1, 127, -23, 59.2]},
columns=['data'], generate_metadata=True)
self.y_test = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0])
self.y_test = np.array([0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0])



@@ -46,6 +46,8 @@ class AutoRegODetectTestCase(unittest.TestCase):
self.prediction_labels = self.primitive.produce(inputs=self.X_test).value
self.prediction_score = self.primitive.produce_score(inputs=self.X_test).value

# print(self.prediction_labels)

self.collective_common_test = CollectiveCommonTest(model=self.primitive._clf,
X_train=self.X_train,
y_train=self.y_train,


Loading…
Cancel
Save