From 5a6fb2fc8c314cd6daa4a0deae8c8acc83f23f60 Mon Sep 17 00:00:00 2001 From: lamlvh Date: Tue, 27 Oct 2026 14:27:32 +0000 Subject: [PATCH] P2r main grid: runner, summary, results; close the P2r decision - scripts/11: check_rids guard; scripts 14/15 accept the protocol_p2r main grid (realizations 8-15) only when protocol_p2r and its inputs match the locked SHA-256 - scripts/run_p2r_main.sh: per-regime pipelines (posterior then training) on cuda:0/cuda:1 - scripts/18_summarize_p2r.py: H2a / H2b / H3 / sigma_a verdicts per the locked rules - docs/plan.md, report.html: H2a and H2b pass, sigma_a arm fails, no Pivot 1 - logs/index.csv: run records of the P2r grid Co-Authored-By: Claude Opus 5.5 --- docs/plan.md | 11 +- logs/index.csv | 52 ++++++ report.html | 14 +- scripts/11_run_d2.py | 25 +++ scripts/14_diag_posterior.py | 8 +- scripts/15_diag_train.py | 8 +- scripts/18_summarize_p2r.py | 317 +++++++++++++++++++++++++++++++++++ scripts/run_p2r_main.sh | 71 ++++++++ tests/test_protocol.py | 16 ++ 9 files changed, 509 insertions(+), 13 deletions(-) create mode 100644 scripts/18_summarize_p2r.py create mode 100755 scripts/run_p2r_main.sh diff --git a/docs/plan.md b/docs/plan.md index c7d313c..d149860 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -407,7 +407,7 @@ Chốt ngày 27/10/2026: toàn bộ bài, gồm cả review nội bộ và bản | --- | --- | --- | --- | --- | | **P0 Hạ tầng** | T2 26/10 (xong) | `git init`; tải dữ liệu iCloud về máy (SEGY, horizon, outputs); tái cấu trúc code (mục 7); khóa môi trường; bỏ đường dẫn Windows; unit test cho geometry (Set Point) và TD | Pipeline chạy end-to-end; manifest dữ liệu | — | | **P1 Audit + baseline đúng** | T2 26/10 (xong) | Geometry; so sánh các nguồn TD; wavelet và tần số trội; synthetic seismogram cho 4 giếng (QC tie); QC nhãn và quyết định D-1; LOWO cho B0, B1, B2, B3a–b; kiểm kê Volve | Ghi chú audit dữ liệu (thành mục 3 của bài); bảng baseline | **G-A (26/10, đã đánh giá):** baseline tái lập được (5 seed, có phương sai); đã ước lượng misregistration còn lại. *Nếu* sau tie tốt nhất misregistration còn < 1/8 chu kỳ ở mọi giếng **và** B3a ≈ B3b, thì H2 khó thể hiện trên F3: dồn trọng tâm sang D2 + D3. Kết quả: không pivot. | -| **P2 Lý thuyết + synthetic + RML v1** | T2 26/10 (lưới chính xong); chẩn đoán đến hết T3 27/10 | Chứng minh MĐ1/MĐ2; bộ sinh synthetic; RML M1/M2; B4/B5. Chẩn đoán sau G-B: học σ_a, σ_b; lưới stress trên dev (SNR thấp, ít anchor, rock physics sai). Cuối 27/10 chọn: khoá `protocol_p2r` và chạy lại D2 trên realization 8–15 qua đêm trên cuda:1, hoặc Pivot 1 | Kết quả synthetic, phase diagram v1; `protocol_p2r` hoặc quyết định pivot | **G-B (26/10, không đạt):** trong vùng drift thực tế, M2 hơn B3/B4 tốt nhất theo ngưỡng chốt trước (RMSE băng −10% hoặc PCC băng +0.05) ở ≥ 4/5 seed và đa số realization; không kém hơn 2% khi drift = 0. Luật trượt: chẩn đoán (λ, prior) có thời hạn (protocol cho tối đa 2 tuần; lịch nén rút còn đến hết 27/10), rồi chạy lại hoặc pivot (mục 9). | +| **P2 Lý thuyết + synthetic + RML v1** | T2 26/10 (lưới chính xong); chẩn đoán đến hết T3 27/10 | Chứng minh MĐ1/MĐ2; bộ sinh synthetic; RML M1/M2; B4/B5. Chẩn đoán sau G-B: học σ_a, σ_b; lưới stress trên dev (SNR thấp, ít anchor, rock physics sai). Ngày 27/10: đã khoá `protocol_p2r` và chạy lại D2 trên realization 8–15 (cuda:0 + cuda:1, xong 11:29); H2a và H2b đạt, không Pivot 1 (mục 12, ý 14) | Kết quả synthetic, phase diagram v1; `protocol_p2r` và `outputs/p2r/summary/` | **G-B (26/10, không đạt):** trong vùng drift thực tế, M2 hơn B3/B4 tốt nhất theo ngưỡng chốt trước (RMSE băng −10% hoặc PCC băng +0.05) ở ≥ 4/5 seed và đa số realization; không kém hơn 2% khi drift = 0. Luật trượt: chẩn đoán (λ, prior) có thời hạn (protocol cho tối đa 2 tuần; lịch nén rút còn đến hết 27/10), rồi chạy lại hoặc pivot (mục 9). | | **P3 F3 field** | T4 28/10 | Nested LOWO đầy đủ; ensemble; calibration; ablation; leave-one-anchor-out; volume kèm bất định. M3 hoãn, không đưa vào bài | Bảng và hình F3 | **G-C (cuối 28/10):** chiều cải thiện nhất quán với synthetic ở ≥ 3/4 giếng; coverage 80/90% nằm trong ±5% so với mức danh nghĩa | | **P4 Field 2** | T4 28/10 dựng pipeline (song song P3); T5 29/10 chạy | ROI Volve, tie, pipeline; chạy tập con B1, B3 tốt nhất, B4, B5, M2 | Bảng field 2 | **G-D (cuối 29/10):** báo cáo kết quả bất kể chiều nào; giới hạn phạm vi claim theo kết quả | | **P5 Viết** | Khung bài và mục audit, lý thuyết, D2 viết dần từ 27/10; viết chính T5 29/10 – T6 30/10 | Bản nháp, hình, phụ lục chứng minh, gói tái lập (code + config + dữ liệu dẫn xuất theo CC BY-SA 3.0) | Draft v1 (cuối 29/10), v2 (cuối 30/10) | Review nội bộ | @@ -595,3 +595,12 @@ Trạng thái ngày 26/10/2026. "Có" nghĩa là toàn văn nằm trong [`refs/` - **Chưa kiểm trong chẩn đoán:** σ_b chưa học hay stress; σ_a chỉ stress (3.5 / 14 ms), bản học trên F3 (≈ 0.4 ms, coi marker là chính xác) không đáng tin; stress rock physics sai mô hình bị cắt theo thứ tự cắt phạm vi ở mục 6 (mục 6 của danh sách). - **Giới hạn bằng chứng:** chẩn đoán chỉ có 2 realization dev nên chỉ dùng để thiết kế P2r, không làm kết quả. - **Liên quan tới pha P3 (F3 field, G-C):** "chiều cải thiện trên synthetic" của G-C lấy từ lưới chính P2r. Điều kiện coverage 80/90% trong ±5% của G-C nhiều khả năng trượt (dev: mọi ensemble under-cover); ngưỡng không nới, G-C báo cáo đúng như đã đặt. +13. **Lưới chính P2r (27/10/2026, xong 11:29 giờ máy chủ; cuda:0 + cuda:1):** `scripts/run_p2r_main.sh` chạy posterior SMC (P = 1024, K = 1) và huấn luyện (Oracle, B3b, B3c, B3c-R, B3d, B3d-Sa, M2-Sa; 5 seed) trên realization 8–15 cho 5 regime × c ∈ {0, 1, 2} × N ∈ {4, 16}, rồi nhánh σ_a (R10, c = 1, σ_a = 3.5 / 14 ms). Scripts 14/15 chỉ nhận 8–15 khi `protocol_p2r` và các input khớp SHA-256. `scripts/18_summarize_p2r.py` áp đúng luật H2a/H2b/H3 đã khoá → `outputs/p2r/summary/` (verdict.json, summary.md); chạy thử trên dev tái tạo đúng số dev ghi trong protocol. Kết quả báo cáo như ra, kể cả khi trượt. Học σ_a, σ_b và stress rock physics không chạy thêm: protocol đã khoá nên kết quả mới không đổi được luật, và chúng được ghi là giới hạn (`p2_outcome.untested_in_diagnosis`). +14. **Kết quả P2r (27/10/2026; `outputs/p2r/summary/`): mục "khoá protocol_p2r hoặc Pivot 1" đã đóng, không pivot.** + - **H2a: ĐẠT.** R10 ở c = 1, band RMSE của B3d-Sa chia cho point tie tốt nhất: 0.857 (N = 4) và 0.782 (N = 16); 5/5 seed, 6/8 (N = 4) và 8/8 (N = 16) realization; guard c = 0 là 0.83 / 0.79. R0 (0.888 / 0.888) và Rm5 (0.915 / 0.923, đạt nhờ ΔPCC +0.10 / +0.09) cũng đạt. M2-Sa đạt ở cả ba regime này theo cùng luật. + - **So với cả B3d (phụ):** R10 đạt; R0 với B3d-Sa 1/2 ô (M2-Sa 2/2, nhưng M2-Sa không thay được B3d-Sa); Rm5 0/2 (M2-Sa cũng 0/2). Claim "nhãn SMC hơn posterior neo của P2" chỉ cho R10. + - **Nhánh σ_a: trượt** (σ_a = 3.5 ms: 0.98 / 1.14; 14 ms: 0.99 / 0.93). Bài phải nói kết quả H2a cần σ_a được đặt đúng; đây là rủi ro chính cho G-C vì σ_a trên F3 không biết. + - **H2b: ĐẠT.** N = 16: 8/8 ô posterior rộng, ρ(σ_post, tỉ số) = −0.85, permutation p = 1e-4; ô hẹp 0.996. N = 4 (chỉ báo cáo): 6/8, ρ = −0.77. + - **Diễn giải bắt buộc:** B3d-Sa đã hơn point tie ở c = 0 (≈ 0.81), nên phần lớn lợi của H2a không do drift; phần gắn với drift là B3d-Sa gần Oracle và không đổi khi c tăng (R10, N = 16: 0.457 → 0.455) trong khi B3d xấu đi (0.484 → 0.675). Ở phần lớn ô rộng c = 1, lợi của H2b vượt cận 1/B(σ_post), nên không quy hết cho khử nhoè. c = 2 có cờ "unstable posterior", không là bằng chứng chính. + - **H3 (mô tả):** mọi ensemble, kể cả Oracle, under-cover (coverage 90% từ 0.31 đến 0.79, trung vị 0.47); không claim calibration. + - **Vận hành:** lưới bị ngắt lúc 09:44 khi phiên Claude kết thúc; chạy tiếp từ các CSV đã ghi (scripts 14/15 bỏ qua job đã xong; mọi file đã kiểm tra đọc được). Seed của mỗi job cố định nên kết quả không phụ thuộc lịch chạy. diff --git a/logs/index.csv b/logs/index.csv index 0d6f634..a71860d 100644 --- a/logs/index.csv +++ b/logs/index.csv @@ -76,3 +76,55 @@ run_id,parent,name,status,exit_code,start,end,wall_s,wall,device,git,dirty,code_ 20261027-055413_p3dev/02_train_sa14,20261027-055413_p3dev,train_sa14,ok,0,2026-10-27T05:57:03+00:00,2026-10-27T05:59:48+00:00,165.9,0:02:46,cuda:1,a76e61398a3e,True,75f953c96b36bae4,runlog,.venv/bin/python scripts/15_diag_train.py --rids 900 901 --n 4 16 --seeds 0 1 2 3 4 --c 1 2 --device cuda:1 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --sigma-a-reg 14 --budgets-from outputs/p2/diag/train/budgets.json --workers 4 --post-dir outputs/p2/diag/stress/snr10_full_sa14 --out-dir outputs/p2/diag/train_sa/sa14 20261027-055413_p3dev,,p3dev,ok,0,2026-10-27T05:54:13+00:00,2026-10-27T05:59:49+00:00,336.0,0:05:36,,a76e61398a3e,True,a7b91ac7bb476072,runlog,bash scripts/run_p3_dev.sh train_sa 20261027-064712_p2rdev_summary,,p2rdev_summary,ok,0,2026-10-27T06:47:12+00:00,2026-10-27T06:48:41+00:00,89.0,0:01:29,,cee2ff085955,True,b6a4ccdb0b2a8c48,runlog,.venv/bin/python scripts/17_summarize_p2r_dev.py +20261027-065508_p2r_main/01_p2r_post_R10,20261027-065508_p2r_main,p2r_post_R10,interrupted,-15,2026-10-27T06:55:09+00:00,2026-10-27T07:59:43+00:00,3874.4,1:04:34,cuda:1,f95123174f3f,True,c2052006feeebf10,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 4 --gpu-mem-gb 6 --c 0 1 2 --snr 10 --anchor-density full --out-dir outputs/p2r/posterior/R10 +20261027-065508_p2r_main,,p2r_main,interrupted,-15,2026-10-27T06:55:08+00:00,2026-10-27T07:59:43+00:00,3875.4,1:04:35,,f95123174f3f,True,c2052006feeebf10,runlog,bash scripts/run_p2r_main.sh +20261027-080009_p2r_main/01_p2r_post_R10tb,20261027-080009_p2r_main,p2r_post_R10tb,interrupted,-15,2026-10-27T08:00:10+00:00,2026-10-27T08:21:12+00:00,1262.4,0:21:02,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr 10 --anchor-density topbottom --out-dir outputs/p2r/posterior/R10tb +20261027-080009_p2r_main/03_p2r_post_R0h,20261027-080009_p2r_main,p2r_post_R0h,interrupted,-15,2026-10-27T08:00:10+00:00,2026-10-27T08:21:12+00:00,1262.4,0:21:02,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr 0 --anchor-density half --out-dir outputs/p2r/posterior/R0h +20261027-080009_p2r_main/03_p2r_post_R10_sa3.5,20261027-080009_p2r_main,p2r_post_R10_sa3.5,ok,0,2026-10-27T08:00:10+00:00,2026-10-27T09:33:58+00:00,5628.0,1:33:48,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 1 --snr 10 --anchor-density full --sigma-a-reg 3.5 --out-dir outputs/p2r/posterior/R10_sa3.5 +20261027-080009_p2r_main/05_p2r_post_R10,20261027-080009_p2r_main,p2r_post_R10,ok,0,2026-10-27T08:00:10+00:00,2026-10-27T09:42:57+00:00,6167.2,1:42:47,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr 10 --anchor-density full --out-dir outputs/p2r/posterior/R10 +20261027-094720_p2r_main/01_p2r_post_R10_sa3.5,20261027-094720_p2r_main,p2r_post_R10_sa3.5,ok,0,2026-10-27T09:47:20+00:00,2026-10-27T09:47:21+00:00,0.8,0:00:01,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 1 --snr 10 --anchor-density full --sigma-a-reg 3.5 --out-dir outputs/p2r/posterior/R10_sa3.5 +20261027-094722_p2r_main/01_p2r_post_R10,20261027-094722_p2r_main,p2r_post_R10,ok,0,2026-10-27T09:47:22+00:00,2026-10-27T09:47:23+00:00,0.9,0:00:01,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr 10 --anchor-density full --out-dir outputs/p2r/posterior/R10 +20261027-094724_p2r_main/01_p2r_post_Rm5,20261027-094724_p2r_main,p2r_post_Rm5,ok,0,2026-10-27T09:47:24+00:00,2026-10-27T09:55:01+00:00,456.5,0:07:37,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:0 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr -5 --anchor-density full --out-dir outputs/p2r/posterior/Rm5 +20261027-094720_p2r_main/02_p2r_train_R10_sa3.5,20261027-094720_p2r_main,p2r_train_R10_sa3.5,ok,0,2026-10-27T09:47:21+00:00,2026-10-27T09:57:31+00:00,609.6,0:10:10,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:1 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 3.5 --post-dir outputs/p2r/posterior/R10_sa3.5 --out-dir outputs/p2r/train/R10_sa3.5 +20261027-094726_p2r_main/01_p2r_post_R0h,20261027-094726_p2r_main,p2r_post_R0h,ok,0,2026-10-27T09:47:26+00:00,2026-10-27T09:58:42+00:00,675.5,0:11:16,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:0 --workers 3 --gpu-mem-gb 6 --c 0 1 2 --snr 0 --anchor-density half --out-dir outputs/p2r/posterior/R0h +20261027-102553_p2r_finish/01_p2r_train_R10_sa14_pass1,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass1,ok,0,2026-10-27T10:25:53+00:00,2026-10-27T10:29:44+00:00,231.4,0:03:51,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-094724_p2r_main/02_p2r_train_Rm5,20261027-094724_p2r_main,p2r_train_Rm5,ok,0,2026-10-27T09:55:01+00:00,2026-10-27T10:29:45+00:00,2084.0,0:34:44,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr -5 --anchor-density full --post-dir outputs/p2r/posterior/Rm5 --out-dir outputs/p2r/train/Rm5 +20261027-094724_p2r_main,,p2r_main,ok,0,2026-10-27T09:47:24+00:00,2026-10-27T10:29:45+00:00,2541.0,0:42:21,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh Rm5 +20261027-102553_p2r_finish/04_p2r_train_R10_sa14_pass2,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass2,ok,0,2026-10-27T10:29:45+00:00,2026-10-27T10:32:37+00:00,172.4,0:02:52,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-094726_p2r_main/02_p2r_train_R0h,20261027-094726_p2r_main,p2r_train_R0h,ok,0,2026-10-27T09:58:42+00:00,2026-10-27T10:36:20+00:00,2257.6,0:37:38,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density half --post-dir outputs/p2r/posterior/R0h --out-dir outputs/p2r/train/R0h +20261027-094726_p2r_main,,p2r_main,ok,0,2026-10-27T09:47:26+00:00,2026-10-27T10:36:20+00:00,2933.5,0:48:54,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh R0h +20261027-102553_p2r_finish/05_p2r_train_R10_sa14_pass3,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass3,ok,0,2026-10-27T10:34:37+00:00,2026-10-27T10:36:57+00:00,140.1,0:02:20,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/02_p2r_train_R0_pass1,20261027-102553_p2r_finish,p2r_train_R0_pass1,ok,0,2026-10-27T10:25:53+00:00,2026-10-27T10:43:57+00:00,1083.9,0:18:04,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/06_p2r_train_R0_pass2,20261027-102553_p2r_finish,p2r_train_R0_pass2,ok,0,2026-10-27T10:43:57+00:00,2026-10-27T10:47:54+00:00,236.6,0:03:57,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/07_p2r_train_R0_pass3,20261027-102553_p2r_finish,p2r_train_R0_pass3,ok,0,2026-10-27T10:47:54+00:00,2026-10-27T10:50:25+00:00,151.4,0:02:31,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/08_p2r_train_R0_pass4,20261027-102553_p2r_finish,p2r_train_R0_pass4,ok,0,2026-10-27T10:50:25+00:00,2026-10-27T10:51:52+00:00,86.4,0:01:26,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/09_p2r_train_R0_pass5,20261027-102553_p2r_finish,p2r_train_R0_pass5,ok,0,2026-10-27T10:52:52+00:00,2026-10-27T10:54:20+00:00,87.6,0:01:28,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/10_p2r_train_R0_pass6,20261027-102553_p2r_finish,p2r_train_R0_pass6,ok,0,2026-10-27T10:54:20+00:00,2026-10-27T10:55:44+00:00,83.9,0:01:24,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/11_p2r_train_R0_pass7,20261027-102553_p2r_finish,p2r_train_R0_pass7,ok,0,2026-10-27T10:55:44+00:00,2026-10-27T10:56:57+00:00,72.8,0:01:13,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-094722_p2r_main/02_p2r_train_R10,20261027-094722_p2r_main,p2r_train_R10,ok,0,2026-10-27T09:47:23+00:00,2026-10-27T10:57:14+00:00,4190.8,1:09:51,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:1 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 10 --anchor-density full --post-dir outputs/p2r/posterior/R10 --out-dir outputs/p2r/train/R10 +20261027-094722_p2r_main,,p2r_main,ok,0,2026-10-27T09:47:22+00:00,2026-10-27T10:57:14+00:00,4192.1,1:09:52,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh R10 +20261027-102553_p2r_finish/12_p2r_train_R0_pass8,20261027-102553_p2r_finish,p2r_train_R0_pass8,ok,0,2026-10-27T10:56:57+00:00,2026-10-27T10:58:12+00:00,75.5,0:01:15,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/13_p2r_train_R0_pass9,20261027-102553_p2r_finish,p2r_train_R0_pass9,ok,0,2026-10-27T10:58:13+00:00,2026-10-27T10:59:35+00:00,82.1,0:01:22,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/14_p2r_train_R0_pass10,20261027-102553_p2r_finish,p2r_train_R0_pass10,ok,0,2026-10-27T10:59:35+00:00,2026-10-27T11:01:02+00:00,87.0,0:01:27,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-094716_p2r_main/01_p2r_post_R0,20261027-094716_p2r_main,p2r_post_R0,ok,0,2026-10-27T09:47:16+00:00,2026-10-27T11:01:56+00:00,4480.0,1:14:40,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 5 --gpu-mem-gb 6 --c 0 1 2 --snr 0 --anchor-density full --out-dir outputs/p2r/posterior/R0 +20261027-102553_p2r_finish/15_p2r_train_R0_pass11,20261027-102553_p2r_finish,p2r_train_R0_pass11,ok,0,2026-10-27T11:01:02+00:00,2026-10-27T11:02:27+00:00,85.1,0:01:25,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/16_p2r_train_R0_pass12,20261027-102553_p2r_finish,p2r_train_R0_pass12,ok,0,2026-10-27T11:02:27+00:00,2026-10-27T11:03:55+00:00,88.0,0:01:28,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 0 --anchor-density full --post-dir outputs/p2r/posterior/R0 --out-dir outputs/p2r/train/R0 +20261027-102553_p2r_finish/17_p2r_train_R10_sa14_pass4,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass4,ok,0,2026-10-27T11:02:59+00:00,2026-10-27T11:04:16+00:00,77.0,0:01:17,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/18_p2r_train_R10_sa14_pass5,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass5,ok,0,2026-10-27T11:04:16+00:00,2026-10-27T11:05:41+00:00,85.6,0:01:26,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-094718_p2r_main/01_p2r_post_R10tb,20261027-094718_p2r_main,p2r_post_R10tb,ok,0,2026-10-27T09:47:18+00:00,2026-10-27T11:06:07+00:00,4729.1,1:18:49,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 4 --gpu-mem-gb 6 --c 0 1 2 --snr 10 --anchor-density topbottom --out-dir outputs/p2r/posterior/R10tb +20261027-102553_p2r_finish/03_p2r_train_R10tb_pass1,20261027-102553_p2r_finish,p2r_train_R10tb_pass1,ok,0,2026-10-27T10:25:53+00:00,2026-10-27T11:06:55+00:00,2461.6,0:41:02,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:1 --workers 3 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 10 --anchor-density topbottom --post-dir outputs/p2r/posterior/R10tb --out-dir outputs/p2r/train/R10tb +20261027-102553_p2r_finish/19_p2r_train_R10_sa14_pass6,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass6,ok,0,2026-10-27T11:05:42+00:00,2026-10-27T11:07:08+00:00,86.2,0:01:26,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/21_p2r_train_R10_sa14_pass7,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass7,ok,0,2026-10-27T11:10:08+00:00,2026-10-27T11:11:21+00:00,73.2,0:01:13,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/20_p2r_train_R10tb_pass2,20261027-102553_p2r_finish,p2r_train_R10tb_pass2,ok,0,2026-10-27T11:06:55+00:00,2026-10-27T11:16:00+00:00,545.4,0:09:05,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:1 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 0 1 2 --snr 10 --anchor-density topbottom --post-dir outputs/p2r/posterior/R10tb --out-dir outputs/p2r/train/R10tb +20261027-102553_p2r_finish/22_p2r_train_R10_sa14_pass8,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass8,ok,0,2026-10-27T11:15:22+00:00,2026-10-27T11:16:37+00:00,75.4,0:01:15,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/23_p2r_train_R10_sa14_pass9,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass9,ok,0,2026-10-27T11:18:37+00:00,2026-10-27T11:19:55+00:00,77.9,0:01:18,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/24_p2r_train_R10_sa14_pass10,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass10,ok,0,2026-10-27T11:19:55+00:00,2026-10-27T11:21:25+00:00,89.5,0:01:30,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/25_p2r_train_R10_sa14_pass11,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass11,ok,0,2026-10-27T11:21:25+00:00,2026-10-27T11:22:52+00:00,86.7,0:01:27,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-094720_p2r_main/03_p2r_post_R10_sa14,20261027-094720_p2r_main,p2r_post_R10_sa14,ok,0,2026-10-27T09:57:31+00:00,2026-10-27T11:23:05+00:00,5133.7,1:25:34,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,.venv/bin/python scripts/14_diag_posterior.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 --particles 1024 --wavelets estR --device cuda:1 --workers 3 --gpu-mem-gb 6 --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --out-dir outputs/p2r/posterior/R10_sa14 +20261027-102553_p2r_finish/26_p2r_train_R10_sa14_pass12,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass12,ok,0,2026-10-27T11:22:52+00:00,2026-10-27T11:24:14+00:00,82.5,0:01:22,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-102553_p2r_finish/27_p2r_train_R10_sa14_pass13,20261027-102553_p2r_finish,p2r_train_R10_sa14_pass13,ok,0,2026-10-27T11:24:15+00:00,2026-10-27T11:25:34+00:00,79.6,0:01:20,cuda:0,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/15_diag_train.py --rids 8 9 10 11 12 13 14 15 --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device cuda:0 --workers 7 --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from outputs/p2/diag/train/budgets.json --save-preds --c 1 --snr 10 --anchor-density full --sigma-a-reg 14 --post-dir outputs/p2r/posterior/R10_sa14 --out-dir outputs/p2r/train/R10_sa14 +20261027-094716_p2r_main,,p2r_main,interrupted,-9,2026-10-27T09:47:16+00:00,2026-10-27T11:25:34+00:00,5898.3,1:38:18,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh R0 +20261027-094718_p2r_main,,p2r_main,interrupted,-9,2026-10-27T09:47:18+00:00,2026-10-27T11:25:34+00:00,5896.3,1:38:16,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh R10tb +20261027-094720_p2r_main,,p2r_main,interrupted,-9,2026-10-27T09:47:20+00:00,2026-10-27T11:25:34+00:00,5894.3,1:38:14,cuda:1,f95123174f3f,True,99a0098b80c105f1,runlog,bash scripts/run_p2r_main.sh sigma_a +20261027-102553_p2r_finish/28_p2r_summary,20261027-102553_p2r_finish,p2r_summary,ok,0,2026-10-27T11:26:04+00:00,2026-10-27T11:29:30+00:00,205.7,0:03:26,,f95123174f3f,True,99a0098b80c105f1,runlog,nice -n 10 .venv/bin/python scripts/18_summarize_p2r.py +20261027-102553_p2r_finish,,p2r_finish,ok,0,2026-10-27T10:25:53+00:00,2026-10-27T11:29:30+00:00,3817.6,1:03:38,,f95123174f3f,True,99a0098b80c105f1,runlog,bash /home/huypq49/tmp/claude-41778/-home-jovyan-lamlvh-ML-Porosity/7df0d403-40c8-45d9-9908-3755738bbf2f/scratchpad/finish_p2r.sh /home/jovyan/lamlvh/ML-Porosity/logs/p2r_resume_20261027-094716 diff --git a/report.html b/report.html index d03caa2..7e623d8 100644 --- a/report.html +++ b/report.html @@ -244,7 +244,7 @@ const PHASES = [ {id:"p2-b45", t:"Baseline B4, B5", s:"done", n:"26/10: B4a hard-min ±8 mẫu (σ học được), B4b soft-min, B4c soft-DTW (losses/softdtw.py), B4d DILATE; B5 = ensemble 5 seed của B3b. Thêm hai đối thủ mạnh hơn: B3c (B3b + dịch cục bộ theo tương quan synthetic–seismic) và B3d (một nhãn từ warp trung bình của M2)."}, {id:"p2-grid", t:"Lưới D2 chính, bản đồ pha v1, cổng G-B", s:"done", n:"26/10: scripts/11_run_d2.py --main trên cuda:1, 89 phút. 128 ô (8 realization × c ∈ {0, 0.5, 1, 2} × N ∈ {2, 4, 8, 16}), mỗi ô 11 phương pháp × 5 seed, chấm trên 8 giếng test (56 960 dòng, gồm cả biến thể không anchor cho H4). Số bước huấn luyện chọn trên realization dev 900/901 và khoá trong protocol_p2 (sha256 07336200…) trước khi chạy. scripts/13 vẽ bản đồ pha v1 (outputs/figures/p2_phase.png), p2_band_lines.png, p2_h1.png, p2_h3.png. G-B không đạt; xem Kết quả P2."}, {id:"p2-diag", t:"Chẩn đoán sau G-B (đến hết 27/10/2026), rồi chuyển hướng nếu vẫn trượt", s:"done", n:"Xong 27/10, xem mục Chốt P2 (σ_b và rock physics sai chưa kiểm). Đã xong (1)–(3) trên dev 900/901, xem mục Chẩn đoán sau G-B. (1) Sampler nhắm thẳng posterior có seismic: SMC tempering + elliptical slice, ước lượng lại pha (registration/smc.py, smc_torch.py; scripts/14). (2) Chọn γ theo tự tương quan phần dư thay cho luật ESS ≥ S/4. (3) Quét λ ∈ {0.37, 1, 3, ∞} (scripts/15). Kết quả: sai số căn chỉnh về mức trần; nhãn SMC đạt gate với đối thủ của protocol_p2 nhưng không hơn nhãn warp trung bình cùng posterior (B3d-S); λ ít quan trọng khi posterior tốt. Còn lại: (4) học σ_a, σ_b như plan §4.1; (5) lưới stress (SNR thấp, ít anchor, rock physics sai) để tìm vùng posterior rộng. Sau đó khoá protocol_p2r (đối thủ B3d-S, realization mới, nhiều hạt hơn) hoặc Pivot 1. Luật: protocol cho tối đa 2 tuần, lịch nén rút còn đến hết 27/10/2026; chỉ dùng realization dev (thêm dev mới nếu cần), không đụng realization 0–7 của lưới chính. Nếu vẫn trượt thì chuyển hướng theo §9, nhiều khả năng Pivot 1 (bài phân tích) cùng claim của R1: khi nào vấn đề này quan trọng, và cách làm không gây hại."}, - {id:"p2-p2r", t:"Khoá protocol_p2r và chạy lại D2 trên realization mới, hoặc quyết định Pivot 1", s:"doing", n:"27/10: đã khoá protocol_p2r (tag protocol-p2r, branch p2r-protocol); lưới chính trên realization 8–15 chưa chạy. Kế hoạch ban đầu: Cuối T3 27/10. Nếu khoá protocol_p2r: posterior SMC, thêm B3d-S vào tập đối thủ, realization mới 8–15, nhiều hạt hơn hoặc nhiều lần chạy SMC; chạy qua đêm 27/10 → 28/10 trên cuda:1 (lưới chính cũ mất 89 phút, bản SMC dự kiến vài giờ)."} + {id:"p2-p2r", t:"Khoá protocol_p2r và chạy lại D2 trên realization mới, hoặc quyết định Pivot 1", s:"done", n:"Xong 27/10 (11:29 giờ máy chủ). Đã khoá protocol_p2r (tag protocol-p2r) và chạy lưới chính trên realization 8–15 (cuda:0 + cuda:1; scripts/run_p2r_main.sh, scripts/18_summarize_p2r.py → outputs/p2r/summary/). Không Pivot 1. Kết quả theo luật đã khoá: H2a ĐẠT (R10 c = 1: band RMSE B3d-Sa / point tie tốt nhất 0.857 / 0.782 ở N = 4 / 16; R0 và Rm5 cũng đạt). So với cả B3d: chỉ R10 đạt (R0 1/2 ô, Rm5 0/2). Nhánh σ_a trượt (σ_a = 3.5 ms: 0.98 / 1.14; 14 ms: 0.99 / 0.93), nên bài phải nói H2a cần σ_a đúng. H2b ĐẠT (N = 16: 8/8 ô posterior rộng, ρ = −0.85, p = 1e-4, ô hẹp 0.996). Lưu ý: B3d-Sa đã hơn point tie ngay ở c = 0 (≈ 0.81), nên phần lợi gắn với drift là B3d-Sa giữ nguyên khi drift tăng còn B3d xấu đi; ở phần lớn ô rộng c = 1 lợi của H2b vượt cận 1/B(σ_post). H3 chỉ mô tả: mọi ensemble, kể cả Oracle, under-cover."} ]}, {id:"P3", name:"P3 F3 thật", start:"2026-10-28", end:"2026-10-28", weeks:"T4 28/10", out:"bảng và hình cho F3", @@ -457,7 +457,8 @@ const LOG = [ ["2026-10-26","Chẩn đoán sau G-B trên dev 900/901: registration/smc.py (SMC tempering + elliptical slice, ước lượng lại pha, γ theo tự tương quan phần dư) và smc_torch.py trên cuda:1 (cùng luồng ngẫu nhiên, trùng bản numpy tới 1e-11, nhanh hơn bản GPU đầu khoảng 10 lần, có trần bộ nhớ mỗi worker); scripts/14–15. Sai số căn chỉnh về mức trần wavelet thật. Nhãn SMC đạt gate kiểu G-B với tập đối thủ của protocol_p2 (RMSE băng thấp hơn B3c 22–23% ở c = 1) nhưng không hơn nhãn warp trung bình cùng posterior (B3d-S), đúng như Mệnh đề 1. 103 test pass. Chưa khoá protocol mới, chưa commit."], ["2026-10-27","Viết docs/technical_overview.md (giải thích dự án cho người mới). Viết lại phần chữ của báo cáo này cho dễ đọc và gọn hơn; giữ nguyên cấu trúc và số liệu."], ["2026-10-27","Nén lịch: mục tiêu xong toàn bộ bài trước thứ 7, 31/10/2026 (thay lịch 24 tuần đến 02/05/2027). Chẩn đoán sau G-B đến hết 27/10; P3 F3 ngày 28/10 (G-C); P4 Volve 28–29/10 (G-D); viết 29–30/10; review và nộp 31/10. Ngưỡng các cổng giữ nguyên; thứ tự cắt phạm vi nếu trễ ghi ở plan §6. Cập nhật plan.md, technical_overview.md và báo cáo này. Thêm việc p2-p2r."], - ["2026-10-27","Dev cho bản chạy lại P2 (H2a/H2b, ổn định SMC P = 1024, stress σ_a, H3 với posterior SMC, F3 trên trục σ_post) và khoá protocol. Bản khoá đầu tên protocol_p3, trùng với pha P3 F3 nên đổi thành protocol_p2r (P2 rerun) trước khi sinh realization 8–15. Thêm mục Chốt P2."] + ["2026-10-27","Dev cho bản chạy lại P2 (H2a/H2b, ổn định SMC P = 1024, stress σ_a, H3 với posterior SMC, F3 trên trục σ_post) và khoá protocol. Bản khoá đầu tên protocol_p3, trùng với pha P3 F3 nên đổi thành protocol_p2r (P2 rerun) trước khi sinh realization 8–15. Thêm mục Chốt P2."], + ["2026-10-27","Bắt đầu lưới chính P2r trên realization 8–15 (cuda:1): runner scripts/run_p2r_main.sh, tổng hợp scripts/18_summarize_p2r.py (chạy thử trên dev khớp số dev đã ghi trong protocol). Scripts 14/15 chỉ nhận 8–15 khi protocol_p2r và input khớp SHA-256. Sửa trạng thái công việc: lựa chọn thủ công lưu trong trình duyệt không còn che cập nhật mới trong DATA."] ]; /* ===================== HẾT DATA ===================== */ @@ -465,7 +466,12 @@ const KEY = "ml-porosity-progress-v1"; let saved = {}; try { saved = JSON.parse(localStorage.getItem(KEY) || "{}"); } catch(e) {} function persist(){ try { localStorage.setItem(KEY, JSON.stringify(saved)); } catch(e) {} } -const stateOf = t => saved[t.id] || t.s; +// A manual override is stored with the status in DATA at the time it was made ({s, base}); once DATA changes, the +// override no longer applies, so status updates in DATA are not masked. Legacy string overrides apply only while DATA is "todo". +const stateOf = t => { const v = saved[t.id]; + if (v && typeof v === "object") return v.base === t.s ? v.s : t.s; + return (typeof v === "string" && t.s === "todo") ? v : t.s; }; +const TASK = Object.fromEntries(PHASES.flatMap(p => p.tasks).map(t => [t.id, t])); const $ = s => document.querySelector(s); const d = s => new Date(s + "T00:00:00"); const DAY = 864e5; @@ -536,7 +542,7 @@ function renderPhases(){ `; }).join(""); document.querySelectorAll("select.st").forEach(sel => sel.addEventListener("change", e => { - saved[e.target.dataset.id] = e.target.value; persist(); renderAll(); + const id = e.target.dataset.id; saved[id] = {s: e.target.value, base: TASK[id].s}; persist(); renderAll(); })); } diff --git a/scripts/11_run_d2.py b/scripts/11_run_d2.py index 346f39a..e2ce33d 100644 --- a/scripts/11_run_d2.py +++ b/scripts/11_run_d2.py @@ -44,6 +44,31 @@ def load_protocol(check: bool) -> dict: return proto | {"sha256": actual} +def check_rids(rids, P: dict) -> dict | None: + """Guard for the diagnostic scripts (14, 15): realizations of the protocol_p2 main grid are refused; realizations of + the protocol_p2r main grid are allowed only if protocol_p2r and its inputs match their locked SHA-256 (returns that + protocol, else None). Every other realization is dev.""" + bad = sorted(set(rids) & set(P["grid"]["realizations"])) + if bad: + raise SystemExit(f"realizations {bad} belong to the protocol_p2 main grid: diagnostics use dev realizations only") + path = REPO_ROOT / "configs" / "protocol_p2r.yaml" + P2r = yaml.safe_load(path.read_text()) + main = set(rids) & set(P2r["grid"]["realizations"]) + if not main: + return None + if set(rids) - main: + raise SystemExit("do not mix protocol_p2r main-grid realizations with dev realizations in one run") + expected = (REPO_ROOT / "configs" / "protocol_p2r.sha256").read_text().split()[0] + actual = hashlib.sha256(path.read_bytes()).hexdigest() + if actual != expected: + raise SystemExit(f"protocol_p2r.yaml changed after locking ({actual[:12]} ≠ {expected[:12]})") + for k, v in P2r["inputs"].items(): + h = hashlib.sha256((REPO_ROOT / v["path"]).read_bytes()).hexdigest() + if h != v["sha256"]: + raise SystemExit(f"{v['path']} differs from the version recorded in protocol_p2r ({h[:12]} ≠ {v['sha256'][:12]})") + return P2r + + def reg_settings(P: dict) -> dict: r = P["registration"] keys = ("S", "g_max", "sigma_a_ms", "sigma_b_ms", "kernel", "hyperprior", "hyper_starts", "ess_min_frac", diff --git a/scripts/14_diag_posterior.py b/scripts/14_diag_posterior.py index 7fd8e20..0411fd9 100644 --- a/scripts/14_diag_posterior.py +++ b/scripts/14_diag_posterior.py @@ -2,7 +2,8 @@ python scripts/14_diag_posterior.py --rids 900 901 --c 0 1 2 --n 4 16 --seeds 0 --workers 4 --device cuda:1 -Dev realizations only (realizations of the protocol_p2 main grid are refused). Each job (rid, c, N, seed): register +Dev realizations, or the protocol_p2r main grid (realizations 8–15, only if protocol_p2r and its inputs match the +locked SHA-256; scripts/run_p2r_main.sh); realizations of the protocol_p2 main grid are refused. Each job (rid, c, N, seed): register as in protocol_p2 (pipeline.register: MAP-II hyperparameters, statistical wavelet + constant phase, old M1/M2, B3b–d), re-estimate the constant phase by SMC over the training wells (smc.smc_fit_phase), then run SMC per well from P anchor-posterior samples through the γ milestones: γ of the old M2 (g_old), γ = 1/κ at the best anchor sample (g_acf) @@ -169,9 +170,8 @@ def main() -> None: os.environ.setdefault(k, v) P = run_d2.load_protocol(check=True) - bad = sorted(set(args.rids) & set(P["grid"]["realizations"])) - if bad: - raise SystemExit(f"realizations {bad} belong to the protocol_p2 main grid: diagnostics use dev realizations only") + if run_d2.check_rids(args.rids, P) is not None: + print("protocol_p2r main grid: protocol and inputs match the locked SHA-256", flush=True) out_dir = args.out_dir or outputs_dir() / "p2" / "diag" / "posterior" out_dir.mkdir(parents=True, exist_ok=True) G = P["grid"] diff --git a/scripts/15_diag_train.py b/scripts/15_diag_train.py index 049ff51..a04e9b3 100644 --- a/scripts/15_diag_train.py +++ b/scripts/15_diag_train.py @@ -2,7 +2,8 @@ python scripts/15_diag_train.py --rids 900 901 --c 0 1 2 --n 4 16 --seeds 0 1 --workers 4 -Dev realizations only. Each cell (rid, c, N): re-register as in protocol_p2 with a fixed registration seed (default 0, +Dev realizations, or the protocol_p2r main grid (realizations 8–15, checked against the locked SHA-256 as in +scripts/14; scripts/run_p2r_main.sh). Each cell (rid, c, N): re-register as in protocol_p2 with a fixed registration seed (default 0, the same seed as scripts/14, hence the same hyperparameters, old phase and old label bank), load the SMC samples and the re-estimated phase from outputs/p2/diag/posterior/, then train with the same backbone, optimizer, windows and label normalization as protocol_p2: @@ -285,9 +286,8 @@ def main() -> None: os.environ.setdefault(k, v) P = run_d2.load_protocol(check=True) - bad = sorted(set(args.rids) & set(P["grid"]["realizations"])) - if bad: - raise SystemExit(f"realizations {bad} belong to the protocol_p2 main grid: diagnostics use dev realizations only") + if run_d2.check_rids(args.rids, P) is not None: + print("protocol_p2r main grid: protocol and inputs match the locked SHA-256", flush=True) post_dir = args.post_dir or outputs_dir() / "p2" / "diag" / "posterior" out_dir = args.out_dir or outputs_dir() / "p2" / "diag" / "train" cell_dir = out_dir / "cells" diff --git a/scripts/18_summarize_p2r.py b/scripts/18_summarize_p2r.py new file mode 100644 index 0000000..2b8e46e --- /dev/null +++ b/scripts/18_summarize_p2r.py @@ -0,0 +1,317 @@ +"""Verdicts of protocol_p2r (configs/protocol_p2r.yaml) on its main grid (realizations 8–15; scripts/run_p2r_main.sh). + + python scripts/18_summarize_p2r.py # reads outputs/p2r/{posterior,train}// + python scripts/18_summarize_p2r.py --root DIR # another root with the same layout (e.g. a dry run on dev data) + +Every rule below is the locked rule of protocol_p2r; this script only applies it. + H2a per full-anchor regime (R10, R0, Rm5): B3d-Sa against the best point tie {B3b, B3c, B3c-R} with the + protocol_p2 rule (band RMSE ≤ 0.90 × best OR band PCC ≥ best + 0.05; cell_pass ≥ 4/5 seeds AND > 1/2 of + realizations). Regime passes if c = 1 passes for both N and the c = 0 guard holds (≤ 1.02, macro and per N). + H2a passes if R10 passes. Also reported: M2-Sa under the same rule, the secondary competitor set with B3d, + c = 2 cells (flagged: unstable posterior). + σ_a arm the H2a rule at R10, c = 1, N 4/16 with every method registered with σ_a = 3.5 / 14 ms (no guard). + H2b at N = 16 over all cells (regime × c): ratio = band RMSE M2-Sa / B3d-Sa; σ_post from the SMC particles of + the train wells (no labels). a: M2-Sa < B3d-Sa (cell_pass) in ≥ 2/3 of wide cells (σ_post ≥ 1.5 ms); + b: Spearman ρ(σ_post, ratio) < 0 (one-sided permutation p reported); c: mean ratio over narrow cells ≤ 1.02. + N = 4 reported only. Mechanism: the ratio is compared with the blur bound 1/B(σ_post) from the Oracle + predictions of the same regime and N. + H3 descriptive only: CE, coverage 50/80/90/95%, NLL, CRPS, mean σ of each 5-seed ensemble at c = 1. +Ratios carry a 95% bootstrap CI over realizations (2000 resamples). +→ outputs/p2r/summary/: h2a.csv, sigma_a.csv, h2b.csv, h3.csv, sigma_post.csv, warp.csv, blur.csv, band_rmse.csv, + verdict.json, summary.md +""" + +from __future__ import annotations + +import argparse +import importlib.util +import json +import math +from pathlib import Path + +import numpy as np +import pandas as pd +import yaml + +from ml_porosity.paths import REPO_ROOT, outputs_dir + + +def load_script(name: str): + spec = importlib.util.spec_from_file_location("s" + name[:2], REPO_ROOT / "scripts" / name) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +sp13 = load_script("13_summarize_p2.py") +sp17 = load_script("17_summarize_p2r_dev.py") +P = yaml.safe_load((REPO_ROOT / "configs" / "protocol_p2r.yaml").read_text()) +G = P["grid"] +H2A_REGIMES = P["hypotheses"]["H2a"]["regimes"] +POINT_TIES = P["hypotheses"]["H2a"]["competitors"] +WIDE_MS = 1.5 +NARROW_GUARD, WIDE_FRAC = 1.02, 2 / 3 +Z90 = sp17.Z90 +N_PERM = 10000 + + +# ---------------------------------------------------------------- inputs +def load_runs(root: Path) -> dict[str, pd.DataFrame]: + return {d.name: pd.read_csv(d / "runs.csv") for d in sorted((root / "train").glob("*")) if (d / "runs.csv").exists()} + + +def sigma_post(root: Path) -> pd.DataFrame: + """σ_post per (setting, c, N): 90% width of τ(t) of the SMC particles (estR, γ = 1/κ), mean over train wells, / 3.29; + then mean over realizations. Warp error and coverage (true warp) are descriptive only.""" + rows = [] + for d in sorted((root / "posterior").glob("*")): + files = sorted(d.glob("r*_s*.csv")) + if not files: + continue + df = pd.concat([pd.read_csv(f) for f in files], ignore_index=True) + s = df[(df.method == "SMC_g_acf") & (df.wavelet == "estR")] + per_rid = s.groupby(["c", "n_train", "rid"]).agg(width90=("warp_width90_ms", "mean"), warp_rmse_ms=("warp_rmse_ms", "mean"), + warp_cov90=("warp_cov90", "mean"), kappa_post=("kappa_post", "mean"), + phase_R=("phase_R", "first")) + per_rid["sigma_post_ms"] = per_rid.width90 / Z90 + rows.append(per_rid.groupby(["c", "n_train"]).agg( + sigma_post_ms=("sigma_post_ms", "mean"), sigma_post_min=("sigma_post_ms", "min"), sigma_post_max=("sigma_post_ms", "max"), + warp_rmse_ms=("warp_rmse_ms", "mean"), warp_cov90=("warp_cov90", "mean"), kappa_post=("kappa_post", "mean"), + n_rid=("width90", "size")).reset_index().assign(setting=d.name)) + return pd.concat(rows, ignore_index=True) if rows else pd.DataFrame() + + +# ---------------------------------------------------------------- H2a +def h2a_cells(run: pd.DataFrame, cand: str, comp: list[str], rng, n_boot: int) -> tuple[pd.DataFrame, dict]: + """protocol_p2 G-B cell rule (scripts/13 gate_gb) with `cand` in the role of M2 and `comp` as competitors.""" + r = run[run.method.isin(comp) | (run.method == cand)].replace({"method": {cand: "M2"}}) + grid = G | {"n_train": sorted(r.n_train.unique().tolist()), "drift_factors": sorted(r.c.unique().tolist())} + Pg = {"grid": grid, "gates": {"G-B": {"competitors": comp}}} + return sp13.gate_gb(r, Pg, n_boot, rng) + + +def h2a(runs: dict, rng, n_boot: int) -> tuple[pd.DataFrame, dict]: + sets = {"point_ties": POINT_TIES, "with_B3d": POINT_TIES + ["B3d"]} + rows, verdicts = [], {} + for reg in H2A_REGIMES: + if reg not in runs: + continue + for cand in ("B3d-Sa", "M2-Sa"): + for sname, comp in sets.items(): + run = runs[reg] + if not set(comp + [cand]) <= set(run.method): + continue + cells, gv = h2a_cells(run, cand, comp, rng, n_boot) + c1 = cells[cells.c == G["realistic_drift"]] + ok_n = sorted(int(n) for n in c1.n_train[c1.cell_pass]) + passed = bool(len(c1) == len(G["n_train"]) and c1.cell_pass.all() and gv["zero_drift_guard"]) + verdicts[f"{reg}/{cand}/{sname}"] = { + "c1_cells_pass": f"{int(c1.cell_pass.sum())}/{len(c1)}", "c1_pass_n": ok_n, + "zero_drift_macro_ratio": gv["zero_drift_macro_ratio"], "zero_drift_ratio_per_N": gv["zero_drift_ratio_per_N"], + "zero_drift_guard": gv["zero_drift_guard"], "regime_pass": passed, + "complete": bool((cells.n_rid == len(G["realizations"])).all() and (cells.n_seed == len(G["seeds"])).all() + and len(cells) == len(G["drift_factors"]) * len(G["n_train"]))} + rows.append(cells.assign(regime=reg, candidate=cand, competitors=sname, + flag=np.where(cells.c == 2, "unstable posterior", ""))) + tab = pd.concat(rows, ignore_index=True) if rows else pd.DataFrame() + key = "R10/B3d-Sa/point_ties" + verdict = {"pass": verdicts[key]["regime_pass"] if key in verdicts else None, + "regimes_pass": [r for r in H2A_REGIMES if verdicts.get(f"{r}/B3d-Sa/point_ties", {}).get("regime_pass")], + "per_regime": verdicts} + return tab, verdict + + +def sigma_a_arm(runs: dict, rng, n_boot: int) -> tuple[pd.DataFrame, dict]: + arm = G["sigma_a_arm"] + rows, verdicts = [], {} + for sa in arm["sigma_a_reg_ms"]: + name = f"{arm['regime']}_sa{sa:g}" + if name not in runs: + continue + cells, _ = h2a_cells(runs[name], "B3d-Sa", POINT_TIES, rng, n_boot) + c1 = cells[cells.c.isin(arm["drift_factors"])] + verdicts[f"sa{sa:g}"] = {"cells_pass": f"{int(c1.cell_pass.sum())}/{len(c1)}", + "pass": bool(len(c1) == len(arm["n_train"]) and c1.cell_pass.all())} + rows.append(c1.assign(sigma_a_reg_ms=sa)) + return (pd.concat(rows, ignore_index=True) if rows else pd.DataFrame()), verdicts + + +# ---------------------------------------------------------------- H2b +def pair_cell(g: pd.DataFrame, a: str, b: str, rng, n_boot: int) -> dict: + """Ratio mean(a)/mean(b) of band RMSE in one cell, its bootstrap CI over realizations, and the direction rule + (a < b in ≥ 4/5 seeds and > 1/2 of realizations).""" + x = g[g.method == a].set_index(["rid", "seed"])["band_rmse"] + y = g[g.method == b].set_index(["rid", "seed"])["band_rmse"].reindex(x.index) + d = x - y + ds, dr = d.groupby("seed").mean(), d.groupby("rid").mean() + xr, yr = x.groupby("rid").mean(), y.groupby("rid").mean() + lo, hi = sp13.boot(xr.to_numpy(), yr.to_numpy(), n_boot, rng) + return {"ratio": x.mean() / y.mean(), "ratio_lo": lo, "ratio_hi": hi, "seeds_better": int((ds < 0).sum()), + "rids_better": int((dr < 0).sum()), "n_seed": len(ds), "n_rid": len(dr), + "cell_pass": bool((ds < 0).sum() >= math.ceil(sp13.SEED_FRAC * len(ds) - 1e-9) and (dr < 0).sum() > len(dr) / 2)} + + +def h2b(runs: dict, sp: pd.DataFrame, bl: pd.DataFrame | None, rng, n_boot: int) -> tuple[pd.DataFrame, dict]: + from scipy.stats import spearmanr + + rows = [] + for reg in G["regimes"]: + if reg not in runs or not {"M2-Sa", "B3d-Sa"} <= set(runs[reg].method): + continue + for (c, N), g in runs[reg].groupby(["c", "n_train"]): + rows.append({"regime": reg, "c": c, "n_train": N} | pair_cell(g, "M2-Sa", "B3d-Sa", rng, n_boot)) + t = pd.DataFrame(rows) + if t.empty: + return t, {} + t = t.merge(sp.rename(columns={"setting": "regime"})[["regime", "c", "n_train", "sigma_post_ms"]], + on=["regime", "c", "n_train"], how="left") + t["wide"] = t.sigma_post_ms >= WIDE_MS + if bl is not None and len(bl): + def bound(r): + b = bl[(bl.source == r.regime) & (bl.n_train == r.n_train)] + return 1.0 / np.interp(r.sigma_post_ms, b.sigma_ms, b["mean"]) if len(b) else np.nan + t["bound_1/B"] = t.apply(bound, axis=1) + out = {} + for N, g in t.groupby("n_train"): + g = g.dropna(subset=["sigma_post_ms"]) + wide, narrow = g[g.wide], g[~g.wide] + rho = spearmanr(g.sigma_post_ms, g.ratio).statistic if len(g) > 2 else np.nan + perm = np.array([spearmanr(g.sigma_post_ms, rng.permutation(g.ratio.to_numpy())).statistic + for _ in range(N_PERM)]) if len(g) > 2 else np.array([np.nan]) + a = bool(len(wide) > 0 and wide.cell_pass.sum() >= math.ceil(WIDE_FRAC * len(wide) - 1e-9)) + b = bool(rho < 0) + c = bool(len(narrow) == 0 or narrow.ratio.mean() <= NARROW_GUARD) + out[f"n{N}"] = {"role": "primary" if N == P["hypotheses"]["H2b"]["primary_n"] else "reported only", + "cells": len(g), "wide_cells": len(wide), "wide_cells_pass": int(wide.cell_pass.sum()), + "a_wide_gain": a, "spearman_rho": rho, "perm_p_one_sided": float(np.mean(perm <= rho)), + "b_dose": b, "narrow_cells": len(narrow), + "narrow_ratio_mean": narrow.ratio.mean() if len(narrow) else None, "c_narrow_guard": c, + "pass": a and b and c} + out["pass"] = out.get(f"n{P['hypotheses']['H2b']['primary_n']}", {}).get("pass") + return t, out + + +def blur(root: Path) -> pd.DataFrame | None: + """B(σ) per regime and N from the Oracle predictions of the main run (scripts/17 blur(), same σ grid).""" + from ml_porosity.eval.metrics import band_metrics + + f_c = yaml.safe_load((REPO_ROOT / "configs" / "protocol_p2.yaml").read_text())["metrics"]["bands"]["f_c_hz"] + rows = [] + for reg in G["regimes"]: + cells = root / "train" / reg / "cells" + for f in sorted(cells.glob("r*_c*_n*.npz")) if cells.exists() else []: + rid, c, N = sp13.parse_tag(f.stem) + z = np.load(f) + Y = z["y_true"].astype(float) + for k in (k for k in z.files if k.startswith("Oracle/") and k.endswith("/mu")): + P0 = z[k].astype(float) + b0 = np.mean([band_metrics(Y[i], P0[i], f_c)["band_rmse"] for i in range(len(Y))]) + for s in sp17.BLUR_SIGMAS: + Pb = sp17.blur(P0, s) + rows.append({"source": reg, "rid": rid, "c": c, "n_train": N, "sigma_ms": s, + "ratio": np.mean([band_metrics(Y[i], Pb[i], f_c)["band_rmse"] for i in range(len(Y))]) / b0}) + if not rows: + return None + return pd.DataFrame(rows).groupby(["source", "n_train", "sigma_ms"])["ratio"].agg(["mean", "min", "max", "size"]).reset_index() + + +# ---------------------------------------------------------------- H3 (descriptive) +def h3(root: Path, rng, n_boot: int) -> pd.DataFrame: + rows = [] + for reg in G["regimes"]: + f = root / "train" / reg / "h3.csv" + if not f.exists(): + continue + e = pd.read_csv(f) + e = e[e.c == G["realistic_drift"]] + for (N, m), g in e.groupby(["n_train", "method"]): + per = g.groupby("rid")["ce"].mean().to_numpy() + rows.append({"regime": reg, "n_train": N, "method": m, "members": int(g.members.min()), "n_rid": len(per), + **g[["ce", "coverage_50", "coverage_80", "coverage_90", "coverage_95", "nll", "crps", "mean_sigma"]].mean().to_dict(), + **dict(zip(("ce_lo", "ce_hi"), sp13.boot(per, None, n_boot, rng)))}) + return pd.DataFrame(rows) + + +# ---------------------------------------------------------------- report +def md(df: pd.DataFrame, fmt: str = ".3f") -> str: + return df.to_markdown(index=False, floatfmt=fmt) if len(df) else "(no data)" + + +def write_md(path: Path, v: dict, h2a_tab, sa_tab, h2b_tab, h3_tab, sp, band) -> None: + L = ["# protocol_p2r: main grid (realizations 8–15)", "", + "Locked rules of configs/protocol_p2r.yaml applied as written; nothing here was selected on these results.", ""] + hv = v["H2a"] + L += ["## H2a — posterior-mean labels (B3d-Sa) vs the best point tie {B3b, B3c, B3c-R}", "", + f"**H2a (R10): {'PASS' if hv['pass'] else 'FAIL' if hv['pass'] is not None else 'not available'}**; " + f"regimes that pass: {', '.join(hv['regimes_pass']) or 'none'}", ""] + if len(h2a_tab): + per = pd.DataFrame(hv["per_regime"]).T.reset_index(names="regime/candidate/competitors") + L += [md(per[["regime/candidate/competitors", "c1_cells_pass", "zero_drift_macro_ratio", "zero_drift_guard", + "regime_pass", "complete"]]), ""] + cols = ["regime", "candidate", "competitors", "c", "n_train", "best", "ratio", "ratio_lo", "ratio_hi", "dpcc", + "seeds_improve", "rids_improve", "cell_pass", "flag"] + L += ["Cells (ratio = band RMSE candidate / best competitor; CI over realizations; c = 2 not primary evidence):", "", + md(h2a_tab[cols]), ""] + L += ["## σ_a arm (R10, c = 1; every method registered with the misspecified σ_a)", "", + json.dumps(v["sigma_a_arm"]), ""] + if len(sa_tab): + L += [md(sa_tab[["sigma_a_reg_ms", "n_train", "best", "ratio", "ratio_lo", "ratio_hi", "dpcc", "seeds_improve", + "rids_improve", "cell_pass"]]), ""] + L += ["## H2b — RML on the posterior bank (M2-Sa) vs posterior-mean labels (B3d-Sa)", ""] + for k, x in v["H2b"].items(): + if isinstance(x, dict): + L += [f"- N = {k[1:]} ({x['role']}): a {x['a_wide_gain']} ({x['wide_cells_pass']}/{x['wide_cells']} wide cells pass), " + f"b {x['b_dose']} (ρ = {x['spearman_rho']:.3f}, one-sided permutation p = {x['perm_p_one_sided']:.3f}), " + f"c {x['c_narrow_guard']} (narrow mean ratio " + f"{'n/a' if x['narrow_ratio_mean'] is None else format(x['narrow_ratio_mean'], '.3f')}) → {'PASS' if x['pass'] else 'FAIL'}"] + L += ["", f"**H2b: {v['H2b'].get('pass')}**", ""] + if len(h2b_tab): + cols = [c for c in ["regime", "c", "n_train", "sigma_post_ms", "wide", "ratio", "ratio_lo", "ratio_hi", "bound_1/B", + "seeds_better", "rids_better", "cell_pass"] if c in h2b_tab.columns] + L += ["Mechanism: a gain is attributed to deblurring only if the ratio lies within the bound 1/B(σ_post).", "", + md(h2b_tab[cols].sort_values(["n_train", "sigma_post_ms"])), ""] + L += ["## σ_post and warp error of the SMC posterior (train wells; warp error and coverage use the true warp, descriptive)", "", + md(sp), "", "## Band RMSE per method (mean over realization × seed)", "", md(band), "", + "## H3 (descriptive only; no calibration claim) — 5-seed ensembles at c = 1", "", md(h3_tab), ""] + path.write_text("\n".join(L)) + + +def main() -> None: + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--root", type=Path, default=outputs_dir() / "p2r") + ap.add_argument("--out-dir", type=Path, default=None, help="default: /summary") + ap.add_argument("--n-boot", type=int, default=2000) + args = ap.parse_args() + out = args.out_dir or args.root / "summary" + out.mkdir(parents=True, exist_ok=True) + rng = np.random.default_rng(0) + + runs = load_runs(args.root) + sp = sigma_post(args.root) + sp.to_csv(out / "sigma_post.csv", index=False) + h2a_tab, h2a_v = h2a(runs, rng, args.n_boot) + h2a_tab.to_csv(out / "h2a.csv", index=False) + sa_tab, sa_v = sigma_a_arm(runs, rng, args.n_boot) + sa_tab.to_csv(out / "sigma_a.csv", index=False) + bl = blur(args.root) + if bl is not None: + bl.to_csv(out / "blur.csv", index=False) + h2b_tab, h2b_v = h2b(runs, sp, bl, rng, args.n_boot) + h2b_tab.to_csv(out / "h2b.csv", index=False) + h3_tab = h3(args.root, rng, args.n_boot) + h3_tab.to_csv(out / "h3.csv", index=False) + band = pd.concat([r.groupby(["c", "n_train", "method"])["band_rmse"].mean().unstack("method").reset_index().assign(setting=k) + for k, r in runs.items()], ignore_index=True) if runs else pd.DataFrame() + if len(band): + band = band[["setting"] + [c for c in band.columns if c != "setting"]] + band.to_csv(out / "band_rmse.csv", index=False) + v = {"protocol": "configs/protocol_p2r.yaml", + "protocol_sha256": (REPO_ROOT / "configs" / "protocol_p2r.sha256").read_text().split()[0], + "settings": sorted(runs), "H2a": h2a_v, "sigma_a_arm": sa_v, "H2b": h2b_v} + (out / "verdict.json").write_text(json.dumps(v, indent=1, default=float)) + write_md(out / "summary.md", v, h2a_tab, sa_tab, h2b_tab, h3_tab, sp, band) + print((out / "summary.md").read_text()) + + +if __name__ == "__main__": + main() diff --git a/scripts/run_p2r_main.sh b/scripts/run_p2r_main.sh new file mode 100755 index 0000000..c4e8bae --- /dev/null +++ b/scripts/run_p2r_main.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Main grid of protocol_p2r (configs/protocol_p2r.yaml, locked): realizations 8–15, regimes R10 R0 Rm5 R0h R10tb. +# scripts/run_p2r_main.sh # all stages in order +# scripts/run_p2r_main.sh R10 summary # only the named stages +# WORKERS=3 scripts/run_p2r_main.sh check parallel # all regimes and the σ_a arm at once, then the summary +# check pytest tests/test_protocol.py (locked SHA-256 of protocol_p2 / protocol_p2r and their inputs) +# SMC posterior (scripts/14: P = 1024, K = 1, estR wavelet, c 0 1 2, N 4 16, registration seed 0), then +# training (scripts/15: Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa, 5 seeds, budgets of the protocol, saved +# predictions for H3 and the blur bound) → outputs/p2r/{posterior,train}// +# sigma_a grid.sigma_a_arm: R10, c 1, N 4 16, every method registered with σ_a = 3.5 / 14 ms +# → outputs/p2r/{posterior,train}/R10_sa<σ_a>/ +# summary scripts/18_summarize_p2r.py: H2a, H2b, H3 (descriptive), σ_a arm, blur bound → outputs/p2r/summary/ +# GPU jobs run on cuda:1 (override with DEVICE=...). Scripts 14 and 15 refuse realizations 8–15 unless protocol_p2r and +# its inputs match the locked hashes, and skip jobs that already have a CSV, so the runner can be restarted. +set -euo pipefail +cd "$(dirname "$0")/.." +PY="${PY:-.venv/bin/python}" +[[ -n "${RUNLOG_DIR:-}" ]] || exec "$PY" -m ml_porosity.runlog -n p2r_main -- bash "scripts/$(basename "$0")" "$@" +step() { "$PY" -m ml_porosity.runlog "$@"; } +DEVICE="${DEVICE:-cuda:1}" +WORKERS="${WORKERS:-4}" +THREADS="${THREADS:-2}" +export OMP_NUM_THREADS=$THREADS MKL_NUM_THREADS=$THREADS OPENBLAS_NUM_THREADS=$THREADS NUMEXPR_NUM_THREADS=$THREADS \ + NUMBA_NUM_THREADS=$THREADS +OUT=outputs/p2r +RIDS=(8 9 10 11 12 13 14 15) +BUDGETS=outputs/p2/diag/train/budgets.json # protocol_p2r inputs.budgets (hash checked by scripts 14/15) +POST=(scripts/14_diag_posterior.py --rids "${RIDS[@]}" --n 4 16 --seeds 0 --particles 1024 --wavelets estR + --device "$DEVICE" --workers "$WORKERS" --gpu-mem-gb 6) +TRAIN=(scripts/15_diag_train.py --rids "${RIDS[@]}" --n 4 16 --seeds 0 1 2 3 4 --reg-seed 0 --device "$DEVICE" + --workers "$WORKERS" --variants a --methods Oracle B3b B3c B3c-R B3d B3d-Sa M2-Sa --budgets-from "$BUDGETS" + --save-preds) +regime() { # prints "snr_db anchor_density" of a regime from configs/d2_synth_p2r.yaml + "$PY" -c "import sys, yaml; r = yaml.safe_load(open('configs/d2_synth_p2r.yaml'))['regimes'][sys.argv[1]]; \ +print(r['snr_db'], r['anchor_density'])" "$1" +} + +for stage in ${@:-check R10 R0 Rm5 R0h R10tb sigma_a summary}; do + case "$stage" in + check) + CUDA_VISIBLE_DEVICES= "$PY" -m pytest -q -p no:cacheprovider tests/test_protocol.py ;; + R10|R0|Rm5|R0h|R10tb) + read -r snr dens <<< "$(regime "$stage")" + step -n "p2r_post_$stage" -- "$PY" "${POST[@]}" --c 0 1 2 --snr "$snr" --anchor-density "$dens" \ + --out-dir "$OUT/posterior/$stage" + step -n "p2r_train_$stage" -- "$PY" "${TRAIN[@]}" --c 0 1 2 --snr "$snr" --anchor-density "$dens" \ + --post-dir "$OUT/posterior/$stage" --out-dir "$OUT/train/$stage" ;; + sigma_a) + read -r snr dens <<< "$(regime R10)" + for sa in 3.5 14; do + step -n "p2r_post_R10_sa$sa" -- "$PY" "${POST[@]}" --c 1 --snr "$snr" --anchor-density "$dens" \ + --sigma-a-reg "$sa" --out-dir "$OUT/posterior/R10_sa$sa" + step -n "p2r_train_R10_sa$sa" -- "$PY" "${TRAIN[@]}" --c 1 --snr "$snr" --anchor-density "$dens" \ + --sigma-a-reg "$sa" --post-dir "$OUT/posterior/R10_sa$sa" --out-dir "$OUT/train/R10_sa$sa" + done ;; + parallel) + # Each regime and the σ_a arm run as independent pipelines at the same time (WORKERS each), then the summary. + # Results do not depend on scheduling: every job seeds its random streams from (rid, c, N, seed, well). + pids=() + for s in R10 R0 Rm5 R0h R10tb sigma_a; do + bash "scripts/$(basename "$0")" "$s" > "${RUNLOG_DIR}/pipeline_$s.out" 2>&1 & pids+=($!) + done + fail=0 + for p in "${pids[@]}"; do wait "$p" || fail=1; done + [[ $fail == 0 ]] || { echo "a pipeline failed (see ${RUNLOG_DIR}/pipeline_*.out)" >&2; exit 1; } + bash "scripts/$(basename "$0")" summary ;; + summary) + CUDA_VISIBLE_DEVICES= step -n p2r_summary -- "$PY" scripts/18_summarize_p2r.py ;; + *) echo "unknown stage: $stage" >&2; exit 2 ;; + esac +done diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 0e0f784..5e26cf5 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -41,3 +41,19 @@ def test_p2r_inputs_match_sha256(): if not f.exists(): # outputs/ is not versioned continue assert hashlib.sha256(f.read_bytes()).hexdigest() == P["inputs"][key]["sha256"], key + + +def test_check_rids_guards_main_grids(): + """Scripts 14/15 refuse protocol_p2 main-grid realizations and never mix the protocol_p2r main grid with dev.""" + import importlib.util + + import pytest + + spec = importlib.util.spec_from_file_location("run_d2", REPO_ROOT / "scripts" / "11_run_d2.py") + run_d2 = importlib.util.module_from_spec(spec) + spec.loader.exec_module(run_d2) + P = yaml.safe_load((CONFIGS / "protocol_p2.yaml").read_text()) + assert run_d2.check_rids([900, 901], P) is None + for rids in ([0], [8, 900]): + with pytest.raises(SystemExit): + run_d2.check_rids(rids, P)