auto-sync 2026-07-04T06:15:18Z workspace (part 3)
Browse files
workspace/scripts/build_selector_diagnostic_sweep.py
CHANGED
|
@@ -20,6 +20,7 @@ DEFAULT_PATTERNS = (
|
|
| 20 |
"runs/ctt_base_context_obs_learned_dominance_chartcompat_obs_utility_task_envclip_k16_train_to_test/metrics.json",
|
| 21 |
"runs/ctt_base_context_obs_dominance_envclip_k16_train_to_test/metrics.json",
|
| 22 |
"runs/ctt_base_context_obs_dominance_envclip_k16_train_to_test_tau0/metrics.json",
|
|
|
|
| 23 |
"runs/ctt_base_context_obs_learned_dominance_*_tanh_train_to_test/metrics.json",
|
| 24 |
"runs/ctt_base_context_obs_dominance_tanh_train_to_test/metrics.json",
|
| 25 |
"runs/ctt_base_context_obs_learned_dominance_*_perdim_trainmax_train_to_test/metrics.json",
|
|
@@ -79,7 +80,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 79 |
json.dumps(_group_rows(rows, "family"), indent=2, sort_keys=True) + "\n"
|
| 80 |
)
|
| 81 |
(out_dir / "metrics_by_seed.json").write_text(
|
| 82 |
-
json.dumps(_group_rows(rows, "
|
| 83 |
)
|
| 84 |
(out_dir / "table.tex").write_text(_table(best_rows) + "\n")
|
| 85 |
(out_dir / "config.yaml").write_text(_config(args, metric_paths) + "\n")
|
|
@@ -137,6 +138,7 @@ def _row(path: Path) -> dict[str, Any]:
|
|
| 137 |
"run_path": str(path.parent),
|
| 138 |
"family": family,
|
| 139 |
"selector": selector,
|
|
|
|
| 140 |
"report_type": data.get("report_type", "unknown"),
|
| 141 |
"k": int(data.get("k") or _infer_k(run_name)),
|
| 142 |
"base_success": _num(summary.get("base_success")),
|
|
@@ -165,6 +167,8 @@ def _micro_summary(summary: dict[str, Any]) -> dict[str, Any]:
|
|
| 165 |
|
| 166 |
def _family(run_name: str, data: dict[str, Any]) -> str:
|
| 167 |
k = int(data.get("k") or _infer_k(run_name))
|
|
|
|
|
|
|
| 168 |
if "envclip_k16" in run_name:
|
| 169 |
return "K16 env_clip"
|
| 170 |
if "envclip" in run_name:
|
|
@@ -178,6 +182,9 @@ def _family(run_name: str, data: dict[str, Any]) -> str:
|
|
| 178 |
|
| 179 |
def _selector_name(run_name: str, data: dict[str, Any]) -> str:
|
| 180 |
report_type = str(data.get("report_type", ""))
|
|
|
|
|
|
|
|
|
|
| 181 |
if report_type == "dominance_calibrated_selector_eval":
|
| 182 |
tau_mode = str(data.get("tau_mode", "auto"))
|
| 183 |
return f"LCB {tau_mode}"
|
|
@@ -196,6 +203,24 @@ def _infer_k(run_name: str) -> int:
|
|
| 196 |
return 16 if "k16" in run_name else 8
|
| 197 |
|
| 198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
def _best_by_family(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
| 200 |
grouped: dict[str, list[dict[str, Any]]] = defaultdict(list)
|
| 201 |
for row in rows:
|
|
|
|
| 20 |
"runs/ctt_base_context_obs_learned_dominance_chartcompat_obs_utility_task_envclip_k16_train_to_test/metrics.json",
|
| 21 |
"runs/ctt_base_context_obs_dominance_envclip_k16_train_to_test/metrics.json",
|
| 22 |
"runs/ctt_base_context_obs_dominance_envclip_k16_train_to_test_tau0/metrics.json",
|
| 23 |
+
"runs/ctt_dominance_utility_energy_val_to_test_seed*/metrics.json",
|
| 24 |
"runs/ctt_base_context_obs_learned_dominance_*_tanh_train_to_test/metrics.json",
|
| 25 |
"runs/ctt_base_context_obs_dominance_tanh_train_to_test/metrics.json",
|
| 26 |
"runs/ctt_base_context_obs_learned_dominance_*_perdim_trainmax_train_to_test/metrics.json",
|
|
|
|
| 80 |
json.dumps(_group_rows(rows, "family"), indent=2, sort_keys=True) + "\n"
|
| 81 |
)
|
| 82 |
(out_dir / "metrics_by_seed.json").write_text(
|
| 83 |
+
json.dumps(_group_rows(rows, "seed"), indent=2, sort_keys=True) + "\n"
|
| 84 |
)
|
| 85 |
(out_dir / "table.tex").write_text(_table(best_rows) + "\n")
|
| 86 |
(out_dir / "config.yaml").write_text(_config(args, metric_paths) + "\n")
|
|
|
|
| 138 |
"run_path": str(path.parent),
|
| 139 |
"family": family,
|
| 140 |
"selector": selector,
|
| 141 |
+
"seed": _infer_seed(run_name, data),
|
| 142 |
"report_type": data.get("report_type", "unknown"),
|
| 143 |
"k": int(data.get("k") or _infer_k(run_name)),
|
| 144 |
"base_success": _num(summary.get("base_success")),
|
|
|
|
| 167 |
|
| 168 |
def _family(run_name: str, data: dict[str, Any]) -> str:
|
| 169 |
k = int(data.get("k") or _infer_k(run_name))
|
| 170 |
+
if "ctt_dominance_utility_energy" in run_name or "utility_energy" in run_name:
|
| 171 |
+
return f"K{k} env_clip utility-energy"
|
| 172 |
if "envclip_k16" in run_name:
|
| 173 |
return "K16 env_clip"
|
| 174 |
if "envclip" in run_name:
|
|
|
|
| 182 |
|
| 183 |
def _selector_name(run_name: str, data: dict[str, Any]) -> str:
|
| 184 |
report_type = str(data.get("report_type", ""))
|
| 185 |
+
if data.get("score_source") == "checkpoint" or "utility_energy" in run_name:
|
| 186 |
+
tau_mode = str(data.get("tau_mode", "auto"))
|
| 187 |
+
return f"checkpoint utility energy/LCB {tau_mode}, seed={_infer_seed(run_name, data)}"
|
| 188 |
if report_type == "dominance_calibrated_selector_eval":
|
| 189 |
tau_mode = str(data.get("tau_mode", "auto"))
|
| 190 |
return f"LCB {tau_mode}"
|
|
|
|
| 203 |
return 16 if "k16" in run_name else 8
|
| 204 |
|
| 205 |
|
| 206 |
+
def _infer_seed(run_name: str, data: dict[str, Any]) -> str:
|
| 207 |
+
seed = data.get("seed")
|
| 208 |
+
if seed is not None:
|
| 209 |
+
return str(seed)
|
| 210 |
+
marker = "seed"
|
| 211 |
+
if marker in run_name:
|
| 212 |
+
suffix = run_name.rsplit(marker, 1)[-1]
|
| 213 |
+
digits = []
|
| 214 |
+
for char in suffix:
|
| 215 |
+
if char.isdigit():
|
| 216 |
+
digits.append(char)
|
| 217 |
+
else:
|
| 218 |
+
break
|
| 219 |
+
if digits:
|
| 220 |
+
return "".join(digits)
|
| 221 |
+
return "pooled"
|
| 222 |
+
|
| 223 |
+
|
| 224 |
def _best_by_family(rows: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
| 225 |
grouped: dict[str, list[dict[str, Any]]] = defaultdict(list)
|
| 226 |
for row in rows:
|