summaryrefslogtreecommitdiff
path: root/scripts/generate_paper_tables.py
diff options
context:
space:
mode:
authorhaoyuren <13851610112@163.com>2026-07-28 23:31:36 +0800
committerhaoyuren <13851610112@163.com>2026-07-28 23:31:36 +0800
commit489da71c7af8304a86ed761359614d71288425cf (patch)
tree87ae94b2fc3c44e41aa967426aeab1bcf337dc66 /scripts/generate_paper_tables.py
parent3b5f01cb4db9efc4ceb2ba17709bbfc82a63e660 (diff)
Add cluster bootstrap metrics, supplementary finite-time figure, teacher nested SEs
finite_time_supplement.py computes 95% cluster bootstrap intervals for the predictor metrics (resampling forward initializations within each cell) and renders the six-panel supplementary figure. The table generator gains the teacher-task nested-SE fragment, computed from the raw paired rows pulled from the experiment machine. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/generate_paper_tables.py')
-rw-r--r--scripts/generate_paper_tables.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/generate_paper_tables.py b/scripts/generate_paper_tables.py
index ed66dae..95a67c8 100644
--- a/scripts/generate_paper_tables.py
+++ b/scripts/generate_paper_tables.py
@@ -26,6 +26,9 @@ def parse_args() -> argparse.Namespace:
parser.add_argument(
"--lr-dir", type=Path, default=Path("outputs/learning_rate_compensation")
)
+ parser.add_argument(
+ "--teacher-dir", type=Path, default=Path("outputs/teacher_test_gap_sgd_T8000")
+ )
parser.add_argument("--outdir", type=Path, default=Path("outputs/tables"))
return parser.parse_args()
@@ -165,12 +168,39 @@ def learning_rate_table(lr_dir: Path, outdir: Path) -> None:
write_fragment(outdir / "learning_rate_regimes.tex", lines)
+def teacher_table(teacher_dir: Path, outdir: Path) -> None:
+ rows = [r for r in read_rows(teacher_dir / "runs.csv") if r["run_type"] == "fa"]
+ by: dict[int, dict[int, dict[str, list[float]]]] = defaultdict(
+ lambda: defaultdict(lambda: defaultdict(list))
+ )
+ for row in rows:
+ cell = by[int(row["width"])][int(row["init_seed"])]
+ cell["train"].append(float(row["train_gap_to_bp"]))
+ cell["test"].append(float(row["test_gap_to_bp"]))
+ lines = [
+ r"\begin{tabular}{@{}rcc@{}}",
+ r"\toprule",
+ r"Width & Train difference & Test difference \\",
+ r"\midrule",
+ ]
+ for width, by_init in sorted(by.items()):
+ train_means = [statistics.mean(v["train"]) for _, v in sorted(by_init.items())]
+ test_means = [statistics.mean(v["test"]) for _, v in sorted(by_init.items())]
+ lines.append(
+ f"{width} & \\({statistics.mean(train_means):.4f}\\pm{sem(train_means):.4f}\\) & "
+ f"\\({statistics.mean(test_means):.4f}\\pm{sem(test_means):.4f}\\) \\\\"
+ )
+ lines += [r"\bottomrule", r"\end{tabular}"]
+ write_fragment(outdir / "teacher_nested_se.tex", lines)
+
+
def main() -> None:
args = parse_args()
initialization_table(args.depth_dir, args.outdir)
finite_time_table(args.depth_dir, args.outdir)
cnn_table(args.cnn_dir, args.outdir)
learning_rate_table(args.lr_dir, args.outdir)
+ teacher_table(args.teacher_dir, args.outdir)
if __name__ == "__main__":