Skip to content

Commit 57b93c3

Browse files
committed
fix: corrections to anomaly evaluation
1 parent d8787e8 commit 57b93c3

File tree

3 files changed

+610
-40
lines changed

3 files changed

+610
-40
lines changed

notebooks/anomaly_detection.ipynb

Lines changed: 603 additions & 36 deletions
Large diffs are not rendered by default.

src/capymoa/anomaly/_online_isolation_forest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def train(self, instance: Instance):
9292
self._learn_batch(data)
9393
return
9494

95+
def __str__(self):
96+
return "Online Isolation Forest"
97+
9598
def predict(self, instance: Instance) -> Optional[LabelIndex]:
9699
pass
97100

src/capymoa/evaluation/evaluation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ def update(self, y_target_index: int, score: float):
559559
def metrics_header(self):
560560
performance_measurements = self.moa_evaluator.getPerformanceMeasurements()
561561
performance_names = [
562-
"".join(measurement.getName()) for measurement in performance_measurements
562+
_translate_metric_name("".join(measurement.getName()), to='capymoa')
563+
for measurement in performance_measurements
563564
]
564565
return performance_names
565566

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

581582
def auc(self):
582-
index = self.metrics_header().index("AUC")
583+
index = self.metrics_header().index("auc")
583584
return self.metrics()[index]
584585

585586
def s_auc(self):
586-
index = self.metrics_header().index("sAUC")
587+
index = self.metrics_header().index("s_auc")
587588
return self.metrics()[index]
588589

589590

590-
591591
class ClassificationWindowedEvaluator(ClassificationEvaluator):
592592
"""
593593
Uses the ClassificationEvaluator to perform a windowed evaluation.

0 commit comments

Comments
 (0)