Skip to content

Commit e982f55

Browse files
committed
fix: bug in benchmark executor with saving registry
1 parent dde042b commit e982f55

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

pysatl_cpd/benchmark/core/benchmark_executor.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,20 @@ def execute(self) -> list[tuple[BenchmarkRecord, OnlineDetectionTrace[Any]]]:
178178

179179
results.append((record, trace))
180180

181-
if registry_path is not None:
182-
fieldnames = ["algorithm", "configuration_hash", "data", "threshold", "trace_path"]
183-
with open(registry_path, mode="w", encoding="utf-8", newline="") as f:
184-
writer = csv.DictWriter(f, fieldnames=fieldnames)
185-
writer.writeheader()
186-
for rec in registry.values():
187-
writer.writerow(
188-
{
189-
"algorithm": rec.algorithm,
190-
"configuration_hash": rec.configuration_hash,
191-
"data": rec.data,
192-
"threshold": rec.threshold,
193-
"trace_path": rec.trace_path or "",
194-
}
195-
)
181+
if registry_path is not None:
182+
fieldnames = ["algorithm", "configuration_hash", "data", "threshold", "trace_path"]
183+
with open(registry_path, mode="w", encoding="utf-8", newline="") as f:
184+
writer = csv.DictWriter(f, fieldnames=fieldnames)
185+
writer.writeheader()
186+
for rec in registry.values():
187+
writer.writerow(
188+
{
189+
"algorithm": rec.algorithm,
190+
"configuration_hash": rec.configuration_hash,
191+
"data": rec.data,
192+
"threshold": rec.threshold,
193+
"trace_path": rec.trace_path or "",
194+
}
195+
)
196196

197197
return results

pysatl_cpd/benchmark/metrics/classification/classification_report.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,4 @@ def aggregate(self, values: Sequence[dict[str, float]]) -> dict[str, float]:
5757
recall = total_tp / (total_tp + total_fn) if (total_tp + total_fn) > 0 else 0.0
5858
f1 = 2 * precision * recall / (precision + recall) if (precision + recall) > 0 else 0.0
5959

60-
print(total_fp)
61-
6260
return {"tp": total_tp, "fp": total_fp, "fn": total_fn, "precision": precision, "recall": recall, "f1": f1}

0 commit comments

Comments
 (0)