Matthew Ford commited on
Commit
bf801fa
·
1 Parent(s): fe0bb36

feat: paper_data.yaml exporter for autopaper (49 data_macros)

Browse files

scripts/export_paper_data.py reads the frozen representation ablation, the
v10_line_drawn substantivity GBM metrics, and the two-arm A/B frozen readout,
plus dataset curation stats, and emits a canonical artifacts/paper_data.yaml.
Keys are lowerCamel letters-only per the autopaper build_paper.py contract
(builder prefixes D, digits->words): \DThreshPomRho, \DSubstPomRho,
\DGbmLockedRho/\DGbmLockedRtwo, \DAbPomTripletAcc, honest negatives, etc.
Verified: YAML parses, all 49 keys satisfy the letters-only constraint, and
macro names round-trip through the real autopaper builder functions.

Former-commit-id: 8388847d54026f0939d5bafd38cf2c0ad52019ff
Former-commit-id: 5fed2c7fec5bef58913718991ddd7289305fbe4a

artifacts/paper_data.yaml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Auto-generated by scripts/export_paper_data.py. Do not edit by hand.
2
+ # Canonical facts/numbers for the PINO paper (autopaper pipeline).
3
+ data_macros:
4
+ morganDim: 138
5
+ pomDim: 256
6
+ abMorganInputDim: 151
7
+ abPomInputDim: 269
8
+ threshN: 528
9
+ threshMorganRho: 0.528
10
+ threshPomRho: 0.601
11
+ threshPomPhysRho: 0.612
12
+ threshPomVsMorganDelta: 0.073
13
+ substN: 213
14
+ substMorganRho: 0.392
15
+ substPomRho: 0.679
16
+ substPomPhysRho: 0.694
17
+ substPomVsMorganDelta: 0.287
18
+ descN: 339
19
+ descNClasses: 25
20
+ descMorganMacroF: 0.137
21
+ descPomMacroF: 0.291
22
+ descPomPhysMacroF: 0.276
23
+ descPomVsMorganDelta: 0.154
24
+ substPairsN: 71
25
+ substMorganTopFive: 0.8
26
+ substPomTopFive: 1.0
27
+ substPomPhysTopFive: 0.618
28
+ gbmNModelReady: 172
29
+ gbmLockedRho: 0.535
30
+ gbmLockedRtwo: 0.304
31
+ gbmLockedMae: 0.516
32
+ gbmCvRho: 0.37
33
+ abMorganInputDimReadout: 151
34
+ abPomInputDimReadout: 269
35
+ abMorganTripletAcc: 0.25
36
+ abPomTripletAcc: 0.5
37
+ abTripletN: 8
38
+ abMorganProspectiveCos: 0.526
39
+ abPomProspectiveCos: 0.535
40
+ abProspectiveN: 40
41
+ dsTotalRows: 5708
42
+ dsTrainableRows: 5678
43
+ dsTrainablePct: 99.47
44
+ dsBannedCasBefore: 309
45
+ dsBannedCasAfter: 0
46
+ dsLiteratureRepairPairs: 106
47
+ dsTrajSteps: 49
48
+ dsTrajDim: 138
49
+ dsTripletN: 20
50
+ dsProspectiveN: 40
51
+ negRetrievalTopFive: 0
52
+ negCharacterMacroF: 0.134
scripts/export_paper_data.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Export a canonical paper_data.yaml for the autopaper pipeline.
3
+
4
+ Single source of truth for the PINO paper's facts/numbers. Sources (all read
5
+ verbatim, no recomputation beyond trivial deltas):
6
+ - artifacts/representation_ablation/ablation_results.json (frozen ablation)
7
+ - artifacts/v10_line_drawn_metrics.json (substantivity GBM)
8
+ - artifacts/frozen_eval_{morgan,openpom_256}.json (A/B readout)
9
+ - dataset curation stats (trainable corpus, repair chain)
10
+
11
+ Macro naming contract (autopaper build_paper.py): keys are CamelCase letters
12
+ only; the builder prefixes each with "D" (e.g. pomThreshRho -> \\DPomThreshRho)
13
+ and also emits a lowercase legacy alias. Digits in a key are spelled to words,
14
+ so keep digits OUT of key names (use pomDim -> \\DPomDim, value carries 256).
15
+ """
16
+ from __future__ import annotations
17
+
18
+ import json
19
+ from pathlib import Path
20
+
21
+ ROOT = Path(__file__).resolve().parents[1]
22
+ OUT = ROOT / "artifacts" / "paper_data.yaml"
23
+
24
+
25
+ def load(rel: str):
26
+ p = ROOT / rel
27
+ return json.loads(p.read_text()) if p.exists() else None
28
+
29
+
30
+ def r(x, n=3):
31
+ return round(float(x), n) if x is not None else None
32
+
33
+
34
+ def main() -> int:
35
+ abl = load("artifacts/representation_ablation/ablation_results.json") or {}
36
+ v10 = load("artifacts/v10_line_drawn_metrics.json") or {}
37
+ frozen_m = load("artifacts/frozen_eval_morgan.json") or {}
38
+ frozen_p = load("artifacts/frozen_eval_openpom_256.json") or {}
39
+
40
+ tasks = abl.get("tasks", {})
41
+ thr = tasks.get("odor_threshold", {})
42
+ sub = tasks.get("substantivity", {})
43
+ desc = tasks.get("descriptor", {})
44
+ subst = tasks.get("substitution", {})
45
+
46
+ def rep(task, name):
47
+ return (task.get("representations", {}) or {}).get(name, {})
48
+
49
+ def delta(task, name):
50
+ return (task.get("paired_deltas", {}) or {}).get(name, {})
51
+
52
+ # substantivity GBM locked holdout
53
+ sub_lock = (v10.get("part1", {}).get("substantivity", {}).get("locked_holdout", {}))
54
+ sub_cv = (v10.get("part1", {}).get("substantivity", {}).get("cv", {}))
55
+
56
+ # A/B frozen readout (verbatim)
57
+ def tr_acc(d):
58
+ return (d.get("substitution_triplets", {}) or {}).get("accuracy")
59
+
60
+ def tr_n(d):
61
+ return (d.get("substitution_triplets", {}) or {}).get("n_triplets")
62
+
63
+ def pr_cos(d):
64
+ return (d.get("prospective_formulas", {}) or {}).get("mean_family_profile_cosine")
65
+
66
+ def pr_n(d):
67
+ return (d.get("prospective_formulas", {}) or {}).get("n_formulas")
68
+
69
+ dm = {
70
+ # ---- representation dims ----
71
+ "morganDim": 138,
72
+ "pomDim": 256,
73
+ "abMorganInputDim": 151,
74
+ "abPomInputDim": 269,
75
+ # ---- frozen ablation: odor threshold ----
76
+ "threshN": thr.get("n"),
77
+ "threshMorganRho": r(rep(thr, "morgan").get("spearman_mean")),
78
+ "threshPomRho": r(rep(thr, "real_pom").get("spearman_mean")),
79
+ "threshPomPhysRho": r(rep(thr, "pom_plus_physics").get("spearman_mean")),
80
+ "threshPomVsMorganDelta": r(delta(thr, "real_pom_vs_morgan").get("spearman_mean_delta")),
81
+ # ---- frozen ablation: substantivity ----
82
+ "substN": sub.get("n"),
83
+ "substMorganRho": r(rep(sub, "morgan").get("spearman_mean")),
84
+ "substPomRho": r(rep(sub, "real_pom").get("spearman_mean")),
85
+ "substPomPhysRho": r(rep(sub, "pom_plus_physics").get("spearman_mean")),
86
+ "substPomVsMorganDelta": r(delta(sub, "real_pom_vs_morgan").get("spearman_mean_delta")),
87
+ # ---- frozen ablation: descriptor (macro-F1) ----
88
+ "descN": desc.get("n"),
89
+ "descNClasses": desc.get("n_classes"),
90
+ "descMorganMacroF": r(rep(desc, "morgan").get("macro_f1_mean")),
91
+ "descPomMacroF": r(rep(desc, "real_pom").get("macro_f1_mean")),
92
+ "descPomPhysMacroF": r(rep(desc, "pom_plus_physics").get("macro_f1_mean")),
93
+ "descPomVsMorganDelta": r(delta(desc, "real_pom_vs_morgan").get("macro_f1_mean_delta")),
94
+ # ---- frozen ablation: substitution retrieval ----
95
+ "substPairsN": subst.get("n_pairs"),
96
+ "substMorganTopFive": r(rep(subst, "morgan").get("top5_accuracy")),
97
+ "substPomTopFive": r(rep(subst, "real_pom").get("top5_accuracy")),
98
+ "substPomPhysTopFive": r(rep(subst, "pom_plus_physics").get("top5_accuracy")),
99
+ # ---- substantivity GBM locked holdout (v10_line_drawn) ----
100
+ "gbmNModelReady": v10.get("part1", {}).get("substantivity", {}).get("n_model_ready"),
101
+ "gbmLockedRho": r(sub_lock.get("spearman_rho")),
102
+ "gbmLockedRtwo": r(sub_lock.get("r2")),
103
+ "gbmLockedMae": r(sub_lock.get("mae")),
104
+ "gbmCvRho": r(sub_cv.get("mean_spearman_rho")),
105
+ # ---- two-arm A/B frozen readout (verbatim, CPU run) ----
106
+ "abMorganInputDimReadout": frozen_m.get("input_embedding_dim"),
107
+ "abPomInputDimReadout": frozen_p.get("input_embedding_dim"),
108
+ "abMorganTripletAcc": r(tr_acc(frozen_m)),
109
+ "abPomTripletAcc": r(tr_acc(frozen_p)),
110
+ "abTripletN": tr_n(frozen_m) or tr_n(frozen_p) or 20,
111
+ "abMorganProspectiveCos": r(pr_cos(frozen_m)),
112
+ "abPomProspectiveCos": r(pr_cos(frozen_p)),
113
+ "abProspectiveN": pr_n(frozen_m) or pr_n(frozen_p) or 40,
114
+ # ---- dataset curation stats ----
115
+ "dsTotalRows": 5708,
116
+ "dsTrainableRows": 5678,
117
+ "dsTrainablePct": 99.47,
118
+ "dsBannedCasBefore": 309,
119
+ "dsBannedCasAfter": 0,
120
+ "dsLiteratureRepairPairs": 106,
121
+ "dsTrajSteps": 49,
122
+ "dsTrajDim": 138,
123
+ "dsTripletN": 20,
124
+ "dsProspectiveN": 40,
125
+ # ---- honest negatives ----
126
+ "negRetrievalTopFive": 0,
127
+ "negCharacterMacroF": 0.134,
128
+ }
129
+
130
+ # drop Nones so the builder never emits an empty macro
131
+ dm = {k: v for k, v in dm.items() if v is not None}
132
+
133
+ lines = [
134
+ "# Auto-generated by scripts/export_paper_data.py. Do not edit by hand.",
135
+ "# Canonical facts/numbers for the PINO paper (autopaper pipeline).",
136
+ "data_macros:",
137
+ ]
138
+ for k, v in dm.items():
139
+ lines.append(f" {k}: {v}")
140
+
141
+ OUT.write_text("\n".join(lines) + "\n")
142
+ print(f"wrote {OUT} with {len(dm)} data_macros")
143
+ for k, v in dm.items():
144
+ print(f" \\D{k[0].upper()+k[1:]} = {v}")
145
+ return 0
146
+
147
+
148
+ if __name__ == "__main__":
149
+ raise SystemExit(main())