"""Prints the error of each retraining run against the number of clips. python3 ml/history.py DATASET_DIR/ml/history.jsonl """ import json import sys COLS = ["E", "rho", "h", "Lx", "Ly", "E/rho", "kappa", "area", "aspect"] rows = [json.loads(l) for l in open(sys.argv[1]) if l.strip()] print(f"{'time':>5} {'clips':>5} " + " ".join(f"{c:>11}" for c in COLS) + " (rel RMS % / R^2)") for h in rows: m = h["metrics"] print(f"{h['finished'][11:16]:>5} {h['n_clips']:>5} " + " ".join(f"{m[c]['rel_rms_pct']:5.1f}/{m[c]['r2']:5.2f}" for c in COLS))