Skip to content

Commit

Permalink
fix: corrections to anomaly evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
hmgomes committed Jul 29, 2024
1 parent d8787e8 commit 57b93c3
Show file tree
Hide file tree
Showing 3 changed files with 610 additions and 40 deletions.
639 changes: 603 additions & 36 deletions notebooks/anomaly_detection.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/capymoa/anomaly/_online_isolation_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def train(self, instance: Instance):
self._learn_batch(data)
return

def __str__(self):
return "Online Isolation Forest"

def predict(self, instance: Instance) -> Optional[LabelIndex]:
pass

Expand Down
8 changes: 4 additions & 4 deletions src/capymoa/evaluation/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ def update(self, y_target_index: int, score: float):
def metrics_header(self):
performance_measurements = self.moa_evaluator.getPerformanceMeasurements()
performance_names = [
"".join(measurement.getName()) for measurement in performance_measurements
_translate_metric_name("".join(measurement.getName()), to='capymoa')
for measurement in performance_measurements
]
return performance_names

Expand All @@ -579,15 +580,14 @@ def metrics_per_window(self):
return pd.DataFrame(self.result_windows, columns=self.metrics_header())

def auc(self):
index = self.metrics_header().index("AUC")
index = self.metrics_header().index("auc")
return self.metrics()[index]

def s_auc(self):
index = self.metrics_header().index("sAUC")
index = self.metrics_header().index("s_auc")
return self.metrics()[index]



class ClassificationWindowedEvaluator(ClassificationEvaluator):
"""
Uses the ClassificationEvaluator to perform a windowed evaluation.
Expand Down

0 comments on commit 57b93c3

Please sign in to comment.