Download code/c_summary.py from jamie33/926: direct link, hf CLI and curl.
- Browser
- Download file 5.14 kB
-
https://huggingface.co/datasets/jamie33/926/resolve/main/code/c_summary.py
- Command line
-
hf download hf://datasets/jamie33/926/code/c_summary.py
-
curl -L -o c_summary.py https://huggingface.co/datasets/jamie33/926/resolve/main/code/c_summary.py
5.14 kB
| """926/C — summary.md from C/results.json, C/seeds.csv, B (released diffusion weights) and T7 (sampling seeds).""" | |
| import csv | |
| import json | |
| from pathlib import Path | |
| import numpy as np | |
| R = Path("/home/hubin/926/results") | |
| T7 = Path("/home/hubin/JAMIETSENG/9.24torun/results/T7_best_of_five/results.json") | |
| def ci(d): | |
| return f"{d['delta']:+.4f} [{d['ci95_subject'][0]:+.4f}, {d['ci95_subject'][1]:+.4f}]" | |
| def main(): | |
| c = json.load(open(R / "C/results.json")) | |
| b = json.load(open(R / "B/results.json")) | |
| t7 = json.load(open(T7)) | |
| L = ["# C — more than one decoder\n", | |
| "All tests here are secondary (main endpoint = A). Unit = subject (12), 95% CI = subject bootstrap. " | |
| "Wrong category = (c+1) mod 72. Target / wrong means use the 16 train trials (objects 00–07) of that category.\n", | |
| "## Released Neuro-3D point-diffusion weights (200k), same split\n", | |
| f"From B (frozen decoder, 200 steps, identical sampling seed per input; {b['n_subjects']} subjects):\n", | |
| "| input | Chamfer-L2 | Δ vs paired [95% CI] |", "|---|---|---|"] | |
| t = b["per_condition"] | |
| L.append(f"| paired (4-trial avg) | {t['paired_4avg']['chamfer_l2']['mean']:.4f} | — |") | |
| for k, lab in (("same_category_swap", "same-category swap"), ("target_within", "target-class mean"), | |
| ("wrong_within", "wrong-class mean")): | |
| L.append(f"| {lab} | {t[k]['chamfer_l2']['mean']:.4f} | {ci(b['delta_vs_paired_4avg'][k]['chamfer_l2'])} |") | |
| L += ["\nSame pattern as on the modified Gaussian head: swap ≈ paired, target mean much better, wrong mean worse.\n", | |
| "## Three small baselines (seed mean over 5 encoder seeds)\n", | |
| "| decoder | input | category hit | Chamfer-L2 | Δ Chamfer vs paired [95% CI] | F@0.1 | EMD |", "|---|---|---|---|---|---|---|"] | |
| names = {"classify_medoid": "classify → train medoid", "latent_regression": "EEG → CLIP point latent (ridge) → nearest train object", | |
| "retrieval": "nearest train EEG → its object"} | |
| for dec, conds in c["fingerprint_seed_mean"].items(): | |
| for cond, v in conds.items(): | |
| m = v["mean"] | |
| d = ci(v["delta_chamfer_l2"]) if "delta_chamfer_l2" in v else "—" | |
| L.append(f"| {names[dec]} | {cond} | {m['category_hit']:.3f} | {m['chamfer_l2']:.4f} | {d} | {m['f01']:.4f} | {m['emd_256']:.4f} |") | |
| L += ["\nOn all three baselines the target-class mean beats paired by 0.057–0.069 with 12/12 subjects, and swap moves " | |
| "Chamfer by ≤ 0.0023. The wrong-class mean is only reliably worse for latent regression (+0.0092); for " | |
| "classify→medoid and retrieval it is indistinguishable from paired, because paired single-subject EEG already " | |
| "decodes near chance (category hit ≈ 2%, chance 1.4%), so there is little category signal left to remove.\n", | |
| "## Category readout, 5 training seeds (validation-safe encoders; test objects 08–09, 4-trial average)\n", | |
| "| seed | pool | top-1 | top-5 | top-10 | MRR | NLL |", "|---|---|---|---|---|---|---|"] | |
| rows = list(csv.DictReader(open(R / "C/seeds.csv"))) | |
| per = {} | |
| for r in rows: | |
| key = "pooled" if r["subject"] == "pooled12" else "single" | |
| per.setdefault((key, r["seed"]), []).append([float(r[k]) for k in ("top1", "top5", "top10", "mrr", "nll")]) | |
| agg = {"single": [], "pooled": []} | |
| for (key, seed), v in sorted(per.items(), key=lambda x: (x[0][0] != "single", int(x[0][1]))): | |
| m = np.mean(v, 0); agg[key].append(m) | |
| lab = "single-subject (mean of 12)" if key == "single" else "pooled 12 (mean posterior)" | |
| L.append(f"| {seed} | {lab} | " + " | ".join(f"{x:.4f}" for x in m) + " |") | |
| for key in ("single", "pooled"): | |
| a = np.array(agg[key]) | |
| L.append(f"| **mean ± std** | {key} | " + " | ".join(f"{x:.4f} ± {s:.4f}" for x, s in zip(a.mean(0), a.std(0, ddof=1))) + " |") | |
| L.append("\nChance: top-1 0.0139, top-5 0.069, top-10 0.139, NLL ln 72 = 4.277.\n") | |
| L += ["## Sampling seed (released diffusion, separate from training seeds)\n", | |
| "From 9.24torun/T7: same 200k weights, 12 subjects × 144 objects, 5 sampling seeds, 1000 steps, single sample per seed.\n", | |
| "| sampling seed | Chamfer-L1 | Chamfer-L2 | F@0.1 | EMD |", "|---|---|---|---|---|"] | |
| ps = t7["per_seed"] | |
| for s, v in ps.items(): | |
| L.append(f"| {s} | {v['chamfer_l1']:.4f} | {v['chamfer_l2']:.4f} | {v['f_at_01']:.4f} | {v['emd_256']:.4f} |") | |
| a = np.array([[v["chamfer_l1"], v["chamfer_l2"], v["f_at_01"], v["emd_256"]] for v in ps.values()]) | |
| L.append("| **mean ± std** | " + " | ".join(f"{x:.4f} ± {s:.4f}" for x, s in zip(a.mean(0), a.std(0, ddof=1))) + " |") | |
| L += ["\n## Second encoder / splat checkpoints\n", | |
| "None in the repository (EEG-to-3DGS, BrainGS, BrainSSD); recorded in `results/MISSING_CKPT.md`, no training started.\n", | |
| "Files: `results.json`, `seeds.csv`, `per_object.csv` (object-level, labelled as such)."] | |
| (R / "C/summary.md").write_text("\n".join(L) + "\n") | |
| print("\n".join(L)) | |
| if __name__ == "__main__": | |
| main() | |