diff --git a/example/summary_metrics.py b/example/summary_metrics.py index 1cc5f7b..75d0502 100644 --- a/example/summary_metrics.py +++ b/example/summary_metrics.py @@ -16,14 +16,19 @@ def parse_last_row(history_path: Path): rows = history_path.read_text(encoding="utf-8").strip().splitlines() if len(rows) < 2: return None - last = rows[-1].split(",") - if len(last) < 4: - return None - return { - "avg_ks": float(last[1]), - "avg_jsd": float(last[2]), - "avg_lag1_diff": float(last[3]), - } + for line in reversed(rows[1:]): + parts = line.split(",") + if len(parts) < 4: + continue + try: + return { + "avg_ks": float(parts[1]), + "avg_jsd": float(parts[2]), + "avg_lag1_diff": float(parts[3]), + } + except Exception: + continue + return None def main():