From 0cfe202a8b5a90b271e24b2ea586025ab42d570c Mon Sep 17 00:00:00 2001 From: lamlvh Date: Thu, 29 Oct 2026 12:18:22 +0000 Subject: [PATCH] Complete P4 Volve; pivot the manuscript to theory + benchmark P4 (Volve field case). Add the deviated-well and Volve well builders (ml_porosity/data/deviated.py, volve_wells.py), the ml_porosity/volve/ pipeline, scripts 23-25, the run_p4 drivers and tests. The protocol configs/protocol_volve.yaml was locked at 2026-10-29T01:17:42Z before the run (.sha256, .lock.json) and is committed here after the run. Gate G-D failed: M2-Sa beats the selected B3 at 2/6 wells (lowo) and 3/6 (slot), coverage90 is about 0.47, and no method has blind-well skill (R2 < 0). A post hoc constant at the training-well mean beats every network, so G-D had no power. The dropped P4x exploratory run is kept as a record only (exploratory/, docs/research/p4-exploratory.md). Applicability and Teapot Dome (exploratory, pre-declared). Scripts 26-29 and docs/research/applicability-*.md: F3 and Volve fail C1 and pass C2; T3 power needs 5-18 blind wells with an exact reference; Teapot T0 and pilot P-a failed, so Teapot is stopped. Raw Teapot data stay gitignored. Manuscript (Pivot 1, level A). Reframe paper/ as a theory and synthetic benchmark paper: Propositions 3-6, Corollaries 3-4, T4 coverage (script 30) and the post hoc H2b bound check (script 31), with F3/Volve moved to Appendix B. Correct two earlier claims: the Berkson and classical bounds differ by 1.5-4.6x at the f^4-weighted band, and the bank gain exceeds the registered classical bound (7/8 wide cells at N = 16) but only 3/8 under the post hoc Berkson bound. Docs. Sync plan, AGENTS.md, README, report.html, theory and technical overview. The length pass for the venue is dropped by the user (plan section 12 item 25); the length risk stays recorded as R9. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 4 + AGENTS.md | 119 +- README.md | 17 + configs/d3_volve.yaml | 67 ++ configs/protocol_volve.lock.json | 65 ++ configs/protocol_volve.sha256 | 1 + configs/protocol_volve.yaml | 185 +++ docs/plan.md | 117 +- docs/research/applicability-results.md | 65 ++ docs/research/applicability-teapot.md | 106 ++ docs/research/applicability-teapot.sha256 | 2 + docs/research/field-dataset-survey.md | 64 ++ docs/research/p4-exploratory.md | 95 ++ docs/research/pivot-theory-benchmark.md | 245 ++++ docs/technical_overview.md | 1238 +++++++++++---------- docs/theory.md | 101 +- exploratory/p4x_volve.py | 416 +++++++ exploratory/run_p4x.sh | 13 + logs/index.csv | 9 + ml_porosity/data/deviated.py | 281 +++++ ml_porosity/data/volve_wells.py | 126 +++ ml_porosity/volve/__init__.py | 1 + ml_porosity/volve/data.py | 144 +++ ml_porosity/volve/evaluation.py | 287 +++++ ml_porosity/volve/folds.py | 74 ++ ml_porosity/volve/losses.py | 93 ++ ml_porosity/volve/protocol.py | 123 ++ ml_porosity/volve/registration.py | 171 +++ ml_porosity/volve/runner.py | 283 +++++ ml_porosity/volve/training.py | 87 ++ paper/README.md | 49 +- paper/figures/p2r_h2b.pdf | Bin 20693 -> 20409 bytes paper/highlights.txt | 5 + paper/main.tex | 4 +- paper/refs.bib | 92 ++ paper/sections/00_abstract.tex | 10 +- paper/sections/01_introduction.tex | 15 +- paper/sections/02_related.tex | 10 +- paper/sections/03_data.tex | 13 +- paper/sections/04_theory.tex | 138 ++- paper/sections/05_method.tex | 4 +- paper/sections/06_experiments.tex | 241 ++-- paper/sections/07_discussion.tex | 32 +- paper/sections/08_conclusion.tex | 21 +- paper/sections/A_proofs.tex | 41 + paper/sections/B_field.tex | 272 +++++ report.html | 103 +- scripts/22_paper_figures.py | 2 +- scripts/23_build_volve_wells.py | 282 +++++ scripts/24_run_volve.py | 69 ++ scripts/25_p4_posthoc.py | 62 ++ scripts/26_applicability.py | 168 +++ scripts/27_t3_power.py | 133 +++ scripts/28_teapot_inventory.py | 170 +++ scripts/29_teapot_pilot.py | 268 +++++ scripts/30_t4_coverage.py | 140 +++ scripts/31_p2r_posthoc.py | 250 +++++ scripts/run_p4.ps1 | 37 + scripts/run_p4.sh | 21 + tests/test_deviated.py | 314 ++++++ tests/test_volve_pipeline.py | 478 ++++++++ 61 files changed, 7162 insertions(+), 881 deletions(-) create mode 100644 configs/protocol_volve.lock.json create mode 100644 configs/protocol_volve.sha256 create mode 100644 configs/protocol_volve.yaml create mode 100644 docs/research/applicability-results.md create mode 100644 docs/research/applicability-teapot.md create mode 100644 docs/research/applicability-teapot.sha256 create mode 100644 docs/research/field-dataset-survey.md create mode 100644 docs/research/p4-exploratory.md create mode 100644 docs/research/pivot-theory-benchmark.md create mode 100644 exploratory/p4x_volve.py create mode 100755 exploratory/run_p4x.sh create mode 100644 ml_porosity/data/deviated.py create mode 100644 ml_porosity/data/volve_wells.py create mode 100644 ml_porosity/volve/__init__.py create mode 100644 ml_porosity/volve/data.py create mode 100644 ml_porosity/volve/evaluation.py create mode 100644 ml_porosity/volve/folds.py create mode 100644 ml_porosity/volve/losses.py create mode 100644 ml_porosity/volve/protocol.py create mode 100644 ml_porosity/volve/registration.py create mode 100644 ml_porosity/volve/runner.py create mode 100644 ml_porosity/volve/training.py create mode 100644 paper/highlights.txt create mode 100644 paper/sections/B_field.tex create mode 100644 scripts/23_build_volve_wells.py create mode 100644 scripts/24_run_volve.py create mode 100644 scripts/25_p4_posthoc.py create mode 100644 scripts/26_applicability.py create mode 100644 scripts/27_t3_power.py create mode 100644 scripts/28_teapot_inventory.py create mode 100644 scripts/29_teapot_pilot.py create mode 100644 scripts/30_t4_coverage.py create mode 100644 scripts/31_p2r_posthoc.py create mode 100644 scripts/run_p4.ps1 create mode 100755 scripts/run_p4.sh create mode 100644 tests/test_deviated.py create mode 100644 tests/test_volve_pipeline.py diff --git a/.gitignore b/.gitignore index 634c162..8e81dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,7 @@ data/Volve/ # NLOG: LAS và TD công khai tải lại được (URL trong docs/research/f3-nlog-inventory.xlsx), hash ở data_manifest/nlog.json data/NLOG/ + +# Teapot Dome (RMOTC / U.S. DOE, Texas Data Repository; 1.7 GB): không đẩy lên git. Chỉ dùng cho T0 và pilot P-a +# (plan §12 ý 23); kết quả ở outputs/teapot/. +data/Teapot/ diff --git a/AGENTS.md b/AGENTS.md index 75f6183..a2cca79 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,10 +1,10 @@ # AGENTS.md -Seismic-to-porosity learning on F3 when the well tie is uncertain (RML: training on labels drawn from a well-tie posterior). Paper deadline: Sat 31/10/2026. Gate thresholds never change; only dates do. +Seismic-to-porosity learning on F3 when the well tie is uncertain (RML: training on labels drawn from a well-tie posterior). Paper deadline: **Sat 14/11/2026** (moved on 29/10/2026 from 31/10; Pivot 1, level B, `docs/plan.md` §12 item 22). Gate thresholds never change; only dates do. Read first: `docs/plan.md` (plan, gates, decisions; §6 roadmap, §10 forbidden claims, §12 decision log), `README.md` (setup, scripts, logging), `docs/theory.md`. Progress page: `report.html`. These docs are in Vietnamese. -## Status (28/10/2026) +## Status (29/10/2026) - P0, P1 done. P2 closed: gate G-B failed on 26/10 and the P2 verdict stands. - **P2r** (P2 rerun on new realizations 8–15 under the new pre-registration `configs/protocol_p2r.yaml`) is done and committed (5a6fb2f). Summary in `outputs/p2r/summary/` (`verdict.json`, `summary.md`); details in `docs/plan.md` §12 items 11–14. @@ -29,11 +29,119 @@ Read first: `docs/plan.md` (plan, gates, decisions; §6 roadmap, §10 forbidden `docs/research/p3-code-review.md`. `report.html` contains the completed status and G-C result even without the local output sidecar. +- **P4 Volve is complete** (29/10, 02:21 UTC) on the Linux server (H200, cuda:1 + primary arm, cuda:0 σ_a arms in parallel), not on the Windows workstation. + Protocol `configs/protocol_volve.yaml` locked 01:17:42 UTC (`.lock.json`, + `.sha256`); driver `scripts/run_p4.sh`. **G-D: no consistent improvement, not + calibrated** (M2-Sa beats selected B3 at 2/6 wells lowo, 3/6 slot; coverage90 + ≈ 0.47). No method has blind-well skill on Volve (R² < 0 everywhere, PCC ≤ 0.24); + σ_a arms change nothing. Details: `docs/plan.md` §12 item 20, + `outputs/p4/summary/`. Do not rerun or redesign P4. + - Post hoc, outside the lock (`scripts/25_p4_posthoc.py` → `outputs/p4/posthoc/`): + a constant at the training-well PHIF mean beats every network (macro RMSE + 6.03 lowo, 6.59 slot). Between-well level differences dominate the error, so + G-D had no power: Volve is evidence neither for nor against RML. + - **P4x exploratory is dropped** (decision of 29/10/2026). `exploratory/` + and `outputs/p4x/` stay on disk as a record only: do not summarise, cite, + or extend them (no V3). The last `exploratory/run_p4x.sh` job was stopped + at 670/921 (about 04:05 UTC) and killed to free cuda:0; B3d-Sa and V3 + never ran. A partial summary generated at 04:07 UTC, before the + decision was seen, has been deleted (`outputs/p4x/summary/` no longer + exists). Do not restart the job or rerun its summarize stage. History: `docs/plan.md` §12 item 21. +- **Pivot 1 activated (29/10/2026)**: the paper is now a theory + synthetic + benchmark paper. Working title: *Label registration error in sparse-well + seismic property learning: theory, a registration-aware benchmark, and the + limits of field validation*. F3 and Volve are scope-bounding cases only. + Decisions (user fixed 1 and 5; agent fixed 2–4): (1) level B, deadline + 14/11/2026; (2) misspecification axis S2 is mandatory, narrow scope, locked + in a new `configs/protocol_bench.yaml` before the first run, otherwise the + paper says "controlled synthetic study", not "benchmark"; (3) the mechanism + study T2 is exploratory on realizations 8–15, pre-declared in + `docs/research/t2-mechanism.md`, never confirmatory; (4) venue *Computers & + Geosciences*, fallback *Geophysical Prospecting*; (5) P4x dropped. Full + analysis and plan: `docs/research/pivot-theory-benchmark.md` (§6 has the + decisions and the day-by-day schedule); public field-dataset survey: + `docs/research/field-dataset-survey.md` (no dataset confirmed adequate; no + new field test in this paper). +- **Applicability conditions and a Teapot Dome attempt (29/10/2026, + exploratory; `docs/plan.md` §12 item 23).** Declared in + `docs/research/applicability-teapot.md` before any computation; results in + `docs/research/applicability-results.md`. Retrospective C1/C2 + (`scripts/26_applicability.py`): F3 and Volve fail C1 (no blind-well skill + in the seismic band) and pass C2. T3 power (`scripts/27_t3_power.py`): with + an exact reference a sign test needs 5–18 blind wells in most cells; with + reference errors of 3 ms or more, 40 wells do not suffice. Teapot T0 failed + (at most 2 wells with an independent time–depth reference), and the pilot + P-a requested by the user failed (horizon–top knot error 6.75 ms against a + 1.5 ms tolerance). Teapot is stopped; the user chose to return to the + level-B schedule. The raw Teapot data (`data/Teapot/`, 1.7 GB) are + gitignored. +- **Level A writing done early (29/10/2026; `docs/plan.md` §12 item 24).** + `paper/` now follows the Pivot 1 frame (55 pages, compiles cleanly): + Propositions 3–6 (classical/Berkson tie error, calibrated bank with a + fourth-order population gain, coverage, misregistered reference), + Corollaries 3–4, T4 (`scripts/30_t4_coverage.py`) and the post hoc H2b + bound check (`scripts/31_p2r_posthoc.py`) in Sec. 6.3, T3 in Sec. 6.5, + field cases in Sec. 6.6 with F3/Volve details moved to Appendix B. Red + TODOs remain for S1–S8, T2 and the authors' declarations. **Self-correction + (29/10, A6):** two earlier agent claims were wrong. The first was "the two + error structures give nearly the same bound (factor < 1.17)". In fact the + f⁴-weighted distortion sits at 67–72 Hz, where the Berkson integral is + 1.5–4.6 times the classical one at σ = 1.5–2.5 ms. The second was "the bank + gain exceeds the population bound". That holds only for the registered + classical bound (7/8 wide cells at N = 16). Under the post hoc Berkson + bound, the natural one for posterior-mean labels, only 3/8 cells exceed it + (all at c = 1), and at most 1/8 at the measured warp error. Script 31 now + computes both bounds and reads the Oracle npz files (about 6 min). The paper + (Sec. 4.3, 6.3 with a 1/B_b column in `tab:h2b`, 6.4, 7, abstract, + introduction, conclusion) and the docs were corrected. **Length risk:** + the main text is about 14,750 words (crude count after A6) against a Computers & Geosciences limit + of about 5,500 (secondary source; not yet checked on the official page). + The user dropped the length pass for the venue on 29/10/2026 (`docs/plan.md` + §12 item 25); the risk stays recorded as R9 with no mitigation. +- Committed and pushed on 29/10/2026 with the tag `protocol-volve` (the Volve + code hash recomputed from that tree matches `configs/protocol_volve.lock.json`): + the P4 code, `configs/protocol_volve.*`, scripts 26–31, the `docs/research/` + additions, the P4x record (`exploratory/`, `docs/research/p4-exploratory.md`), + `.gitignore`, and the 29/10 paper/docs edits. Run logs `logs/*.out` stay + untracked, as before (`docs/plan.md` §12 item 25). + ## Next -1. **P4 Volve** (pipeline 28/10, runs 29/10, gate G-D). -2. **P5 writing** (29–30/10). Include the negative P3 result and the previously - recorded P2r deviation. If late, cut scope in the order given in `docs/plan.md` §6. +Schedule: `docs/plan.md` §6.1 (level B, 29/10 → 14/11/2026). Cut-scope order +if late is given there; never cut thresholds. + +1. **Dataset citations (30–31/10).** Level A writing is done (plan §12 item 24). + Add the F3 and Volve dataset citations to `paper/refs.bib`. The length pass + for the venue was dropped by the user on 29/10/2026 (plan §12 item 25): do + not schedule it. The rest of these two days is buffer. +2. **T2 mechanism study (1/11), exploratory:** declare + `docs/research/t2-mechanism.md` before running. The question is now + whether any bank gain remains beyond the population correction of the + Berkson structure. Five tests, as in the Sec. 6.4 todoblock: (i) + responsibility-weighted warp error vs. mean-warp error; (ii) random GP-noise + bank control; (iii) multimodal-cell split; (iv) Berkson-vs-classical + covariance test for the bulk offset of B3d-Sa and B3c-R, which decides which + bound applies; (v) B3d-Sa retrained at the Oracle's 500 iterations. The + declaration must disclose what was already inspected post hoc on 29/10 + (`outputs/p2r/posthoc/`): the Oracle/B3d-Sa and M2-Sa/B3d-Sa ratios and + every bound, (a), (b), b60 and cross-spectral, at σ_post and at the warp + error. +3. **protocol_bench (2–3/11):** add misspecification parameters to + `ml_porosity/data/synth_d2.py` without changing the default path (P2r must + still reproduce); dev on new realizations 902–905 only; lock + `configs/protocol_bench.yaml` + `.sha256` + `.lock.json` before the first + main run. Contents: S1 grid fill (c ∈ {0.5, 1.5}, N ∈ {2, 8}), S2 three + misspec axes (R10, Rm5; c = 1; N ∈ {4, 16}; Oracle, B3c-R, B3d-Sa, M2-Sa), + S3 (B4 under the SMC posterior), S4 (second backbone), S8 (controlled + cycle-skip regime). Realizations 8–15 for all main cells. +4. **Runs (4–7/11)** on both GPUs, detached with `setsid nohup`, via a + `scripts/run_bench.sh` driver with runlog. Report results as they come out. +5. **S7 packaging (8–10/11):** one command to generate, one to score, reference + tables, README, hashes, Zenodo deposit; then rewrite the results sections. +6. **Review and submission (11–14/11):** internal review, figures, proof + appendix, final novelty scan, quartile check, preprint, submit to + *Computers & Geosciences*. ## Conventions @@ -43,6 +151,7 @@ Read first: `docs/plan.md` (plan, gates, decisions; §6 roadmap, §10 forbidden - **Git:** work on `main`. Do not create branches unless the user explicitly asks. End commit messages with a co-author line for the agent. - **Language:** code, figures, paper text and commit messages in academic English. Explanations to the user in Vietnamese. - **Decisions:** decide from evidence and proceed. Do not block on supervisor (GVHD) sign-off. +- **Keep docs in sync (every task):** whenever you change anything (a run starts, finishes, fails or is stopped; a result, decision, deadline, protocol, script or file is added or changed), update in the same turn every file that states it: `report.html` (task status and notes, result cards, FINDS, DECISIONS, LOG), `docs/plan.md` (§0, §6 roadmap, §12 decision log), `AGENTS.md` (Status, Next), and where relevant `README.md` (scripts, run commands), `paper/README.md` (number sources), `docs/technical_overview.md` and `docs/research/*.md`. Before ending the turn, grep these files for older statements about the same item (for example "running", old counts or dates) and correct them, so no two files disagree. After editing `report.html`, check that its data block still parses (balanced brackets and quotes). - **GPU (shared server):** choose cuda:0 or cuda:1 by free memory and load. Never touch other users' jobs. Set `OMP_NUM_THREADS`, `MKL_NUM_THREADS` and `OPENBLAS_NUM_THREADS` explicitly when running by hand (the machine default is 40). - **Long runs:** detach multi-hour runs with `setsid nohup ... &` so they survive the agent session. Wrap runs with `scripts/runlog.sh` or the `run_p*.sh` drivers. Scripts 11/14/15 resume by skipping finished cells. - `code_thesis/` is the unchanged thesis-code archive (renamed from `test 2/`): do not modify its contents. diff --git a/README.md b/README.md index 5286884..7dd7424 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,9 @@ scripts/run_p0.sh # toàn bộ pipeline P0 và test scripts/run_p1.sh # P1: tie QC, LOWO baseline (khoảng 16 phút với GPU) scripts/run_p2.sh # P2: prior warp F3, QC D2, test, lưới D2, H1, tổng hợp (GPU cuda:1; đổi bằng DEVICE=...) scripts/run_p2r_dev.sh # chuẩn bị P2r (chạy lại P2) trên dev 900/901: screen, train, stability, sigma_a, f3, h3 (+ stability_m5, b3d_old, train_sa) +scripts/run_p2r_main.sh # lưới chính P2r trên realization 8–15 +scripts/run_p4.sh # P4 Volve: register, train, summarize nhánh σ_a chính (DEVICE mặc định cuda:1) +ARMS=sensitivity scripts/run_p4.sh register train # nhánh σ_a = 3,5 / 14 ms; sau đó ARMS=all scripts/run_p4.sh summarize ``` Log và runtime: mỗi lần chạy `run_p*.sh` tạo `logs/runs/_p*/`, mỗi bước là một thư mục con có `log.txt` (stdout + stderr, cả của worker, đầu dòng có thời gian đã trôi) và `meta.json` (lệnh, git commit + hash mã nguồn, biến luồng, thiết bị, wall/CPU time, RSS và VRAM đỉnh, mã thoát). Mỗi bước thêm một dòng vào `logs/index.csv`. Chạy lẻ một script thì bọc bằng `scripts/runlog.sh`: @@ -96,5 +99,19 @@ Biến môi trường máy đặt sẵn `OMP_NUM_THREADS=40` (cả MKL, OpenBLAS | `scripts/15_diag_train.py [--post-dir] [--methods] [--budgets-from] [--save-preds]` | Huấn luyện trên dev với nhãn từ posterior SMC (B3d-Sa, M2-Sa…) và các baseline, cổng kiểu G-B, ensemble kiểu H3 → `outputs/p2/diag/train*/` | | `scripts/16_f3_posterior.py [--device cuda:1]` | Đặt F3 lên trục σ_post (chỉ mô tả): posterior SMC trên 4 giếng F3 → `outputs/p2/diag/f3_posterior/` | | `scripts/17_summarize_p2r_dev.py [--only …]` | Tổng hợp dev cho P2r: screen, train/dose-response H2b, B(σ), stability, σ_a, F3 → `outputs/p2/diag/p2rdev/summary.md` | +| `scripts/18_summarize_p2r.py [--root DIR]` | Phán quyết của `protocol_p2r` trên lưới chính (realization 8–15): H2a, H2b, σ_a, H3, H4 → `outputs/p2r/summary/` (`verdict.json`, `summary.md`) | +| `scripts/19_run_f3.py [--device] [--workers]` | P3 F3: prepare → benchmark → lock → register → train → diagnostics → summarize theo `configs/protocol_f3.yaml` → `outputs/p3/` | +| `scripts/20_summarize_f3.py` | Tổng hợp lượt P3 đã khóa, cổng G-C → `outputs/p3/summary/` | +| `scripts/21_predict_f3.py` | Mô hình triển khai và volume F3 mô tả (649 inline) sau LOWO của P3 → `outputs/p3/volume/` | +| `scripts/22_paper_figures.py [--only …]` | Hình cho bài báo (`paper/figures/*.pdf`), chỉ đọc các summary đã khóa | +| `scripts/23_build_volve_wells.py [--config configs/d3_volve.yaml]` | Dữ liệu 6 giếng nghiêng Volve trên miền thời gian (survey, TDR calibrated và blind, patch 3×3 dọc đường giếng, nhãn PHIF) → `outputs/volve/volve_wells.npz`, `volve_wells_summary.json` | +| `scripts/24_run_volve.py [--arms primary\|sensitivity\|all] [--device] [--workers]` | P4 Volve: benchmark → lock → register → train → summarize theo `configs/protocol_volve.yaml`, cổng G-D → `outputs/p4/` | +| `scripts/25_p4_posthoc.py` | Post hoc P4, ngoài khóa, không đổi G-D: hằng số bằng trung bình giếng train và tách RMSE thành bias + SD → `outputs/p4/posthoc/` | +| `scripts/26_applicability.py` | Điều kiện áp dụng C1, C2 (khai báo ở `docs/research/applicability-teapot.md`), hồi cứu trên F3 và Volve; chỉ đọc output đã khóa và nhãn giếng train của từng fold, không train → `outputs/applicability/` | +| `scripts/27_t3_power.py` | T3 exploratory: chấm lại dự đoán P2r đã lưu với tham chiếu lệch σ_ref, power của luật k-of-n và sign test theo số giếng blind (beta-binomial) → `outputs/t3/` | +| `python -P scripts/28_teapot_inventory.py --root data/Teapot/raw/rmotc --out outputs/teapot/inventory` | T0 kiểm kê Teapot Dome (chỉ header và độ phủ đường cong; không đọc quan hệ porosity–seismic). Dữ liệu là archive tải về, chạy bằng `python -P` từ gốc repo → `outputs/teapot/inventory/` | +| `python -P scripts/29_teapot_pilot.py` | Pilot P-a Teapot (Deviation 2): hình học, độ phủ horizon, σ̂_knot trên giếng dev (inline ≤ 200), không đọc porosity → `outputs/teapot/pilot_pa/` | +| `scripts/30_t4_coverage.py` | T4 post hoc, mô tả: tỉ số phân tán ξ (cột `kappa`), coverage90 và phần do số vòng lặp của các ensemble 5 seed, từ `outputs/p2r/train/*/cells/*.npz` và dev P2 → `outputs/t4/` | +| `scripts/31_p2r_posthoc.py` | Post hoc H2b, đọc `outputs/p2r/summary/` và dự đoán Oracle trong `outputs/p2r/train//cells/*.npz` (khoảng 6 phút): tỉ số Oracle / B3d-Sa / M2-Sa, phần khoảng cách đã đóng; cận 1/B cho cấu trúc (a) classical (đã đăng ký) và (b) Berkson (thêm biến thể giữ hệ số ở 60 Hz và biến thể phổ chéo), tại σ_post và tại sai số warp; cờ vượt mép lưới B → `outputs/p2r/posthoc/{bound.csv, blur_ab.csv, meta.json}` | `code_thesis/` là bản lưu trữ code luận văn. Giữ nguyên nội dung để đối chiếu: các script này còn đường dẫn máy cũ và ghi vào `outputs/`, nên cần một bản sao đã điều chỉnh đường dẫn nếu muốn chạy lại. Kiểm tra bộ artifact hiện có bằng `python scripts/00_data_manifest.py --dataset thesis --check`. diff --git a/configs/d3_volve.yaml b/configs/d3_volve.yaml index 782ca15..53828c3 100644 --- a/configs/d3_volve.yaml +++ b/configs/d3_volve.yaml @@ -39,3 +39,70 @@ checkshots: # ROI from the trajectories of the 10 wells above + 500 m (D3 inventory §4), ED50 / UTM 31N roi_xy: [433308, 437150, 6477323, 6479997] + +# P4 (Volve field phase, plan §6): the 6 wells with DT + RHOB + NPHI + PHIF (D3), all deviated. +# Read by ml_porosity/data/volve_wells.py and scripts/23_build_volve_wells.py (-> outputs/volve/volve_wells.npz). +p4: + survey_dir: Well_technical_data/WellWellbore # Compass "ACTUAL" exports: minimum curvature, grid north, MD RKB + log_subdir: 05.PETROPHYSICAL INTERPRETATION # under well_logs_dir/ + las_input: WLC_PETRO_COMPUTED_INPUT_1.LAS # DT, RHOB, NPHI, GR + las_output: WLC_PETRO_COMPUTED_OUTPUT_1.LAS # PHIF, on the INPUT MD grid + wells: + F-1: + picks: NO 15/9-F-1 + logs: 15_9-F-1 + survey: 15_9-F-1/15_9-F-1/Volve F_F-1_F-1_F-1_ACTUAL + F-1 A: + picks: NO 15/9-F-1 A + logs: 15_9-F-1 A + survey: 15_9-F-1/15_9-F-1 A/Volve F_F-1_F-1 A_F-1 A_ACTUAL + F-1 B: + picks: NO 15/9-F-1 B + logs: 15_9-F-1 B + survey: 15_9-F-1/15_9-F-1 B/Volve F_F-1_F-1 B_F-1 B_ACTUAL + F-11 A: + picks: NO 15/9-F-11 A + logs: 15_9-F-11 A + survey: 15_9-F-11/15_9-F-11 A/Volve F_F-11_159-F-11 A_159-F-11 A_ACTUAL + F-11 T2: + picks: NO 15/9-F-11 T2 + logs: 15_9-F-11 T2 + survey: 15_9-F-11/15_9-F-11 T2/Volve F_F-11_159-F-11 T2_159-F-11 T2_ACTUAL + # Alternative TDRs from `checkshots` above. RSVSP is left out: a rig-source VSP in a deviated hole is an + # offset VSP, and its vertical times end 35 ms earlier than NIVSP at 4530 m MD. + checkshots: [NIVSP, OPTIMIZED] + F-12: + picks: NO 15/9-F-12 + logs: 15_9-F-12 + survey: 15_9-F-12/15_9-F-12/Volve F_F-12_F-12_F-12_ACTUAL + # Wellbores sharing a slot, i.e. the hole above the kick-off: F-1 A and F-1 B leave F-1 at 2587 m MD, + # F-11 A leaves F-11 T2 at 2580 m MD. The `slot` blind scheme holds out the whole group. + slot_groups: [[F-1, F-1 A, F-1 B], [F-11 A, F-11 T2], [F-12]] + # Blind schemes for a held-out well (plan §5.2): its input is placed in time by the mean TVDSS–TWT relation of + # the wells it is held out from, never by its own picks or DT. lowo = all other wells, slot = other slots. + blind_schemes: [lowo, slot] + # Volve ROI of plan §12 item 7; 301 samples on the 4 ms grid. Margin only (B1 inversion, synthetics): above + # ~2320 ms the calibrated TDR of 5 wells is an extension beyond DT and anchors (F-11 T2: up to 49 ms off NIVSP). + ext_window_ms: [2000, 3200] + # Input, labels and scoring, 126 samples as in F3. Contains every calibrated label support (2509–2819 ms) and + # starts below the upward extension of every calibrated TDR; below DT the path runs on to TD, then is held there. + main_window_ms: [2400, 2900] + patch_radius: 1 # 3×3 traces along the well path + patch_method: bilinear # bilinear in (IL, XL) between bins; nearest is computed for QC only + label: PHIF + curves: [PHIF, DT, RHOB, NPHI, GR, AI] + dt_valid_us_per_ft: [40, 200] # DT outside this range is set to NaN before any TDR or AI is computed + # P4 also excludes FP (faulted pick): F-1 Skagerrak Fm. Top is the only FP pick with a TWT among the 6 wells. + anchor_exclude_qlf: [NL, NR, FP] + # Picks at most this far below the previous anchor are one marker (F-1: Heather Fm. Top and Heather Fm. Sand + # VOLVE Top are 0.3 m apart); keeps two near-identical anchors out of the stretch and the warp prior. + anchor_min_sep_m: 1.0 + edge_m: 30 # logged hole used for the velocity of the TDR extension beyond the DT range + # TDRs per well (ml_porosity/data/deviated.py), all integrating DT over TVD (vertical time): + # calibrated marker-calibrated vertical sonic: scoring reference (plan §5.2) and training-well path + # sonic vertical sonic through the first anchor in the DT range, uncalibrated: the τ axis of RML + # anchors linear in TVD between the anchors, without DT + tdrs: [calibrated, sonic, anchors] + resample: + fine_dt_ms: 0.25 + cutoff_frac: 0.8 diff --git a/configs/protocol_volve.lock.json b/configs/protocol_volve.lock.json new file mode 100644 index 0000000..794f801 --- /dev/null +++ b/configs/protocol_volve.lock.json @@ -0,0 +1,65 @@ +{ + "protocol_sha256": "7fdff4a1a4417da4322500548b7999657759fe5120c8a459b3d96ecb84a6b7b1", + "code_sha256": "c0befaa4442c50bcfe45352ba4b9c5a49ff2a4d1c2688cb85357ee828adbad95", + "environment": { + "python": "3.13.15", + "platform": "Linux", + "packages": { + "torch": "2.14.0+cu130", + "numpy": "2.5.4", + "scipy": "1.18.1", + "pandas": "3.0.6", + "matplotlib": "3.11.2", + "segyio": "1.9.14", + "lasio": "0.32", + "pylops": "2.5.0", + "numba": "0.67.0", + "scikit-learn": "1.9.1", + "PyYAML": "6.0.3", + "tabulate": "0.10.0", + "psutil": "7.2.2" + } + }, + "protected_artifacts": { + "outputs:wavelets.npz": "b689ea12578e580d8c2305c8f7219be05ff6e339884fa30b694111e968c0fc64", + "outputs:p2/warp_prior_f3.json": "55cda573c06b3a7275bdb4ac5f169fb4e5af329e1d199acc3d4daffe15624d27" + }, + "inputs": { + "repo:configs/d3_volve.yaml": "0d8613ab459292d3fcc3b60c43697bbbef222340daa00fde201b9d2cba5d1fd5", + "outputs:volve/volve_wells.npz": "ea496fac79c67a09543e5bc52dad200043bcb56eef7c371b948d0f04cc5a2c1d", + "outputs:volve/volve_wells_summary.json": "64e1278ad6a02cfac9f5b14df49bd6564e738fcaf0830f164652146b97e1fa4a", + "volve:Geophysical_Interpretations/Wells/Well_picks_Volve_v1.dat": "1c132bba09555915b62e23dc4475f790a304856d369d9d26cc76466cf7b77d3a", + "volve:Geophysical_Interpretations/Horizons/Horizons_TWT/Official_Horizons/Hugin_Fm_Top+ST10010ZC11_Near_190314+STAT+TIME.dat": "44e12e9c80fa59de95f6c6ea8ad76e3c7ebbefd6f6a8142966509f979666355d", + "volve:Well_technical_data/WellWellbore/15_9-F-1/15_9-F-1/Volve F_F-1_F-1_F-1_ACTUAL": "62ee61e501f4838e5eae6e4e012b75a8e8f74763594f5237ce3a65c8433c6d78", + "volve:Well_logs_pr_WELL/15_9-F-1/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "b7adf7938ff7c43d23d504370871ddb55304797ccfb6e6c886bf923118b2c789", + "volve:Well_logs_pr_WELL/15_9-F-1/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "53b060678accbae3afb3b40a8abe0881456fafbe4571cafeff80b1b2630c38c4", + "volve:Well_technical_data/WellWellbore/15_9-F-1/15_9-F-1 A/Volve F_F-1_F-1 A_F-1 A_ACTUAL": "7152f2dceb59c72a2d9ed05b71d8708ffde0de36145da75ec0af1f049528772f", + "volve:Well_logs_pr_WELL/15_9-F-1 A/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "494513a2f4448df524e6b0229697e26d2453640c37f8be2e45d3e7219a600602", + "volve:Well_logs_pr_WELL/15_9-F-1 A/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "4216236e9618ce348c80a1c2aef1cedde1bba9fa8c32dca0a6438a400439d845", + "volve:Well_technical_data/WellWellbore/15_9-F-1/15_9-F-1 B/Volve F_F-1_F-1 B_F-1 B_ACTUAL": "43d4739828f60a1e5e2fdbcb36601f082d3f375e4d087cfb8d093ee18765a3ed", + "volve:Well_logs_pr_WELL/15_9-F-1 B/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "ad9af11d31c9e116d686294ecb2c3aff7cd96ae7a03e633c70dcbcd7e0748468", + "volve:Well_logs_pr_WELL/15_9-F-1 B/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "6576989d3a8935f9f497ce05831b5dac396e653fbe7f7e4738de18bccf535645", + "volve:Well_technical_data/WellWellbore/15_9-F-11/15_9-F-11 A/Volve F_F-11_159-F-11 A_159-F-11 A_ACTUAL": "74bda9f018ef1714371de422c86c7ad3c63480d41c30f6cf3baa5b0588e59882", + "volve:Well_logs_pr_WELL/15_9-F-11 A/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "84ee266e0635a123ad51c96006835539b200fbc9fa6694d2b20a9067f1352870", + "volve:Well_logs_pr_WELL/15_9-F-11 A/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "680fe7522c635f23e034b9cc1a5b06593fc62f7c1c1d86e2565730ea785f94bf", + "volve:Well_technical_data/WellWellbore/15_9-F-11/15_9-F-11 T2/Volve F_F-11_159-F-11 T2_159-F-11 T2_ACTUAL": "2018eafc01148baf018e586109321c685f8676d94a902e2bef494e29622a1e04", + "volve:Well_logs_pr_WELL/15_9-F-11 T2/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "6ef9631e99d7da34b3d95356fa58dd6ecac230413723c320c30340dd7ed7979c", + "volve:Well_logs_pr_WELL/15_9-F-11 T2/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "d4c214e11d18a2aaa325dc8811d8d42ea77396f21f7d0bd9d022dfa08554a611", + "volve:Well_logs_pr_WELL/15_9-F-11 T2/08.VSP_VELOCITY/TZV_TIME_CHECKSHOT_1.ASC": "a58018419164ca3c9dbd9161cac40e590a8f89840b2a2da1be1622c76d9b673e", + "volve:Well_logs_pr_WELL/15_9-F-11 T2/08.VSP_VELOCITY/TZV_TIME_CHECKSHOT_3.ASC": "41c9dd5c5e0d8c7753bdc88f1ee50870a1a7dc67ecba73a16925f33ea1751ed1", + "volve:Well_technical_data/WellWellbore/15_9-F-12/15_9-F-12/Volve F_F-12_F-12_F-12_ACTUAL": "1e1e80a7656455b09b47aea0205f5f441aacb252c9fe09de2b48ba1279201afc", + "volve:Well_logs_pr_WELL/15_9-F-12/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_INPUT_1.LAS": "c38ffd606d7065e5c8904e126fd36ef736a4ce1149918ea88216bb3fe73db84e", + "volve:Well_logs_pr_WELL/15_9-F-12/05.PETROPHYSICAL INTERPRETATION/WLC_PETRO_COMPUTED_OUTPUT_1.LAS": "3633fd2e7797d80b7dc0b272276bc34124e06d275a129926f0afc57ce596a3dc" + }, + "locked_utc": "2026-10-29T01:17:42.222240+00:00", + "segy_sha256": "f902e2bdaa277caf93a32e5f35eae653eb8b923138db0efc1e91918ef6757b2e", + "canonical_text": "UTF-8, CRLF normalized to LF for code, protocol and source configuration; binary inputs exact", + "wells": [ + "F-1", + "F-1 A", + "F-1 B", + "F-11 A", + "F-11 T2", + "F-12" + ] +} \ No newline at end of file diff --git a/configs/protocol_volve.sha256 b/configs/protocol_volve.sha256 new file mode 100644 index 0000000..113e4b9 --- /dev/null +++ b/configs/protocol_volve.sha256 @@ -0,0 +1 @@ +7fdff4a1a4417da4322500548b7999657759fe5120c8a459b3d96ecb84a6b7b1 configs/protocol_volve.yaml diff --git a/configs/protocol_volve.yaml b/configs/protocol_volve.yaml new file mode 100644 index 0000000..82f0b88 --- /dev/null +++ b/configs/protocol_volve.yaml @@ -0,0 +1,185 @@ +# P4 Volve (plan D3, gate G-D): designed 28/10/2026 after P3 (G-C failed) and before any Volve PHIF metric, +# prediction or training run. DRAFT until `scripts/24_run_volve.py lock` on the run machine; after the lock this file +# is never edited (a change needs protocol_volve v2 with a recorded deviation). +version: 1 +date: '2026-10-28' +prior_observation: >- + Before this file, Volve had only descriptive QC of DT, RHOB, picks, checkshots and seismic (plan §12 item 18). + The main window was chosen once from the label positions of all six wells, not their values. The design follows + protocol_f3 after its G-C failure was known: a post-P3 design for a second field, not a pre-registration made + before any field result. +data: + wells: [F-1, F-1 A, F-1 B, F-11 A, F-11 T2, F-12] + label: PHIF + dataset: outputs/volve/volve_wells.npz + source_config: configs/d3_volve.yaml + window_ms: [2400, 2900] + ext_window_ms: [2000, 3200] + min_label_samples: 8 + references: [calibrated, anchors, NIVSP, OPTIMIZED] + primary_reference: calibrated + note: >- + PHIF is the CPI effective porosity, density-driven and not a function of DT (plan D3). It is used only where DT + is valid (16–37 samples of 4 ms per well). DT enters the time placement: vertical sonic integrated over TVD, + calibrated to the markers. NIVSP and OPTIMIZED exist only at F-11 T2. + missing_labels: >- + Never extrapolate labels. Each bank member keeps the samples where its own tie places the label run (member + support); a member with fewer than min_label_samples samples in a training well is an error. A scoring + reference with fewer than min_label_samples samples is listed, not scored. +split: + schemes: [lowo, slot] + outer: >- + lowo: every other well trains. slot: every well outside the slot group of the test well trains + (d3_volve.yaml p4.slot_groups: {F-1, F-1 A, F-1 B}, {F-11 A, F-11 T2}, {F-12}). + inner: >- + Leave one outer training well out, under both schemes. Under slot an inner validation well can share a slot + with inner training wells (deviation inner_lowo_under_slot). + inputs: >- + Training wells: calibrated reference path. Validation well v: blind key T_in. Outer test well u: blind key + T_out. A blind key K places the well path in time by the mean TVDSS–TWT relation of the wells K only; a + held-out well never supplies its picks, DT or logs to its own input. + seeds: [0, 1, 2, 3, 4] + selection: >- + Per scheme, outer fold, σ_a arm, method and seed: lowest mean original-scale validation MSE over the inner + wells, on their labelled samples of the primary reference; ties choose the earliest budget. + final: >- + Ensemble the inner models at the selected budget on the outer test input, then the five seeds (moment-matched + Gaussian mixture). No refit on the outer test well. + cache: >- + One trajectory per distinct inner training set, method, seed and σ_a arm (22 sets: 15 of four wells, 4 of + three, 3 of two). It predicts every input a fold can ask of it and is reused by every fold that trains on that + set; the other wells supply seismic only. +registration: + kernel: matern32 + sigma_a_ms: 7.0 + sigma_b_ms: 50.0 + hyperprior: {sigma_g: [0.05, 1.0], ell_ms: [150.0, 1.0]} + hyper_starts: 4 + S: 64 + particles: 1024 + g_max: 1.0 + wavelet_ms: 128 + tau_range_ms: [1800, 3400] + fine_dt_ms: 0.5 + log_fine_dt_ms: 0.25 + log_cutoff_frac: 0.8 + warp_dtau_ms: 4.0 + smc_seed: 0 + phase_step: 15.0 + phase_half_width: 3 + phase_max_extra: 6 + smc_moves: 8 + sigma_a_sensitivity_ms: [3.5, 14.0] + sensitivity_methods: [B3c-R, B3d-Sa, M2-Sa] + sigma_a_note: >- + 7 ms is inherited from P2r and protocol_f3, not estimated on Volve. Both misspecification arms are reported + if run, never used to choose a test result. + training_only: >- + Hyperparameters, statistical wavelet, phase and SMC posterior of a set use its training wells only. τ is the + vertical-sonic time through the first anchor in the DT range; anchors are markers in the DT range inside the + ext window. +training: + d_channels: 64 + p_dropout: 0.05 + lr: 0.005 + grad_clip: 5.0 + budgets: [125, 250, 500, 1000, 2000] + window_samples: 126 + window_step: 2 + loss: >- + ml_porosity.volve.losses.masked_bank_loss with one window, the whole main window (126 samples), and the label + support of each member; member log-likelihoods are compared at the mean member count, normalised by it, then + averaged over wells. Equal to the F3 bank loss with a 126-sample window when every sample is labelled. + λ = 1/τ_c from the pooled ACF of the high-passed B3b label runs of the training set. +methods: + main: [B3b, B3c, B3c-R, B3d-Sa, M2-Sa] + definitions: >- + B3b: sonic TDR stretched through the anchors. B3c: B3b plus smoothed local NCC shifts with the phase fitted on + anchor-prior samples. B3c-R: the same with the SMC-refined phase. B3d-Sa: posterior-mean tie. M2-Sa: RML on + S = 64 posterior label draws. + posterior_mean_definition: >- + B3d-Sa averages the forward maps t(τ) over retained particles and then inverts that mean, as in protocol_f3. +metrics: + primary: rmse + f_c_hz: 6.0 + desc_band_min_samples: 16 + best_shift_max_samples: 16 + levels: [50, 80, 90, 95] + units: 'porosity units (fraction multiplied by 100)' + reporting: >- + Per well first, then the unweighted mean over wells, per scheme; seed and combined ensembles separate. Every + available reference is reported; the primary reference is never replaced by a better-scoring one. No p-values + on correlated time samples. Best-shift is a separate diagnostic table. +gate: + name: G-D + candidate: M2-Sa + point_competitors: [B3b, B3c, B3c-R] + same_posterior_method: B3d-Sa + competitor_selection: >- + Per scheme and outer fold: lowest inner-validation MSE averaged over seeds, primary σ_a arm; never outer-test + metrics. + report: >- + Per scheme, primary reference and σ_a arm, combined ensemble: the wells where M2-Sa RMSE is below the selected + competitor, macro RMSE of both, M2-Sa versus B3d-Sa, macro coverage80 and coverage90 of M2-Sa, and every well. + claim_rules: + min_improved_wells: 5 + coverage_80: [0.75, 0.85] + coverage_90: [0.85, 0.95] + wording: >- + "Consistent improvement" only if at least 5 of 6 wells improve under both schemes (G-C's 3 of 4, scaled + and rounded up); "calibrated" only if both macro coverages lie in their bands under both schemes. Otherwise + the result is reported as it is (mixed, no improvement, under- or over-coverage). Neither wording overrides + the G-C failure on F3. + note: >- + G-D is descriptive: report results in either direction and scope claims by them (plan §6). No threshold here + changes the plan. +out_of_scope: >- + B0–B2, B3a, B3d, B4, B5, M1 and the F3 ablations (plan §6 scope cut 5), LOAO, the posterior-GP scoring reference, + the calibration-assisted setting and volume prediction. +deviations: + likelihood_window: >- + AI exists only over the logged interval, so the tie likelihood of a well (phase grid, SMC, γ) uses the ext + samples from its first to its last calibrated AI sample; F3 used the whole ext window. B3c and B3c-R keep the + full-window local shifts (windows without synthetic energy are dropped). + particle_validity: >- + A particle must invert over the main window only; F3 also required label support over the full window, which + 16–37-sample labels cannot meet. + member_support: >- + Each member trains on its own label support. The first draft intersected the supports of all members and + methods; the CPU smoke (16 particles, S = 8, training wells only, no PHIF metric) cut F-11 A from 15–17 to 7 + samples, below min_label_samples, and the intersection shrinks further with S = 64 draws and wider σ_a. The + intersection length is kept as a diagnostic (registration.csv, common_samples). + masked_loss: >- + Masked bank loss with a single 126-sample window instead of the F3 64-sample windows at step 2 (training.loss). + Label runs (16–37 samples) are shorter than an F3 window, so sliding windows would only cut a run at + arbitrary offsets and pick the RML member per offset; one window compares members over the whole run. + segment_lambda: >- + λ from label runs of any length (pooled lagged products) instead of the F3 full-window ACF; identical for runs + longer than the maximum lag. + primary_metric: >- + RMSE on labelled samples replaces the F3 band RMSE: label runs are shorter than one period at f_c = 6 Hz, so + the F3 band split is undefined; band_* (runs of at least 16 samples) is descriptive. + inner_lowo_under_slot: >- + Inner validation under slot is leave-one-well-out, not slot-blind (three slots leave too few groups); inner + validation can be optimistic there. + tau_range: '[1800, 3400] ms: the F3 margins of 200 ms around the ext window.' + main_window: 'Chosen from the label positions of all six wells (not values), once, before any training.' + lateral_path: >- + The 3×3 patch follows the deviated path placed in time by each TDR, so the blind TDR also moves the path + laterally (up to 76 m, F-1 A under slot). Recorded, not corrected. + scope: 'See out_of_scope; plan §6 scope cut 5 (Volve: best B3, B3d-S and M2 only).' +runtime: + device: cuda:1 + workers: 8 + cpu_threads_per_worker: 2 + machine: >- + Linux GPU server (shared; cuda:1 chosen by free memory) via scripts/run_p4.sh, decided 29/10/2026 after the + benchmark stage (training wells only, no PHIF metric) instead of the Windows RTX 3060 workstation planned on + 28/10; scripts/run_p4.ps1 stays the Windows driver. The lock binds code, inputs and environment. Worker count + and scheduling do not change results: every job seeds from its own settings. + order: >- + lock; register, train and summarize the primary arm; then register and train --arms sensitivity and + summarize --arms all. An arm not finished before writing is reported as not run. + resume: >- + A completed job is reused only if protocol, code, inputs, training wells, method, seed and σ_a fingerprints + and the artifact checksums match. diff --git a/docs/plan.md b/docs/plan.md index 17be5cf..2c3d665 100644 --- a/docs/plan.md +++ b/docs/plan.md @@ -21,13 +21,13 @@ Quy ước nhãn: | Mục | Quyết định | | --- | --- | | **Gap nhắm tới** | Trong học có giám sát seismic → porosity với ít giếng, *vị trí thời gian của nhãn* là một ước lượng (well tie). Sai số của nó có thể đạt cỡ nửa chu kỳ wavelet trở lên. Các công trình hiện có thuộc ba nhóm, không nhóm nào lấp gap: (i) giải tie như bước tiền xử lý và chỉ giữ một nghiệm điểm; (ii) mô hình hóa bất định của porosity nhưng giả định nhãn đã đăng ký đúng; (iii) dùng loss chịu dịch thời gian mà không có ràng buộc độc lập. **Chưa thấy công trình nào coi sai số đăng ký là biến ẩn, ràng buộc nó bằng anchor độc lập và vật lý, marginalize nó khi huấn luyện, rồi truyền nó sang bất định dự đoán và vào cách đánh giá.** | -| **Tên làm việc** | *Registration-marginalized learning for sparse-well seismic porosity prediction*. Phương án khác: *When the well tie is uncertain: anchor-constrained registration marginalization for seismic porosity prediction*. | +| **Tên làm việc** | **Từ 29/10/2026 (Pivot 1, mục 12 ý 22):** *Label registration error in sparse-well seismic property learning: theory, a registration-aware benchmark, and the limits of field validation*. Tên cũ (trước pivot): *Registration-marginalized learning for sparse-well seismic porosity prediction*; phương án khác: *When the well tie is uncertain: anchor-constrained registration marginalization for seismic porosity prediction*. | | **Phương pháp (tên làm việc)** | **RML** (Registration-Marginalized Learning). Prior Gaussian process (GP) đặt trên hiệu chỉnh log-slowness, có điều kiện theo marker anchors. Thêm likelihood well tie vật lý. Huấn luyện bằng marginal likelihood (tempered). Phương pháp không phụ thuộc backbone. | -| **Đóng góp (C1–C4)** | C1: formulation và lý thuyết, gồm "MSE dưới misregistration = học một target bị làm mờ" và điều kiện nhận dạng. C2: phương pháp RML. C3: giao thức đánh giá có xét registration, kèm benchmark synthetic hiệu chỉnh theo F3 và phase diagram "khi nào việc này quan trọng". C4: audit dữ liệu F3 cho bài toán porosity (mục 1.2). | +| **Đóng góp (C1–C4)** | C1: formulation và lý thuyết, gồm "MSE dưới misregistration = học một target bị làm mờ" và điều kiện nhận dạng. C2: phương pháp RML. C3: giao thức đánh giá có xét registration, kèm benchmark synthetic hiệu chỉnh theo F3 và phase diagram "khi nào việc này quan trọng". C4: audit dữ liệu F3 cho bài toán porosity (mục 1.2). **Pivot 1 (29/10/2026):** đóng góp viết lại thành C1′–C4′ theo `docs/research/pivot-theory-benchmark.md` mục 3.2; bản nháp đã viết theo khung này (mục 12 ý 24): C1′ lý thuyết (Mệnh đề 1 blur, 2 nhận dạng, 3 hai cấu trúc sai số classical/Berkson, 4 bank hiệu chỉnh với lợi ích quần thể bậc bốn, 5 coverage, 6 tham chiếu lệch, Hệ quả 4 tolerance); C2′ benchmark có warp thật, pre-register, kèm trục misspec S2 (chưa chạy); C3′ RML_λ làm họ baseline (Bổ đề 1–5), không phải phương pháp thắng; C4′ khả năng phát hiện ở giếng blind (T3) và phạm vi của field test (F3, Volve, Teapot). | | **Không phải đóng góp** | Backbone mới, thêm attention, thêm loss, Cycle-GAN, hay chỉ sửa leakage. | -| **Venue chính** | *Geophysical Prospecting* hoặc *Journal of Applied Geophysics*. Dự phòng: *Frontiers in Earth Science*, *Earth Science Informatics*, *Acta Geophysica*. Quartile phải kiểm tra lại trên SCImago khi nộp [XM]. | -| **Thời gian** | **Lịch nén (chốt 27/10/2026): xong toàn bộ bài trước thứ 7, 31/10/2026.** 6 ngày (T2 26/10 → T7 31/10/2026), 4 cổng go/no-go: G-A và G-B ngày 26/10 (đã đánh giá), G-C cuối 28/10, G-D cuối 29/10. Lịch gốc 24 tuần (→ 02/05/2027) đã bỏ. | -| **Việc tuần này** | Mục 6 (lịch theo ngày) và mục 12. | +| **Venue chính** | **Chốt 29/10/2026:** *Computers & Geosciences*; dự phòng *Geophysical Prospecting* (mục 12 ý 22). Trước pivot: *Geophysical Prospecting* hoặc *Journal of Applied Geophysics*; dự phòng *Frontiers in Earth Science*, *Earth Science Informatics*, *Acta Geophysica*. Quartile phải kiểm tra lại trên SCImago khi nộp [XM]. | +| **Thời gian** | **Chốt 29/10/2026: dời hạn sang thứ 7, 14/11/2026** (mức B của Pivot 1, mục 12 ý 22; lịch theo ngày ở mục 6.1). Ngưỡng và luật của mọi gate không đổi. Lịch nén trước đó (chốt 27/10/2026, hạn 31/10) đã chạy xong 4 cổng: G-A và G-B ngày 26/10, G-C cuối 28/10, G-D cuối 29/10; G-C và G-D không đạt tiêu chí claim (mục 12, ý 16 và 20). Lịch gốc 24 tuần (→ 02/05/2027) đã bỏ. | +| **Việc tuần này** | Mục 6.1 (lịch mức B theo ngày) và mục 12 ý 22. | --- @@ -337,7 +337,7 @@ Bảng này biến ablation thành một con đường đi từ v2 tới RML. | --- | --- | --- | --- | | **D1** | F3, 4 giếng, LOWO 4 fold | Field chính | Cửa sổ chính 600–1100 ms, thêm cửa sổ mở rộng để kiểm tra robustness. **Quyết định D-1** (mục 12): nhãn chính là PHIE_DT hài hòa (−0.2018 + 0.0011·DT cho cả 4 giếng), nhãn gốc là phụ. Kiểm kê [NLOG](https://www.nlog.nl) ngày 26/10/2026 [KT, `docs/research/f3-nlog-inventory.xlsx`]: 38 borehole/sidetrack trong footprint, 7 hồ sơ có TD số. Hai giếng ngoài bộ demo có DT + RHOB đo + TD số phủ cửa sổ: **F03-03** (DT/RHOB 500–3920 m MD, TWT 0–3165 ms) và **F03-06** (DT/RHOB 501–3701 m MD, TWT 0–3044 ms). F03-05-S1 không dùng được vì TD số bắt đầu ở 1295 ms. NLOG có RHOB đo cho F03-4 (473–3155 m), có thể làm nhãn thay thế. Điểm cần làm tiếp: NLOG không có PHIE, nhãn phải tự tính từ RHOB đo; DT của NLOG tính bằng µs/ft; chưa QC washout; file TZ có thể là TD đã xử lý chứ không phải checkshot độc lập. **D-1 chốt ngày 26/10/2026** (mục 1.2d hệ quả 6). Nhãn chính là PHIE_DT, báo cáo rõ là porosity dẫn xuất từ sonic. PHIE gốc là nhãn phụ, chỉ để so với luận văn. φ_D từ RHOB đo chỉ dùng để đánh giá độ nhạy ở F02-1 và F03-4, không dùng để train. Giữ 4 giếng; hoãn mở rộng lên 6 giếng vì F03-03 và F03-06 chưa có marker để làm anchor TD, file TZ có thể là TD đã xử lý, và F03-06 có DRHO cao. Phần kiểm tra độc lập với sonic giao cho D3 (PHIF của Volve). Protocol v2 đã khoá không đổi, vì nó đã dùng PHIE_DT chính và PHIE phụ. | | **D2** | Synthetic hiệu chỉnh theo F3 | Biết ground truth registration; tạo phase diagram | Earth model dựng từ 7 horizon + FaultA. Thuộc tính theo lớp lấy từ thống kê log cộng Gaussian random field. Chuỗi rock physics F3 chính xác. Wavelet ước lượng từ F3, noise SNR {∞, 20, 10, 5} dB. Drift g lấy từ GP fit trên anchor F3, nhân hệ số ×{0, 0.5, 1, 2}, cộng các họ drift sai mô hình (bước nhảy tại Truncation, jitter tần số cao). Anchor đặt tại giao horizon–giếng và có pick noise. Giả lập 2/4/8/16 pseudo-well. Split theo realization và theo khối không gian. | -| **D3** | Field thứ hai: [Volve, Equinor](https://www.equinor.com/energy/volve-data-sharing) | Kiểm tra transfer; porosity tính độc lập với sonic (density–neutron, CPI) phá vỡ cấu trúc PHIE = f(DT) của F3 | Kiểm kê bản Volve cục bộ ngày 26/10/2026 [KT]: giấy phép CC BY-NC-SA 4.0 (không thương mại, phải ghi nguồn, chia sẻ lại cùng giấy phép). 9 giếng có PHIF đã tính (F-1, 1A, 1B, 1C, 11A, 11B, 11T2, 12, 15D), chỉ ở đoạn reservoir khoảng 3100–4750 m MD. Chỉ **6 giếng** có đủ DT + RHOB + NPHI + PHIF (F-1, 1A, 1B, 11A, 11T2, 12); F-1C, 11B, 15D không có DT. Checkshot/VSP chỉ có ở **F-11 T2 và F-15 A**. **Không có cube post-stack** trong bản này (các SEGY là VSP), phải tải riêng. Tọa độ giếng chưa lấy (LAS để trống; cần EDM/Compass). PHIF của Volve phụ thuộc density, không phụ thuộc sonic: corr(PHIF, RHOB) từ −0.92 đến −0.99, R² theo RHOB + NPHI từ 0.84 đến 0.98, thêm DT chỉ nâng thêm tối đa 0.009. Giả thuyết phá vỡ cấu trúc PHIE = f(DT) được xác nhận. Điểm vướng: điều kiện "≥ 6 giếng" cần thêm time-depth cho 4 giếng chưa có checkshot, và cần cube seismic. *Cập nhật 26/10/2026: cả hai đã gỡ (well picks cho marker TWT ở cả 10 giếng; cube ST10010 đã tải và kiểm tra, xem mục 12 ý 7).* Chỉ lấy ROI quanh ≥ 6 giếng. Dự phòng: Penobscot (2 giếng, yếu) hoặc NLOG. | +| **D3** | Field thứ hai: [Volve, Equinor](https://www.equinor.com/energy/volve-data-sharing) | Kiểm tra transfer; porosity tính độc lập với sonic (density–neutron, CPI) phá vỡ cấu trúc PHIE = f(DT) của F3 | Kiểm kê bản Volve cục bộ ngày 26/10/2026 [KT]: giấy phép CC BY-NC-SA 4.0 (không thương mại, phải ghi nguồn, chia sẻ lại cùng giấy phép). 9 giếng có PHIF đã tính (F-1, 1A, 1B, 1C, 11A, 11B, 11T2, 12, 15D), chỉ ở đoạn reservoir khoảng 3100–4750 m MD. Chỉ **6 giếng** có đủ DT + RHOB + NPHI + PHIF (F-1, 1A, 1B, 11A, 11T2, 12); F-1C, 11B, 15D không có DT. Checkshot/VSP chỉ có ở **F-11 T2 và F-15 A**. **Không có cube post-stack** trong bản này (các SEGY là VSP), phải tải riêng. Tọa độ giếng chưa lấy (LAS để trống; cần EDM/Compass). *Cập nhật 28/10/2026: trajectory lấy từ survey Compass, xem mục 12 ý 18.* PHIF của Volve phụ thuộc density, không phụ thuộc sonic: corr(PHIF, RHOB) từ −0.92 đến −0.99, R² theo RHOB + NPHI từ 0.84 đến 0.98, thêm DT chỉ nâng thêm tối đa 0.009. Giả thuyết phá vỡ cấu trúc PHIE = f(DT) được xác nhận. Điểm vướng: điều kiện "≥ 6 giếng" cần thêm time-depth cho 4 giếng chưa có checkshot, và cần cube seismic. *Cập nhật 26/10/2026: cả hai đã gỡ (well picks cho marker TWT ở cả 10 giếng; cube ST10010 đã tải và kiểm tra, xem mục 12 ý 7).* Chỉ lấy ROI quanh ≥ 6 giếng. Dự phòng: Penobscot (2 giếng, yếu) hoặc NLOG. | ### 5.2 Giao thức blind well và tham chiếu đánh giá @@ -403,7 +403,7 @@ Lưới thí nghiệm: --- -## 6. Lộ trình với cổng go/no-go (lịch nén: xong trước T7 31/10/2026) +## 6. Lộ trình với cổng go/no-go (hạn hiện tại: T7 14/11/2026; lịch nén 31/10 trước đó) Chốt ngày 27/10/2026: toàn bộ bài, gồm cả review nội bộ và bản nộp, phải xong trước thứ 7, 31/10/2026. Lịch gốc 24 tuần (26/10/2026 → 02/05/2027) bỏ. P0–P2 đã xong trong ngày 26/10, nên lịch nén chỉ còn chẩn đoán sau G-B, F3, Volve, viết và nộp. Ngưỡng các cổng **không đổi**; chỉ ngày thay đổi. @@ -412,17 +412,36 @@ 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). 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ộ | -| **P6 Review + nộp** | T7 31/10 | GVHD và một người làm địa vật lý đọc; kiểm tra novelty lần cuối (quét SEG/EAGE, tra quartile); preprint (EarthArXiv/ESSOAr) nếu venue cho phép; nộp | Bản nộp | — | +| **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. Kết quả: không đạt (1/4 giếng; coverage 52,38/60,91%; mục 12, ý 16) | +| **P4 Field 2** | T4 28/10 dựng pipeline (song song P3); T5 29/10 chạy (xong 02:21 UTC trên server Linux) | ROI Volve, tie, pipeline; chạy tập con B1, B3 tốt nhất, B4, B5, M2. Đã áp dụng mục cắt phạm vi 5: B3b, B3c, B3c-R (ứng viên B3), B3d-Sa, M2-Sa | Bảng field 2 (`outputs/p4/summary/`; paper mục 6.5) | **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ả. Kết quả: M2-Sa tốt hơn B3 chọn ở 2/6 (lowo) và 3/6 (slot) giếng; coverage90 0,48/0,47; không phương pháp nào có kỹ năng ở giếng blind. Không claim cải thiện, hiệu chuẩn hay transfer (mục 12, ý 20–21) | +| **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; từ 29/10 theo lịch mức B (mục 6.1) | 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). Ngày 29/10: đã viết các mục Volve; trục bài đặt vào lý thuyết và benchmark synthetic, hai field là kiểm tra giới hạn phạm vi (mục 12, ý 21). **Mức A viết xong sớm ngày 29/10** (mục 6.1, mục 12 ý 24): bản nháp theo khung Pivot 1, 55 trang, biên dịch sạch; còn TODO đỏ cho S1–S8, T2, khai báo của tác giả. Rủi ro độ dài: thân bài khoảng 14.750 từ so với giới hạn khoảng 5.500 từ của C&G (chưa kiểm trên trang chính thức); người dùng bỏ lượt rút gọn (mục 12 ý 25) | Review nội bộ | +| **P6 Review + nộp** | T7 31/10 → dời sang T4 11/11 – T7 14/11 (mục 6.1) | GVHD và một người làm địa vật lý đọc; kiểm tra novelty lần cuối (quét SEG/EAGE, tra quartile); preprint (EarthArXiv/ESSOAr) nếu venue cho phép; nộp | Bản nộp | — | -**Thứ tự cắt phạm vi nếu trễ** (cắt từ trên xuống, không cắt các cổng hay ngưỡng): +### 6.1 Lịch mức B sau Pivot 1 (chốt 29/10/2026; hạn T7 14/11/2026) + +Pivot 1 kích hoạt ngày 29/10/2026 (mục 12 ý 22): bài chuyển thành lý thuyết + benchmark synthetic, hai field case là phạm vi. Thiết kế đầy đủ ở `docs/research/pivot-theory-benchmark.md` (mục 4.2 và 6). Mọi thí nghiệm mới chạy dưới `configs/protocol_bench.yaml` khóa trước lần chạy đầu; không đụng `protocol_p2r`, `protocol_f3`, `protocol_volve` và kết quả của chúng. + +| Ngày | Việc | Đầu ra | +| --- | --- | --- | +| T5 29/10 | Chốt 5 quyết định; cập nhật plan, AGENTS, report; khảo sát dataset field public (`docs/research/field-dataset-survey.md`) | Quyết định ghi ở mục 12 ý 22 | +| T6 30/10 – T7 31/10 | Mức A: viết lại abstract, intro, contributions, discussion, conclusion; T1, T4, T8 thành mệnh đề; T4 từ `outputs/p2r/train/*/cells/*.npz`; T3 (giải tích + mô phỏng trên dự đoán P2r); T10 related work. **Xong sớm ngày T5 29/10** (mục 12 ý 24). Việc còn lại của hai ngày này: trích dẫn dataset F3 và Volve; còn lại là dự phòng. Lượt rút gọn độ dài cho venue đã bỏ theo quyết định của người dùng ngày 29/10 (mục 12 ý 25) | Draft khung mới (xong) | +| CN 1/11 | T2 exploratory (khai báo trước ở `docs/research/t2-mechanism.md`): responsibility-weighted warp error; bank nhiễu đối chứng; tách ô đa mode; kiểm Berkson hay classical (hiệp phương sai offset); B3d-Sa ở số vòng lặp của Oracle | Phân tích cơ chế: còn lợi ích nào vượt hiệu chỉnh Berkson không | +| T2 2/11 – T3 3/11 | Sửa generator cho S2 (misspec rock physics, wavelet, σ_b/drift); dev trên realization 902–905; viết và khóa `protocol_bench.yaml` (S1, S2, S3, S4, S8) kèm `.sha256`, `.lock.json` | Protocol khóa | +| T4 4/11 – T5 5/11 | S1 lấp lưới c ∈ {0.5, 1.5}, N ∈ {2, 8}; S3 B4 dưới SMC; S4 backbone thứ hai (hai GPU) | Lưới đầy | +| T6 6/11 – T7 7/11 | S2 ba trục ở R10, Rm5, c = 1, N ∈ {4, 16}; S8/T8 cycle-skip | Bảng misspec | +| CN 8/11 – T3 10/11 | S7 đóng gói benchmark (một lệnh sinh, một lệnh chấm, bảng tham chiếu, README, hash, Zenodo); viết lại §4–5 | Gói benchmark; draft v2 | +| T4 11/11 – T5 12/11 | Review nội bộ; hình; phụ lục chứng minh; gói tái lập | Draft v3 | +| T6 13/11 | Kiểm tra novelty lần cuối; tra quartile; preprint | — | +| **T7 14/11** | **Nộp** *Computers & Geosciences* | Bản nộp | + +**Thứ tự cắt phạm vi nếu trễ (lịch mức B; không cắt ngưỡng):** (1) S4 backbone thứ hai; (2) S8/T8; (3) S2 rút còn một trục rock physics, khi đó bài gọi là "controlled synthetic study", không gọi là benchmark; (4) S1 rút còn c ∈ {0.5, 1.5} với N = 4/16; (5) T2 chỉ giữ thí nghiệm responsibility-weighted warp error. + +**Thứ tự cắt phạm vi nếu trễ (lịch cũ đến 31/10; mục 1 và 5 đã áp dụng)** (cắt từ trên xuống, không cắt các cổng hay ngưỡng): 1. M3 (RML-EM): đã hoãn. 2. Cửa sổ mở rộng của F3 (D-2): chỉ báo cáo cửa sổ chính 600–1100 ms. 3. Volume kèm bất định: chỉ một inline và một crossline qua giếng thay vì cả khối. 4. Leave-one-anchor-out: chỉ chạy ở c = 1 và một giếng F3. -5. Volve: chỉ B3 tốt nhất, B3d-S và M2 (bỏ B1, B4, B5). +5. Volve: chỉ B3 tốt nhất, B3d-S và M2 (bỏ B1, B4, B5). Đã áp dụng trong `protocol_volve`. 6. Lưới stress ở P2: chỉ trục SNR và mật độ anchor. **Ngân sách GPU (cuda:1):** lưới D2 chính mất 89 phút với posterior cũ; bản chạy lại với SMC dự kiến vài giờ, nên chạy qua đêm 27/10 → 28/10. Mọi bước trên F3 và Volve phải chạy được trong ban ngày. @@ -477,6 +496,8 @@ Giữ nguyên [`code_thesis/`](../code_thesis/) làm bản lưu trữ của lu - T4: ablation. - T5: field 2. +**Chốt 29/10/2026 (Pivot 1, mục 12 ý 22):** venue chính *Computers & Geosciences*; dự phòng *Geophysical Prospecting*. Dàn ý mới (8 mục, theory + benchmark + detectability) ở `docs/research/pivot-theory-benchmark.md` mục 3.3; dàn ý, hình và bảng dưới đây là bản trước pivot. Bản nháp ngày 29/10 đã theo dàn ý mới (mục 12 ý 24). Độ dài: thân bài khoảng 14.750 từ, trong khi giới hạn Research Article của C&G là khoảng 5.500 từ theo nguồn thứ cấp (chưa kiểm trên trang chính thức); xem R9 ở mục 9. Người dùng bỏ lượt rút gọn độ dài ngày 29/10 (mục 12 ý 25). + **Venue** (kiểm tra quartile SJR mới nhất khi nộp [XM]): | Venue | Lý do phù hợp | Lưu ý | @@ -502,9 +523,10 @@ Giữ nguyên [`code_thesis/`](../code_thesis/) làm bản lưu trữ của lu | R6: RML-EM suy sụp hoặc trọng số suy biến | Trung bình | M2 (fixed) là phương pháp chính; theo dõi ESS và các chẩn đoán ở mục 4.8 | | R7: truy cập dữ liệu (iCloud, dung lượng và giấy phép Volve) | Trung bình | Tải từ P0; chỉ lấy ROI; kiểm tra giấy phép trước khi công bố dữ liệu dẫn xuất | | R8: trễ tiến độ (lịch nén 6 ngày, xong trước 31/10/2026) | Cao | Cắt phạm vi theo thứ tự ở mục 6; các gate có ngày cố định; chạy GPU qua đêm; viết song song với thí nghiệm. Không nới ngưỡng cổng để kịp lịch. | +| R9 (thêm 29/10/2026): bản thảo dài gấp khoảng 2,7 lần giới hạn số từ của venue (C&G khoảng 5.500 từ, chưa kiểm trên trang chính thức) | Cao | Người dùng bỏ lượt rút gọn độ dài ngày 29/10 (mục 12 ý 25); rủi ro vẫn mở, chưa có biện pháp. Nếu sau này có rút gọn thì không bỏ kết quả âm hay deviation đã ghi. | **Các hướng pivot:** -- **Pivot 1:** chuyển thành bài phân tích. *"Label registration error in sparse-well seismic property learning: theory, benchmark and registration-aware evaluation"*, giữ C1 + C3 + C4, phương pháp chỉ là phần phụ. Vẫn khả thi ở Q2, ví dụ *Frontiers* hoặc *Earth Science Informatics*. +- **Pivot 1:** chuyển thành bài phân tích. *"Label registration error in sparse-well seismic property learning: theory, benchmark and registration-aware evaluation"*, giữ C1 + C3 + C4, phương pháp chỉ là phần phụ. Vẫn khả thi ở Q2, ví dụ *Frontiers* hoặc *Earth Science Informatics*. **Kích hoạt ngày 29/10/2026** (mục 12 ý 22; thiết kế ở `docs/research/pivot-theory-benchmark.md`; venue chốt *Computers & Geosciences*). - **Pivot 2:** chuyển sang G2 (nhận dạng theo băng thông), tái sử dụng hạ tầng D2. - **Pivot 3:** viết ghi chú audit benchmark F3 cho porosity; venue thấp hơn. @@ -560,7 +582,7 @@ Trạng thái ngày 26/10/2026. "Có" nghĩa là toàn văn nằm trong [`refs/` --- -## 12. Việc làm ngay (26/10–31/10/2026) +## 12. Việc làm ngay (26/10–14/11/2026) 1. `git init` kèm `.gitignore` loại trừ dữ liệu và `outputs/`. Ghi lại hash của dữ liệu theo `cleanup-manifest.json`. 2. ~~Tải về máy `F3_entire.segy` và các horizon.~~ **Đã xong ngày 26/10/2026** (tải F3 Demo 2023 đầy đủ qua gdown; 104 file đã lọc trước đó khớp byte-by-byte với bản mới). Ngày 27/10/2026 đã bổ sung `outputs_thesis/`: 7 artifact, có checkpoint/dự đoán v2 và volume hợp lệ; xem [audit](research/thesis-output-audit.md). @@ -614,7 +636,7 @@ Trạng thái ngày 26/10/2026. "Có" nghĩa là toàn văn nằm trong [`refs/` - **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. + - **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) đã đăng ký, nên không quy hết cho khử nhoè (*sửa 29/10: cận đã đăng ký là cận classical; với cận Berkson post hoc chỉ 3/8 ô rộng vượt, hai ô sát cận, và tối đa 1/8 tại sai số warp; xem ý 24*). 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. 15. **Triển khai P3 trên máy Windows / RTX 3060 (đêm 27–28/10/2026, trước kết quả P3):** @@ -637,5 +659,68 @@ Trạng thái ngày 26/10/2026. "Có" nghĩa là toàn văn nằm trong [`refs/` 17. **Đóng P3 và ghi chú cho paper (28/10/2026):** - **Quyết định:** đóng P3, không chạy P3r. Mọi thay đổi thiết kế lúc này đều là lựa chọn sau khi đã thấy nhãn test. Chuyển sang P4 Volve. - **Thứ tự thời gian của việc khóa (giờ máy Windows, +07):** pilot registration 00:07 và preflight baseline cổ điển 00:12, cả hai không tính metric trên giếng test; khóa SHA-256 lúc 00:14:50; smoke 00:15:05; main run 00:15:47. `protocol_f3.yaml` vào git lần đầu ở commit 9976abc (07:01, cùng với kết quả), và tag `protocol-f3` được gắn sau đó. Vì vậy bằng chứng khóa trước khi chạy là timestamp tự ghi trong `configs/protocol_f3.lock.json`, không phải lịch sử git. Paper (§6 và §6.4) ghi đúng như vậy. + - **Tái lập P3 dùng tag `protocol-f3`, không dùng HEAD (kiểm tra 28/10).** `source_hash()` (`ml_porosity/f3/protocol.py`) băm mọi `ml_porosity/**/*.py`, `scripts/*.py`, `scripts/run_p3.ps1` và `pyproject.toml` có trong cây làm việc, kể cả file chưa track; CRLF chuẩn hoá về LF. Bản export sạch của tag (9976abc, 70 file) cho đúng hash code trong khóa (`b5c82d2dfd53dcab…`). HEAD 7da6b07 (71 file) cho `542590c4ee6e1ec8…` vì commit 4a5d0b2 thêm `scripts/22_paper_figures.py` sau khi khóa; code P4 trong `ml_porosity/` và `scripts/` cũng đổi hash này. Khóa còn ghi môi trường Windows (Python 3.12.16, torch 2.11.0+cu128) và đường dẫn input dạng `outputs\f3_wells.npz`, nên `freeze()` chỉ qua trên máy Windows ở tag này; trên Linux chỉ tái tạo được hash code. Đây là đúng thiết kế khóa, không phải lỗi; không tạo lại khóa. - **Phân tích làm sau khi chạy (post hoc), chỉ mô tả, không đổi G-C:** (a) Mốc "không có nội dung băng" là RMS thành phần > 6 Hz của reference PHIE_DT calibrated, macro 1,224 p.u. Chỉ B4b (1,211) thấp hơn mốc này. (b) Trong cửa sổ 600–1100 ms, PHIE và PHIE_DT chênh RMS 3,2 p.u. ở F02-1 và < 0,02 p.u. ở ba giếng còn lại. (c) σ_post, pha và logZ tổng hợp từ `outputs/p3/registration/*.json`; thống kê volume từ `mean.npy`/`sigma.npy`. Nguồn từng con số ở `paper/README.md`. - **Lỗi nhãn trong code khóa:** `plot_sections` đặt nhãn trục x của PNG section inline là "inline", thực ra là crossline. Không sửa code khóa. Hình trong paper (`paper/figures/f3_volume.pdf`) được tạo lại bằng `scripts/22_paper_figures.py --only f3_volume`. +18. **P4 Volve: lớp dữ liệu giếng nghiêng (28/10/2026; chỉ CPU; chưa khóa, chưa tính metric PHIF nào):** + - **Code:** `ml_porosity/data/deviated.py` (trajectory minimum curvature từ survey Compass "ACTUAL", TDR thời gian thẳng đứng, đường giếng theo thời gian, mô hình TVDSS→TWT, patch 3×3 dọc đường giếng), `ml_porosity/data/volve_wells.py` (log, anchor, tập giếng train khi blind), `scripts/23_build_volve_wells.py` → `outputs/volve/volve_wells.npz` và `volve_wells_summary.json` (khoảng 1 phút CPU), test `tests/test_deviated.py`. Tham số ở mục `p4` của `configs/d3_volve.yaml`. + - **Survey:** cả 6 giếng đều nghiêng: inclination lớn nhất 30–82°, trên đoạn nhãn 4–54°. Tính lại minimum curvature khớp TVD của file trong 0,007 m và XY trong 0,44 m; MD/TVD đáy khớp header. Pick nằm trên survey trong 0,39 m TVD và 1,01 m XY, nhỏ so với bin 12,5 m. + - **Thời gian:** TWT tích phân DT theo TVD (giả định đẳng hướng), rồi hiệu chỉnh theo marker: stretch giữa các anchor, shift ngoài. Ở F-11 A, F-11 T2 và F-12, hệ số stretch là 0,92–1,37 khi tích phân theo TVD và 0,24–1,05 khi tích phân theo MD. Tại F-11 T2, TDR calibrated lệch NIVSP −2,4 đến −0,8 ms trên đoạn nhãn. RSVSP lệch +35 ms (offset VSP trong giếng nghiêng) nên không dùng. + - **Anchor:** pick có TWT, bỏ các surface nông và cờ NL, NR, FP (FP chỉ có ở F-1 Skagerrak). Pick cùng MD hoặc cách ≤ 1 m gộp làm một. Vận tốc khoảng Draupne→Heather Sand ở F-1 A là 2100 m/s, bất thường so với 3195–3490 m/s hai bên. Vận tốc khoảng liên tiếp ở F-1 B (2670/2674/2683 m/s) và F-11 A (2774/2764/2764 m/s) gần như trùng nhau, nên TWT pick có thể lấy từ mô hình vận tốc. Hai điểm này chỉ ghi nhận, không sửa. + - **Nhãn:** PHIF trong khoảng có DT hợp lệ, 16–37 mẫu 4 ms mỗi giếng (tổng 150), TWT 2509–2819 ms. Nhãn nằm dưới anchor cuối 25–179 m nên phụ thuộc drift sonic. Cửa sổ chính 2400–2900 ms (126 mẫu) chứa mọi nhãn và nằm dưới phần ngoại suy lên trên của mọi TDR calibrated (đỉnh có ràng buộc ≤ 2319 ms); 2000–3200 ms chỉ là lề. Cửa sổ chọn một lần theo vị trí nhãn của cả 6 giếng, trước mọi lần train. Nhãn ngắn hơn `window_samples` = 64 của F3, nên pipeline P4 cần loss có mask. + - **Đầu vào blind (chính, mục 5.2):** đường giếng test đặt theo thời gian bằng mô hình TVDSS→TWT trung bình của các giếng train, không dùng pick hay DT của giếng test. Seismic vẫn lấy ở cùng thời gian; TDR blind chỉ dời vị trí XY của đường giếng. Lưu đủ 31 tập con của 5 giếng còn lại cho hai scheme `lowo` và `slot`; `slot` bỏ cả nhóm chung lỗ khoan ({F-1, F-1 A, F-1 B}, {F-11 A, F-11 T2}, {F-12}). TDR blind lệch TDR calibrated tới 45 ms (F-1 A, slot), làm đường giếng dời tới 76 m. Đường calibrated của giếng test chỉ dùng cho thiết lập phụ "calibration-assisted". + - **Seismic:** patch 3×3 nội suy bilinear dọc đường giếng; nearest chỉ để QC (lệch RMS tương đối 0,05–0,09). Dưới TD, đường giếng giữ ở trạm cuối. Trên đoạn nhãn, trace thẳng đứng tại một bin lệch composite 0,19–0,61 (RMS tương đối), nên không dùng trace thẳng đứng. + - Các số trên là QC mô tả từ DT, RHOB, pick, checkshot và seismic; không chọn gì theo các số này. Việc tiếp theo: pipeline P4 (loss có mask, fold LOWO/slot), nháp `configs/protocol_volve.yaml`, smoke CPU, rồi khóa và chạy trên RTX 3060. +19. **P4 Volve: pipeline và protocol nháp (28/10/2026; chỉ CPU; chưa khóa, chưa tính metric PHIF nào):** + - **Code:** `ml_porosity/volve/` gồm `data.py` (view public/private), `folds.py` (fold lồng LOWO/slot), `losses.py` (bank loss có mask), `registration.py`, `training.py`, `runner.py` (job resume được, có checksum) và `evaluation.py` (chọn budget và đối thủ B3 bằng inner validation, G-D mô tả); `protocol.py` khóa code, input và môi trường. Script là `scripts/24_run_volve.py` và `scripts/run_p4.ps1`; test ở `tests/test_volve_pipeline.py`. Không sửa gì trong `ml_porosity/f3/`. + - **Chống rò nhãn:** view của tập train chỉ giữ của giếng ngoài tập thời gian, mask cửa sổ, KB, survey và các blind key K ⊇ tập train (giếng đó ∉ K). Đọc nhãn, đường reference hay quan sát registration của giếng đó sẽ báo lỗi. Việc chọn budget và đối thủ B3 đọc nhãn validation qua view của T_out, nên không thấy giếng test ngoài. Có test kiểm tra: đổi PHIF của giếng test thì selection và dự đoán của fold đó không đổi. + - **Fold:** 22 tập train khác nhau (15 tập 4 giếng, 4 tập 3, 3 tập 2) cho 52 fold lồng (30 LOWO, 22 slot). Mỗi trajectory dự đoán 8, 15 hoặc 34 đầu vào; cache dùng chung giữa các fold. Nhánh chính có 22 registration và 550 job train; hai nhánh σ_a có 44 registration và 660 job. + - **Deviation phát hiện ở smoke (trước khóa):** bản nháp đầu lấy giao support nhãn của mọi member và mọi method. Ở F-11 A (15–17 mẫu theo từng tie) giao này chỉ còn 7 mẫu, dưới ngưỡng `min_label_samples` = 8. Đo lại với cấu hình đầy đủ (1024 particle, S = 64) cũng ra 7. Sửa: mỗi member dùng support của chính nó; log-likelihood các member được so ở số mẫu trung bình; một cửa sổ duy nhất phủ cả cửa sổ chính (126 mẫu) thay cho cửa sổ 64 mẫu bước 2 của F3. Với mask chung, loss mới bằng đúng loss cũ. Sau khi sửa, smoke cho support nhỏ nhất mỗi member là 13 mẫu (F-11 A). Giao vẫn được ghi trong `registration.csv` (`common_samples`) để mô tả. Đã ghi trong `deviations.member_support` và `masked_loss` của `configs/protocol_volve.yaml`. + - **Smoke CPU** (`outputs/p4/smoke`, 16 particle, S = 8, 1 seed, budget 2/4): 22/22 registration và 110/110 job train, mọi output hữu hạn, không lỗi. Chưa chạy summarize vì bước này cần khóa. Một registration đầy đủ (tập 4 giếng) mất 847 s trên 4 luồng CPU; thời gian trên RTX 3060 sẽ đo bằng stage `benchmark`. + - **Việc tiếp theo trên máy Windows:** đồng bộ `outputs/volve/volve_wells.npz`, chạy `run_p4.ps1 -Stage benchmark`, rồi `-Stage lock` (khóa tạo trên máy chạy), rồi `-Stage all` và các nhánh σ_a. `run_p4.ps1` chưa được chạy thử vì Linux không có pwsh. +20. **P4 Volve: chạy xong, G-D (29/10/2026, server Linux, giờ UTC):** + - **Máy chạy (quyết định trước khóa):** chạy trên server Linux (H200), không chạy trên máy Windows RTX 3060 như ý 19. Stage `benchmark` (chỉ giếng train, không tính metric PHIF) lúc 01:16 cho registration tập 4 giếng 17 s trên GPU (847 s CPU). Trước khóa đã sửa mục `runtime` của `protocol_volve.yaml` (cuda:1, 8 worker, lý do) và thêm driver `scripts/run_p4.sh` vào hash code. 49/49 test pass. Khóa lúc 01:17:42 UTC (`protocol_sha256` 7fdff4a1…, `code_sha256` c0befaa4…, Python 3.13.15, torch 2.14.0+cu130, cube khớp manifest). + - **Deviation sau khóa (chỉ về lịch chạy):** `runtime.order` ghi chạy nhánh chính rồi mới tới nhánh σ_a, và `device` là cuda:1. Thực tế nhánh σ_a chạy song song trên cuda:0 từ 01:22 để tận dụng GPU trống. Device không nằm trong fingerprint, mỗi job tự seed, file hai nhánh tách riêng, nên chỉ có thể khác ở sai số dấu phẩy động giữa hai H200. Summarize `--arms all` cho G-D của nhánh chính trùng hệt lần summarize đầu. + - **Thời gian:** nhánh chính 22 registration (2 phút 47 giây) + 550 job train (46 phút 46 giây); nhánh σ_a 44 registration (5 phút 28 giây) + 660 job (52 phút 39 giây); không job nào lỗi. Server dùng chung (vLLM, job người khác): load CPU 30–69/40, cuda:1 có lúc còn 4 GB trống nhưng không OOM. + - **G-D (mô tả; tham chiếu calibrated, σ_a = 7 ms, ensemble gộp; `outputs/p4/summary/`):** lowo: M2-Sa tốt hơn B3 được chọn ở **2/6** giếng, RMSE macro 6,50 so với 6,36 (B3b) và 6,52 (B3d-Sa), coverage80/90 = 0,39/0,48. slot: **3/6** giếng, 7,13 so với 7,32 (B3 chọn) và 7,26 (B3d-Sa), coverage 0,35/0,47. **Không "consistent improvement", không "calibrated".** Ensemble under-cover nặng hơn F3. + - **Không có kỹ năng dự đoán ở giếng blind:** R² âm với mọi phương pháp và scheme (−0,84 đến −1,71, tham chiếu calibrated), PCC 0,12–0,24. Với tham chiếu anchors (4 giếng) PCC từ −0,11 đến +0,02; NIVSP/OPTIMIZED (chỉ F-11 T2) PCC âm. Các dự đoán M2-Sa, B3b, B3d-Sa gần trùng nhau; mô hình bỏ lỡ đoạn PHIF cao ở F-12 (~22 p.u.) và F-11 A. Khác biệt giữa các phương pháp tie (0,1–0,2 p.u.) nhỏ hơn rất nhiều so với sai số tổng (6–7 p.u.). + - **Nhánh σ_a (3,5 / 14 ms):** RMSE macro M2-Sa 6,49/6,55 (lowo) và 7,13/7,09 (slot), gần như không đổi so với 7 ms; coverage90 0,43–0,52. Trên Volve kết quả không nhạy với σ_a, vì không có tín hiệu nào để σ_a làm thay đổi (khác P2r, nơi H2a phụ thuộc σ_a). + - **Hệ quả cho paper:** Volve không ủng hộ transfer. Báo cáo như một kết quả âm thứ hai: với 16–37 mẫu nhãn mỗi giếng, giếng nghiêng và PHIF dẫn xuất từ density, seismic post-stack trong cửa sổ 2400–2900 ms không dự đoán được PHIF ở giếng blind bằng bất kỳ phương pháp tie nào; câu hỏi "RML có giúp không" không trả lời được trên Volve. Không claim cải thiện, không claim hiệu chuẩn, không claim transfer (mục 10). Không chạy lại hay đổi thiết kế (mọi thay đổi lúc này đều sau khi thấy nhãn test). +21. **P4 sau G-D: post hoc, đổi trục bài, exploratory P4x (29/10/2026; commit cùng ngày, ý 25):** + - **Post hoc, ngoài khóa, không đổi G-D** (`scripts/25_p4_posthoc.py` → `outputs/p4/posthoc/wells.csv`, `macro.csv`; tham chiếu calibrated, σ_a = 7 ms, ensemble gộp). Hằng số bằng trung bình PHIF gộp của các giếng train ngoài (không dùng seismic) có RMSE macro **6,03 (lowo) và 6,59 (slot)**, R² −0,70 và −1,14. Con số này thấp hơn mọi phương pháp (6,36–6,61 và 7,13–7,32). Trung bình PHIF từng giếng 8,5–17,0 p.u., SD trong giếng 3,3–6,0 p.u.; hằng số lệch trung bình giếng test tới 6,4 p.u. Độ lệch trung bình của M2-Sa bám độ lệch của hằng số: F-1 +3,9 so với +4,9, F-11 A −5,4 so với −4,3, F-12 −6,8 so với −6,0 p.u. Sau khi bỏ độ lệch trung bình từng giếng, SD sai số của M2-Sa (trung bình theo giếng) là 5,2/5,1 p.u., lớn hơn SD nhãn trong giếng (trung bình 4,8); SD dự đoán trong giếng 1,1–4,1. Sai số do mức trung bình giữa giếng chi phối, nên so sánh G-D không có lực phân biệt. + - **Đọc thêm từ output khóa (chỉ mô tả):** `best_shift_DIAGNOSTIC_ONLY.csv` cho M2-Sa PCC 0,40–0,82 sau khi dời, nhưng shift tối ưu 56–64 ms, sát biên tìm kiếm ±64 ms, ở 3 giếng (lowo) và 4 giếng (slot). Với 16–37 mẫu, tìm trên 33 shift nên PCC cực đại bị thổi phồng; không đọc đây là bằng chứng về lệch thời gian. `registration.csv`: σ_post 1,9–9,3 ms (trung vị 4,3; 3,0 trên mẫu có nhãn), F-11 T2 1,9–2,6, F-12 4,3–9,3; trung vị 3,8/4,3/4,1 ms ở σ_a 3,5/7/14 ms, tức gần như không theo σ_a. Pha wavelet của 22 tập train nằm trong cung 43° (F3: 214°). Khác biệt giữa các tie ≤ 0,25 p.u. RMSE macro. + - **Đổi trục bài (P5):** bằng chứng cho RML là lý thuyết (Mệnh đề 1 khớp trong 1%) và benchmark synthetic P2r. F3 là kết quả âm có thông tin. Volve là hiệu ứng sàn: không có kỹ năng ở giếng blind, nên không phải bằng chứng ủng hộ hay chống RML. Đã viết `paper/sections/03_data.tex` (mục Volve), `06_experiments.tex` (mục 6.5, bảng `tab:volvegd`, `tab:volveall`, `tab:volvesens`), `07_discussion.tex`, `00_abstract.tex`, `01_introduction.tex` và `08_conclusion.tex`. Bài build sạch, 42 trang. Tên bài chưa đổi. Còn thiếu: citation dữ liệu Volve và hình Volve (tùy chọn). + - **Exploratory P4x (post hoc, không claim):** khai báo trước ở `docs/research/p4-exploratory.md` (02:40 UTC, trước mọi lần train P4x). Code ở `exploratory/`, output ở `outputs/p4x/`, không đụng `ml_porosity/`, `scripts/` hay `outputs/p4/`. V0 tái lập `outputs/p4/summary/metrics.csv` trong 1,8e-15 (60 dòng); trajectory train lại trùng bitwise. Đang chạy V1a (trend vận tốc PSDM + residual), V1b, V2a (CNN-GRU 8 kênh) và V2b (Conv1d tuyến tính, 83 tham số), tổng 921 job. Mọi biến thể được chọn sau khi thấy nhãn test của P4, nên chỉ báo cáo như quan sát mô tả, không đổi G-D hay kết luận của bài (mục 10). + - **Commit cùng ngày (ý 25):** code P4 (`ml_porosity/volve/`, `ml_porosity/data/deviated.py`, `volve_wells.py`, scripts 23–25, `run_p4.sh`, test), `configs/protocol_volve.*` (khóa), các chỉnh sửa paper và docs. +22. **Pivot 1 kích hoạt: bài lý thuyết + benchmark; dời hạn sang 14/11/2026 (29/10/2026; commit cùng ngày, ý 25):** + - **Căn cứ.** Sau G-C và G-D, phần bằng chứng đứng được là lý thuyết (Mệnh đề 1 khớp trong 1%; Mệnh đề 2 và H4) và benchmark synthetic P2r (H2a, H2b, nhánh σ_a). Hai field test không có lực phân biệt: trên F3 chênh giữa phương pháp 0,016 p.u. so với 0,13 p.u. giữa seed; trên Volve hằng số thắng mọi mạng. Phân tích đầy đủ, vấn đề tồn đọng (T1–T10, S1–S10) và kế hoạch ở `docs/research/pivot-theory-benchmark.md`. Khảo sát dataset field public ở `docs/research/field-dataset-survey.md`: chưa có dataset nào xác nhận đủ 7 tiêu chí (điểm nghẽn là checkshot ở giếng test); Teapot Dome và Groningen là ứng viên cần kiểm kê, không làm trong bài này. + - **Quyết định** (người dùng chốt ý 1 và 5; agent chốt ý 2–4 theo bằng chứng): (1) mức B, hạn mới **thứ 7, 14/11/2026**; ngưỡng và luật của mọi gate không đổi. (2) S2 misspec **bắt buộc**, phạm vi hẹp: ba trục (rock physics sai hệ số; wavelet sai pha và băng thông; σ_b / prior drift sai) × regime R10, Rm5 × c = 1 × N ∈ {4, 16}, realization 8–15, dev trên 902–905, tập phương pháp Oracle, B3c-R, B3d-Sa, M2-Sa; khóa trong `configs/protocol_bench.yaml` trước lần chạy đầu; nếu đến 10/11 chưa xong thì bài gọi là "controlled synthetic study". (3) T2 là **exploratory**, chạy trên realization 8–15 với bank P2r đã có, khai báo trước ở `docs/research/t2-mechanism.md`; trong bài là mechanism analysis kèm Mệnh đề 3 (*ghi chú 29/10: đánh số lúc lập kế hoạch; trong bài, giả thuyết tái đăng ký ngầm là Nhận xét 1, còn Mệnh đề 3 của bài là hai cấu trúc sai số của tie*), không confirmatory; không sinh realization 16–23 cho T2. (4) Venue chính *Computers & Geosciences*, dự phòng *Geophysical Prospecting*. (5) **Bỏ hẳn P4x.** + - **P4x.** Job `exploratory/run_p4x.sh` (cuda:0, 8 worker) ở 560/921 lúc 03:43 UTC khi chốt. Theo yêu cầu người dùng, job được dừng ở 670/921 (khoảng 04:05 UTC) rồi kill để trả cuda:0; còn dở V2a (195/220) và V2b (1/220), nhánh B3d-Sa và V3 chưa chạy. Một bản tổng hợp dở (`outputs/p4x/summary/`, 04:07 UTC) đã được tạo trước khi thấy quyết định này và đã bị xóa theo yêu cầu người dùng (bỏ hẳn P4x); không khởi động lại job, không chạy lại bước summarize. Kết quả không tổng hợp, không vào bài, không chạy V3. `exploratory/` và `outputs/p4x/` giữ làm hồ sơ, không xóa. Ý 21 giữ nguyên làm lịch sử. + - **Tên bài mới (làm việc):** *Label registration error in sparse-well seismic property learning: theory, a registration-aware benchmark, and the limits of field validation.* Đóng góp C1′–C4′ và dàn ý 8 mục ở tài liệu pivot mục 3.2–3.3. Claim cấm ở mục 10 giữ nguyên và thêm: không gọi là "benchmark" nếu thiếu S2; T2 và T3 không được trình bày như confirmatory. + - **Lịch mức B** ở mục 6.1. Mọi thí nghiệm mới chạy dưới `protocol_bench` khóa trước, ghi rõ là thiết kế sau khi đã thấy P2r. Không đụng `protocol_p2r`, `protocol_f3`, `protocol_volve` và kết quả của chúng; không chạy lại P3/P4. +23. **Điều kiện áp dụng C1–C4 và thử Teapot Dome (29/10/2026; exploratory; commit cùng ngày, ý 25):** + - Khai báo trước ở `docs/research/applicability-teapot.md` (băm 04:06 UTC, trước mọi phép tính; Deviation 1 = mở rộng lưới σ_ref của T3). Kết quả ở `docs/research/applicability-results.md`. + - **C1/C2 hồi cứu** (`scripts/26_applicability.py`): F3 và Volve đều trượt C1 (kỹ năng ở giếng blind trong inner fold dưới ngưỡng D2: band PCC 0,04–0,15 so với τ = 0,47), cả hai đạt C2 (σ_post trung vị 2,8 và 4,3 ms). Đúng dự đoán đã khai báo. Không đổi G-C, G-D. + - **T3 power** (`scripts/27_t3_power.py`): lợi thế M2-Sa ở D2 (band RMSE thấp hơn 8–20%) mất hẳn khi reference chấm điểm lệch khoảng 4 ms. Với sign test α = 0,05, power 0,8 cần 5–18 giếng test nếu σ_ref = 0; với σ_ref ≥ 1,5 ms thì không còn ô Rm5 nào đạt khi n ≤ 40. Luật k-of-n không phải phép kiểm, không dùng. + - **T0 Teapot: trượt.** Chỉ có 4 bảng TD, trong đó 2 suy từ synthetic, 1 nguồn mập mờ, 1 VSP nông (≤ 2335 ft). Như vậy có tối đa 2 giếng TD độc lập, trong khi cần ≥ 3 cho C3 cộng 11–18 cho C4. Dừng Teapot theo cây §4; **bài giữ Pivot 1** (lý thuyết + benchmark). T3 và C1–C4 vào bài dưới dạng phân tích exploratory về điều kiện cần cho một field test có lực phân biệt (pivot T3), không phải claim. + - **Pilot P-a Teapot (Deviation 2, theo yêu cầu người dùng "lấy 1 tập nhỏ triển khai thử rồi mới chốt"): trượt.** Thay checkshot bằng knot horizon–top (Carlile ↔ CRLL, KF2 ↔ F2WC) ở 37 giếng dev (inline ≤ 200), không mở porosity. Hình học và pick đều tốt, nhưng σ̂_knot = 6,75 ms (CI 90% 4,1–9,4) so với ngưỡng 1,5 ms; riêng phần vi sai cũng đã 2,5–2,8 ms. **Dừng Teapot hẳn; giữ Pivot 1.** Chi tiết ở `docs/research/applicability-results.md`; script `scripts/29_teapot_pilot.py`. + +24. **Viết mức A xong sớm (29/10/2026; commit cùng ngày, ý 25):** A1–A5 của tài liệu pivot (mục 4.1) làm trong ngày 29/10 thay vì 30–31/10. Bản nháp `paper/` theo khung Pivot 1 biên dịch sạch (55 trang sau lượt tự sửa A6, không còn tham chiếu hỏng). Không có lần chạy GPU nào; mọi số mới là post hoc trên output đã lưu, không đổi số nào đã đăng ký và không dùng để chọn gì. + - **Lý thuyết (mục 4 của bài; chứng minh ở Phụ lục A).** Thêm Mệnh đề 3 (hai cấu trúc sai số của tie: classical làm mờ predictor và nới phương sai học được; Berkson làm sắc và thu hẹp nó; tie là trung bình posterior có cấu trúc Berkson), Mệnh đề 4 (bank hiệu chỉnh có cực tiểu quần thể của huấn luyện trên nhãn thật; lợi ích quần thể so với nhãn điểm là **bậc bốn** theo sai số tie), Hệ quả 3 (hai mode ±Δ/2: hệ số truyền đổi dấu ở 1/(2Δ) < |f| < 3/(2Δ)), Nhận xét 1 (λ > 0 là tái đăng ký ngầm), công thức ρ* và đoạn "Finite samples" (heuristic: sai số nhãn bậc một, phương sai có điều kiện đổi ở bậc hai, nên với ít giếng hiệu ứng mẫu hữu hạn có thể lấn bias quần thể), Mệnh đề 5 (coverage qua tỉ số phân tán ξ; T4 cũ gọi là "Mệnh đề 4"), Mệnh đề 6 và Hệ quả 4 (chấm điểm với tham chiếu lệch: bias phụ thuộc phương pháp, không giảm khi thêm giếng; dấu của lợi thế đo được chỉ đúng khi σ_ref < σ/√2). Bản tiếng Việt ở `docs/theory.md` mục 6. + - **Sửa cách đọc cận 1/B(σ_post).** Đây là ρ* dưới cấu trúc (a) với sai số Gauss, tính bằng dự đoán của Oracle thay cho m (trong bài gọi là 1/B_a). Khi σ_post vượt mép 6 ms của lưới B, `np.interp` trả 1/B(6 ms) = 0,634, nên cận thật thấp hơn (R10tb c = 2: 0,481 tại σ_post). + - **Tự sửa cùng ngày (A6).** Bản trước của ý trên có hai nhận định. Thứ nhất, hai cấu trúc chỉ khác một hệ số e^{4π²σ²f²} < 1,17 (|f| ≤ 25 Hz), nên cấu trúc gần như không đổi ρ*. Thứ hai, lợi ích của bank vượt cận quần thể (7/8 ô ở σ_post, 6/8 ở sai số warp). Nhận định thứ nhất sai, nhận định thứ hai phụ thuộc cấu trúc. Lý do: méo bậc bốn có trọng số f⁴, nên nó nằm ở 67–72 Hz, dù 71–73% công suất kết hợp với nhãn nằm dưới 25 Hz. Ở đó tích phân (b) bằng 1,5–1,7 lần (a) tại σ = 1,5 ms, 2,1–2,6 lần tại 2 ms và 3,3–4,6 lần tại 2,5 ms. + - `scripts/31_p2r_posthoc.py` được viết lại. Script đọc thêm npz dự đoán Oracle, chạy khoảng 6 phút và tái lập số đã đăng ký với sai lệch tối đa 4e-16. Nó tính cận (b) bằng cách làm sắc dự đoán Oracle tại đúng độ rộng của từng ô. Hai biến thể hạn chế khuếch đại nhiễu: giữ hệ số ở giá trị 60 Hz, và dùng phổ chéo với nhãn thật. + - Kết quả ở N = 16, 8 ô rộng. Cận (a): vượt ở 7/8 ô tại σ_post và 6/8 tại sai số warp; với phổ chéo là 5/8 và 3/8. Cận (b): vượt ở 3/8 tại σ_post với cả ba ước lượng (R0, R0h, R10tb ở c = 1; lề của R0h và R10tb < 0,004, nằm trong CI 95%). Tại sai số warp: 0/8 với plug-in, 1/8 (R0 c = 1) với hai biến thể. + - Vì vậy **không claim lợi ích vượt cận**. Bài thêm cột 1/B_b (post hoc) vào Bảng tab:h2b. + - Oracle tốt hơn B3d-Sa 7–8% ở R0, R0h, Rm5 (c = 1, N = 16). Tỉ số này dưới cận (a) ở mọi ô, dưới cận (b) ở 3–4 ô tại σ_post và 1–2 ô tại sai số warp. Ở c = 0, mọi cận nằm trong 0,4% quanh 1, nhưng Oracle vẫn tốt hơn 1–3% (sai số warp SMC 0,2–0,7 ms). Hai bên khác cả số vòng lặp (500 và 250). + - M2-Sa đóng 27–46% khoảng cách B3d-Sa–Oracle ở c = 1 (39–65% ở c = 2), và **không ô rộng nào ở N = 16 đạt mức Oracle**. + - T2 đổi câu hỏi thành: còn lợi ích nào vượt hiệu chỉnh quần thể của cấu trúc Berkson không. Test (iv), kiểm hiệp phương sai của offset, quyết định cận nào áp dụng. + - **T4** (`scripts/30_t4_coverage.py` → `outputs/t4/`; post hoc, mô tả): mọi ensemble quá hẹp (ξ = 0,19 cho Oracle, tối đa 0,66 cho B5). Thứ tự coverage đi theo **số vòng lặp huấn luyện** ngang với chất lượng nhãn (B3c-R train 500 vòng có cùng ξ với B3d-Sa ở 250; trên dev P2, coverage90 của Oracle giảm 0,47 → 0,23 → 0,10 khi tăng 125 → 500 → 2000 vòng). Ở P2r số vòng lặp và nguồn nhãn trộn lẫn, nên phần (b), (c) của Mệnh đề 5 chưa được kiểm. Không claim calibration. + - **T3 trong bài** (mục 6.5, exploratory): điểm giao của tỉ số trung vị ở N = 16 là 3,6–4,3 ms, cùng thứ tự và cách σ/√2 của Hệ quả 4 (3,0; 4,1; 5,1 ms) không quá 1 ms. N* của sign test: 5–18 giếng với tham chiếu chính xác (5/6 ô); 11–30 giếng ở 1 ms (4 ô); ở 2 ms chỉ R0 còn trong 40 giếng; từ 3 ms không ô nào. Luật k-of-n không phải phép kiểm (đạt với xác suất 0,31 khi n = 4 và 0,11 khi n = 6 nếu không có khác biệt thật). + - **Cấu trúc bài.** Chi tiết F3 và Volve chuyển sang Phụ lục B (`paper/sections/B_field.tex`); thân bài giữ mục phạm vi ngắn (6.6) với bốn điều kiện C1–C4 và Teapot. Related work thêm đoạn label noise / errors-in-variables (Berkson 1950, Fuller 1987, Carroll và cộng sự 2006, Frénay và Verleysen 2014, Song và cộng sự 2023, Mnih và Hinton 2012 (đã đọc toàn văn), Balakrishnan 1962 (chỉ có metadata, trích cho phát biểu chung)) và một dòng Mnih và Hinton trong bảng định vị; câu định vị nói rõ các thành phần không mới. Abstract 292 từ (sau A6), từ khóa, highlights (`paper/highlights.txt`, 5 ý ≤ 85 ký tự), tên bài Pivot 1 kèm TODO đổi "benchmark" thành "controlled synthetic study" nếu S2 không kịp, intro bốn đóng góp C1–C4 mới, kết luận viết lại, các mục khai báo của C&G để TODO (tác giả phải tự viết khai báo dùng AI tạo sinh). Hình `p2r_h2b.pdf` vẽ lại, chỉ đổi nhãn trục thành "population bound". + - **Rủi ro độ dài (mới).** Theo bản tóm tắt tìm kiếm của trang Guide for Authors của C&G (trang chính thức trả 403, chưa kiểm trực tiếp), Research Article tối đa khoảng 5.500 từ (không tính abstract, từ khóa, highlights, tài liệu tham khảo, chú thích hình và bảng), abstract ≤ 300 từ. Thân bài hiện khoảng 14.750 từ (mục 1–8, đếm thô sau A6, không tính công thức, float và hộp TODO; 15.036 nếu tính hộp TODO). Phải kiểm giới hạn trên trang chính thức và làm lượt rút gọn (mục 6.1, ngày 30–31/10: chuyển chứng minh, chi tiết Thí nghiệm 1 và H1, phụ lục field sang Supplementary) hoặc cân nhắc lại venue. Nếu không rút được, *Geophysical Prospecting* (dự phòng) cần kiểm giới hạn riêng. *(Cùng ngày: người dùng bỏ lượt rút gọn, xem ý 25.)* + - **Còn mở.** Bib cho dữ liệu F3 và Volve chưa có; câu "field protocols were committed only after their runs" ở mục 6 chỉ đúng khi `configs/protocol_volve.*` được commit (đã commit cùng ngày, ý 25); T2 phải khai báo ở `docs/research/t2-mechanism.md` trước 1/11. Bản khai báo phải ghi rằng các tỉ số post hoc (Oracle/B3d-Sa, M2-Sa/B3d-Sa) và mọi cận (a), (b), b60, phổ chéo, tại σ_post và tại sai số warp, đã được xem ngày 29/10. + +25. **Bỏ lượt rút gọn độ dài; commit và push (29/10/2026).** + - **Quyết định của người dùng:** bỏ lượt rút gọn độ dài cho venue (trước đó dự kiến 30–31/10: kiểm giới hạn trên Guide for Authors của C&G, chuyển chứng minh, chi tiết Thí nghiệm 1, H1 và phụ lục field sang Supplementary). Rủi ro độ dài vẫn ghi ở R9 (thân bài khoảng 14.750 từ, đếm thô, so với khoảng 5.500 từ theo nguồn thứ cấp), chưa có biện pháp. Ngày 30–31/10 còn: trích dẫn dataset F3 và Volve; còn lại là dự phòng. + - **Commit và push lên `main`** (theo yêu cầu người dùng): toàn bộ thay đổi của ý 20–24 (code P4, `configs/protocol_volve.*`, scripts 23–31, `run_p4.sh`/`.ps1`, test, `docs/research/` mới, bản ghi P4x ở `exploratory/` và `docs/research/p4-exploratory.md`, `.gitignore`, bài và tài liệu). Tag `protocol-volve` đặt trên commit này: hash code tính lại từ cây commit khớp `configs/protocol_volve.lock.json` (`c0befaa4…`). Giao thức Volve vì vậy được commit sau lần chạy, đúng như câu ở mục 6 của bài. 190 test pass, 1 skip. `logs/*.out` vẫn không theo dõi, như trước; `data/Teapot/` bị gitignore. diff --git a/docs/research/applicability-results.md b/docs/research/applicability-results.md new file mode 100644 index 0000000..759d20e --- /dev/null +++ b/docs/research/applicability-results.md @@ -0,0 +1,65 @@ +# Kết quả C1, C2 (hồi cứu) và T3 (power) — 29/10/2026 + +Khai báo trước: `applicability-teapot.md` (SHA-256 trong `applicability-teapot.sha256`, Deviation 1 = mở rộng lưới σ_ref). Exploratory, không confirmatory. + +## C1, C2 (`scripts/26_applicability.py` → `outputs/applicability/verdict.json`) + +Ngưỡng từ 19 ô D2 đạt H2a: τ_band_pcc = 0.468, τ_R² = 0.053. + +| Dataset | R² in | band PCC in | skill so với hằng số | C1 | σ_post trung vị | C2 | +| --- | --- | --- | --- | --- | --- | --- | +| F3 lowo | 0.039 | 0.146 | 0.108 | trượt | 2.83 ms | đạt | +| Volve lowo | −0.990 | 0.133 | −0.089 | trượt | 4.33 ms | đạt | +| Volve slot | −0.986 | 0.042 | −0.105 | trượt | 4.33 ms | đạt | + +Đúng dự đoán đã khai báo: cả hai trượt C1 (kỹ năng mạng), không phải C2 (độ rộng posterior). + +## T3 (`scripts/27_t3_power.py` → `outputs/t3/`) + +Luật dùng được là sign test một phía α = 0.05; luật k-of-n (k = ⌈0.75n⌉) không phải phép kiểm (ở p = 0.5 vẫn qua 31% với n = 4) và power giảm theo n, nên bỏ. + +N* (power ≥ 0.8, sign test, n ≤ 40) theo sai số đăng ký của reference chấm điểm σ_ref: + +| Ô | 0 | 0.5 | 1 | 1.5 | 2 | ≥ 3 ms | +| --- | --- | --- | --- | --- | --- | --- | +| R0, N=4 | 5 | 8 | 11 | 13 | 23 | — | +| R0, N=16 | 5 | 8 | 13 | 18 | 37 | — | +| R10, N=4 | — | — | — | — | — | — | +| R10, N=16 | 5 | 5 | 11 | 23 | — | — | +| Rm5, N=4 | 18 | 30 | — | — | — | — | +| Rm5, N=16 | 11 | 16 | 30 | — | — | — | + +(— : không đạt 0.8 với n ≤ 40.) Tỉ số band RMSE trung vị M2-Sa / đối thủ: 0.80–0.92 ở σ_ref = 0, về ≈ 1 ở 4 ms, > 1 ở 8 ms. + +Hệ quả cho T0 Teapot (C4, giả định mức Rm5 như §4): cần khoảng 11–18 giếng test có reference TD độc lập với sai số ≲ 0.5 ms, cộng ≥ 3 giếng TD ngoài test cho C3. Với σ_ref ≥ 1.5 ms thì không còn ô Rm5 nào khả thi; với σ_ref ≥ 3 ms thì không ô nào khả thi. Sai số bulk shift datum/statics giữa checkshot và seismic cũng tính vào σ_ref. + +## T0 Teapot Dome (29/10/2026) — trượt, dừng Teapot + +Nguồn: `rmotc.tar` (TDR, doi:10.18738/T8/21WDU8), giải nén ở `data/Teapot/raw/rmotc/` (1,7 GB; 1.210 file LAS, 3D `filt_mig.sgy` 345 × 188 inline/crossline, bin 110 ft, 2 ms, datum 5500 ft, Vc = 9000 ft/s). Kiểm kê chỉ đọc header, độ phủ curve và tài liệu kèm theo; không so nhãn với seismic. + +- **Time-depth độc lập.** Nguồn TD duy nhất là `Seismic/CD files/TimeDepthTables.xls` ("Select time/depth tables" theo readme), 4 giếng: + - 25-1-X-14 và 67-1-X-10: "From synthetic log", tức suy ra từ tie synthetic. Không độc lập; cùng loại với marker của F3. + - 48-X-28: "From Synthetic Seismogram", 32 mức (TWT, TVD). Nguồn không rõ là checkshot hay tie synthetic; tính rộng rãi là độc lập. + - 35-1-X-10: VSP thật ("FROM Paper VSP log"), nhưng chỉ tới 2335 ft MD (≈ 492 ms TWT), nông hơn 1st Wall Creek và mọi tầng chứa chính. +- **LAS.** Không file nào có curve thời gian hay checkshot (các dòng khớp `CS` là casing size / cable speed). Tần suất curve: RHOB 515, DPHI 301, NPHI 134, DT 82 file. +- **So với ngưỡng §4.** C3 cần ≥ 3 giếng TD độc lập ngoài tập test; C4 (mức Rm5, `outputs/t3/nstar.csv`) cần 11–18 giếng test có reference TD sai ≲ 0,5 ms. Teapot có tối đa 2 giếng TD độc lập tính rộng rãi, và chỉ 1 nếu tính chặt (VSP nông). Tổng 2 < 3 + 11, nên trượt cả C3 lẫn C4 trước khi phải mở bất kỳ log nào. Ngoài ra, các bảng TD dùng datum KB/ASL còn seismic dùng datum phẳng 5500 ft, nên bản thân việc quy đổi datum đã đưa thêm sai số vào σ_ref. +- **Quyết định (theo cây §4, đã khai báo trước).** Dừng Teapot ở T0. Bài giữ khung lý thuyết + benchmark (Pivot 1). Discussion nêu dữ kiện kiểm kê này như một ví dụ cho thấy dataset field public hiếm khi thỏa C3–C4. Không thử dataset field khác (§0: không "chọn dataset cho đến khi đạt"). + +Kiểm kê LAS chi tiết: `scripts/28_teapot_inventory.py` → `outputs/teapot/inventory/`. + +## Pilot P-a Teapot (29/10/2026, Deviation 2) — trượt, dừng Teapot hẳn + +Khai báo: Deviation 2 trong `applicability-teapot.md` (băm v2 07:11:29 UTC, trước mọi phép tính σ_knot; bản sao `outputs/applicability/declaration_v2.md`). Script `scripts/29_teapot_pilot.py` → `outputs/teapot/pilot_pa/`. Chỉ dùng 37 giếng dev (inline chiếu ≤ 200); không đọc giá trị porosity; không tính gì trên 115 giếng test. + +- **Hình học đạt.** Phép chiếu affine XY → inline/xline khớp header SEG-Y (sai số tối đa 0,013 bin). Cả hai horizon có pick bilinear ở 37/37 giếng dev (độ phủ 100%). Pick nằm đúng cực trị cùng cực tính của trace: Carlile 37/37 và KF2 36/37 lệch không quá 2 ms. +- **σ̂_knot (M1, quyết định) = 6,75 ms** (CI 90% bootstrap theo giếng: 4,1–9,4; ước lượng robust 1,4826·MAD = 5,0; Carlile 6,0, KF2 7,4). Ngưỡng σ_tol = 1,5 ms. **Trượt.** +- **Cấu trúc sai số (chẩn đoán, không quyết định).** Phần dư của hai horizon tại cùng giếng tương quan 0,85. Thành phần chung (bulk shift theo giếng) có SD 6,6 ms và không tương quan với giếng lân cận (hệ số −0,23 ở khoảng cách khoảng 9 bin ≈ 1.000 ft). Như vậy đây không phải biến thiên vận tốc ngang mượt mà M1 có thể đã quy nhầm thành sai số; nó giống sai số riêng từng giếng (KB/datum, residual statics, pick top). Thành phần vi sai (dạng stretch): 2,8 ms; M2 (sonic, 5 giếng): 2,5 ms. +- **Kết luận độc lập với cách ước lượng.** Mọi ước lượng (M1 6,75; robust 5,0; hệ số hai knot 5,3; chỉ phần vi sai 2,5–2,8) đều vượt 1,5 ms, và vượt cả 2 ms (ngưỡng nếu giả định mức R0 lạc quan hơn). Theo T3, với σ_ref ≥ 3 ms không ô D2 nào có power 0,8 ở n ≤ 115 trừ R0 với N_train = 4. +- **Quyết định (cơ học theo Deviation 2).** Dừng Teapot hẳn, không có P-b. Bài giữ Pivot 1. Dữ kiện dùng được cho phần "limits of field validation" (exploratory): ngay cả ở dataset field public có nhiều kiểm soát nhất mà nhóm biết (hàng trăm giếng có top cùng horizon 3D đã minh giải), sai số TD độc lập khoảng 5–7 ms (bulk) và 2,5–2,8 ms (vi sai), tức gấp 2–5 lần dung sai mà một field test có lực phân biệt cần (≈ 1–1,5 ms). + +## Dùng trong bài (29/10/2026) + +- **T3** → bài mục 6.5 (*Detectability of a gain at blind wells*, exploratory), bảng `tab:t3`. Hệ quả 4 (bài mục 4.5: dấu của lợi ích đo được đúng với dấu thật chỉ khi σ_r < σ/√2) dự báo điểm cắt σ/√2 = 3,0/4,1/5,1 ms; tỉ số band RMSE trung vị cắt 1 ở 3,6–4,3 ms (ba ô N = 16). Bài ghi rõ phép phân tích được khai báo trước khi chạy nhưng sau khi cả hai field gate trượt, và nêu Deviation 1. +- **C1–C4 và phép kiểm hồi cứu F3, Volve** → bài mục 6.6, đoạn *Neither test could have detected the effect*: ghi là post hoc, với ngưỡng C1, C2 lấy cơ học từ Thí nghiệm 2 (P2r). +- **Teapot T0 và pilot P-a** → bài mục 6.6, đoạn *Limits of field validation*: ghi là post hoc, exploratory; dùng 152 giếng, 4 bảng TD, tối đa 2 giếng có reference độc lập, σ̂_knot 6,75 ms (CI 90% 4,1–9,4) so với 1,5 ms. +- Nguồn số liệu từng câu: `paper/README.md`. Quyết định dừng Teapot: `docs/plan.md` §12 ý 23; `report.html` D-11. diff --git a/docs/research/applicability-teapot.md b/docs/research/applicability-teapot.md new file mode 100644 index 0000000..19b9278 --- /dev/null +++ b/docs/research/applicability-teapot.md @@ -0,0 +1,106 @@ +# Điều kiện áp dụng C1–C4 và nhánh thử Teapot Dome (P6) + +Ngày viết: **29/10/2026**. Trạng thái: **khai báo trước** (pre-declaration). Tài liệu này được viết và băm SHA-256 (`applicability-teapot.sha256`) **trước** khi tính bất kỳ điều kiện nào trên F3 hay Volve, và trước khi có bất kỳ file dữ liệu Teapot Dome nào trên máy. Không sửa sau khi băm; thay đổi phải ghi thành mục "Deviation" có ngày ở cuối tài liệu. + +Liên quan: `docs/plan.md` §12 ý 22 (Pivot 1), `docs/research/pivot-theory-benchmark.md` (T3), `docs/research/field-dataset-survey.md` (Teapot Dome, tiêu chí Q1–Q7). + +--- + +## 0. Mục đích và giới hạn trung thực + +Người dùng đề xuất (29/10): F3 và Volve trượt vì dữ liệu; nếu một field dataset thỏa các điều kiện dữ liệu cho kết quả dương, bài có thể trở lại khung **bài phương pháp có miền áp dụng rõ**. Nếu Teapot Dome không thỏa, bài giữ khung **lý thuyết + benchmark** (Pivot 1, không đổi). + +Giới hạn phải ghi nhận: + +1. Người viết tài liệu này **đã thấy** kết quả test của F3 và Volve. Để hạn chế việc chọn ngưỡng theo kết quả, mọi ngưỡng của C1 và C2 được **dẫn xuất cơ học từ D2** (benchmark synthetic P2r), không chọn tự do. +2. C3 và C4 trượt ở F3 và Volve **theo cấu trúc** (không có TD độc lập đủ giếng; N = 4 và 6). Vì vậy phép kiểm hồi cứu trên F3 và Volve chỉ có nội dung phân biệt qua **C1 và C2**. +3. Toàn bộ nhánh này **thiết kế sau khi thấy G-C và G-D**. Bài phải ghi là deviation so với kế hoạch gốc, cùng loại với P2r. +4. **Không mua sắm dataset:** Teapot Dome là dataset field duy nhất được thử trong nhánh này. Nếu Teapot trượt ở bất kỳ bước nào, bài này không thử thêm dataset field nào khác. + +--- + +## 1. Định nghĩa C1–C4 + +Mọi điều kiện tính **không dùng nhãn của giếng test**: chỉ dùng giếng train, inner fold, posterior tie và TD độc lập ngoài tập test. + +### C1. Mạng có kỹ năng ở giếng blind, trong miền đã kiểm chứng của D2 + +- **Đại lượng.** Với mỗi outer fold u, lấy point competitor m*(u) được chọn theo inner-validation MSE (như protocol của dataset đó). Với mỗi inner validation well v ∈ T_out(u), lấy dự đoán tại v của mô hình train trên T_out(u) ∖ {v}, tại budget mà protocol đã chọn cho (u, m*, seed); trung bình 5 seed (mean của μ). So với nhãn reference chính của v (giếng train, nên không phải nhãn test). + - `r2_in`: R² (point_metrics, toàn dải). + - `band_pcc_in`: PCC băng. F3: `band_metrics` với f_c của protocol (6 Hz). Volve: `desc_band` (run ≥ 16 mẫu, như protocol_volve, chỉ mô tả). + - `ss_const`: 1 − RMSE_net / RMSE_const, với RMSE_const của hằng số bằng trung bình nhãn các giếng T_out(u) ∖ {v}. + - Gộp: trung bình không trọng số trên mọi cặp (u, v). +- **Ngưỡng (dẫn xuất từ D2, `outputs/p2r/`).** Tập ô xác nhận = các ô H2a có `cell_pass = True` trong `outputs/p2r/summary/h2a.csv` với c = 1, regime ∈ {R10, R0, Rm5}, N ∈ {4, 16}. Trong mỗi ô, lấy best competitor của ô đó (cột `best`), tính trung bình `band_pcc` và `r2` trên mọi (realization, seed, giếng test) từ `outputs/p2r/train//results.csv`. + - τ_pcc = **min** trên tập ô xác nhận của band_pcc trung bình. + - τ_r2 = **min** trên tập ô xác nhận của r2 trung bình. +- **C1 đạt** nếu `band_pcc_in ≥ τ_pcc` **và** `r2_in ≥ τ_r2` **và** `ss_const > 0`. +- Lý do: ngoài khoảng kỹ năng mà D2 đã xác nhận hiệu ứng, benchmark không nói gì; một field test ở đó là ngoại suy. Ghi chú: inner model train trên ít giếng hơn và chấm bằng reference có sai số, nên `*_in` thiên thấp; đây là hướng bảo thủ, chấp nhận. + +### C2. Posterior tie đủ rộng (chỉ cho claim RML so với nhãn trung bình posterior) + +- **Đại lượng.** σ_post của posterior SMC trên giếng train (định nghĩa `protocol_p2r` notes.sigma_post; không dùng nhãn), trung vị trên giếng train của mọi tập train, tại σ_a chính của dataset. +- **C2 đạt** nếu σ_post ≥ **1.5 ms** (ngưỡng "wide" của `protocol_p2r` H2b). +- C2 chỉ điều kiện hóa claim kiểu H2b (M2-Sa so với B3d-Sa). Claim chính (M2-Sa so với point tie tốt nhất, kiểu H2a/G-C) không cần C2, vì H2a đạt cả ở ô hẹp (c = 0) trên D2. + +### C3. σ_a xác định được + +- **Đại lượng.** Có TD độc lập (checkshot hoặc VSP, không dùng để dựng tie train) ở **≥ 3 giếng không thuộc tập test**. σ̂_a = SD của (thời gian marker theo tie dùng để train − thời gian theo TD độc lập tại cùng độ sâu marker), gộp theo giếng; khoảng tin cậy 90% bằng bootstrap theo giếng. +- **C3 đạt** nếu đủ ≥ 3 giếng **và** CI 90% nằm trong [σ̂_a / 2, 2 σ̂_a]. +- Lý do: nhánh σ_a của P2r cho thấy lợi ích H2a mất khi σ_a sai ×0.5 hoặc ×2. + +### C4. Đủ power + +- **Đại lượng.** N* = số giếng test nhỏ nhất sao cho xác suất luật G-E đạt ≥ **0.80**, tính bằng T3 (mô phỏng trên dự đoán đã lưu của P2r, mục 3), với: (a) regime D2 có band PCC của competitor gần nhất với `band_pcc_in` của field (nếu thấp hơn mọi regime thì dùng regime thấp nhất); (b) sai số reference σ_ref = 0 nếu mọi giếng test có TD độc lập, ngược lại σ_ref = σ̂_a của C3. +- **C4 đạt** nếu số giếng test khả dụng (có nhãn porosity trong cửa sổ seismic và đạt QC) ≥ N*. + +--- + +## 2. Phép kiểm hồi cứu trên F3 và Volve (bước R) + +- Tính C1, C2 trên F3 (`outputs/p3/`) và Volve (`outputs/p4/`, scheme lowo và slot) bằng `scripts/26_applicability.py`. C3, C4 ghi theo dữ kiện đã biết (F3: 0 giếng TD độc lập, N = 4; Volve: 2 giếng có checkshot, N = 6) và theo N* của T3. +- **Dự đoán đăng ký trước:** cả F3 và Volve trượt **C1**. +- Đọc kết quả: + - Cả hai trượt C1: nhất quán với "trượt vì dữ liệu" (không chứng minh được, vì là hồi cứu). + - Một dataset **đạt C1** (và C2 nếu áp dụng): lập luận "trượt vì dữ liệu" **yếu đi** cho dataset đó; bài không được dùng C1–C4 để giải thích kết quả âm của nó. Nhánh Teapot vẫn có thể chạy, nhưng claim sẽ hẹp hơn. + +--- + +## 3. T3 (power) — exploratory, mức B của Pivot 1 + +- Nguồn: `outputs/p2r/train//cells/*.npz` (y_true theo warp thật, μ theo phương pháp và seed, 8 giếng test mỗi realization). +- Reference chấm điểm mô phỏng: y_true lấy tại t + s(t), với s(t) là warp trơn ngẫu nhiên có SD σ_ref ∈ {0, 2, 4, 8} ms (thành phần hằng + tuyến tính). +- Với mỗi ô (regime, c = 1, N), mỗi giếng: chỉ báo "M2-Sa có band RMSE thấp hơn best competitor của ô" theo reference mô phỏng; trung bình seed như ensemble. +- Từ chỉ báo theo giếng và độ tương quan trong realization (ICC), tính P(luật đạt | n) cho n = 4…40 theo beta-binomial cho hai luật ứng viên: (a) k-of-n với k = ⌈0.75 n⌉ (G-C 3/4, G-D 5/6); (b) kiểm định dấu một phía α = 0.05 trên chỉ báo theo giếng. +- Đầu ra: đường cong N*(regime, σ_ref, luật), `outputs/t3/`. Đây là phân tích giải thích, không confirmatory. + +--- + +## 4. Cây quyết định cho Teapot Dome + +| Bước | Việc (không nhìn nhãn test so với dự đoán) | Đạt → | Trượt → | +| --- | --- | --- | --- | +| **T0. Kiểm kê** | Tải `rmotc.tar` (TDR, doi:10.18738/T8/21WDU8, CC0). Đếm: giếng trong footprint 3D có density/neutron trong cửa sổ seismic; có sonic; có checkshot/VSP; giếng nghiêng; formation tops/horizon; chất lượng log | C3 khả thi (≥ 3 giếng TD độc lập ngoài test) **và** số giếng test khả dụng ≥ N* (T3, giả định mức Rm5) | **Dừng Teapot.** Bài giữ khung lý thuyết + benchmark; Discussion nêu dữ kiện kiểm kê | +| **T1. Dev** | Chia giếng thành **dev** (thiết kế, C1, C2, C3) và **test** (khóa, không mở nhãn tới G-E) theo luật không gian chốt trước khi mở log. Tính C1, C2, C3 chỉ trên dev | C1 và C3 đạt | **Dừng Teapot.** Báo cáo "Teapot nằm ngoài miền áp dụng của benchmark" như một kết quả; khung lý thuyết + benchmark | +| **T2. Khóa** | Viết `configs/protocol_teapot.yaml` (+ `.sha256`, `.lock.json`): G-E (luật chọn theo power của T3), N, tập phương pháp (tối thiểu B3 point ties, B3d-Sa, M2-Sa), σ_a từ C3, reference chấm điểm, f_c | Đã khóa | — | +| **T3. Chạy** | Nested LOWO trên tập test, như P3/P4 | G-E đạt | G-E trượt (dù C1–C4 đạt) | +| **Bài** | | **Khung phương pháp + lý thuyết + miền áp dụng:** "khi C1–C4 đạt, RML cải thiện; F3 và Volve nằm ngoài miền áp dụng" (claim cỡ 1 dataset) | **Khung lý thuyết + benchmark, mạnh hơn:** kết quả âm đủ power, RML không chuyển sang field ngay cả trong miền áp dụng | + +Không đổi trong mọi nhánh: G-C, G-D và kết luận của chúng; H3 bị bác bỏ (không claim calibration); sự phụ thuộc vào σ_a là giới hạn của phương pháp. + +**Mốc thời gian (theo hạn 14/11 ở plan §6.1; ngày có thể dời, ngưỡng thì không):** T0 xong trước **2/11**; nếu G-E chưa có kết quả trước **10/11** thì coi như không làm được trong bài này và giữ khung lý thuyết + benchmark. + +--- + +## Deviation + +Bản băm gốc (v1) được giữ nguyên byte ở `outputs/applicability/declaration_v1.md` (SHA-256 khớp `applicability-teapot.sha256`). Mọi thay đổi sau v1 chỉ nằm trong mục này. + +1. **(29/10/2026, sau lần chạy T3 đầu tiên) Lưới σ_ref mở rộng** từ {0, 2, 4, 8} ms thành {0, 0.5, 1, 1.5, 2, 3, 4, 8} ms. Lý do: lần chạy đầu cho thấy xác suất M2-Sa thắng ở một giếng giảm từ 0.81–0.97 (σ_ref = 0) xuống 0.65–0.82 (2 ms) và về khoảng 0.5 (4 ms), nên ngưỡng dung sai nằm giữa 0 và 2 ms, nơi lưới v1 không có điểm. Kết quả lưới v1 giữ ở `outputs/t3_grid_v1/`. Không đổi luật, ngưỡng hay dữ liệu; chỉ thêm điểm lưới. T3 vẫn là exploratory. + +2. **(29/10/2026, sau kiểm kê T0, trước khi mở bất kỳ nhãn porosity nào) Nguồn TD độc lập mở rộng sang knot horizon–top; pilot trên tập dev nhỏ.** + - *Lý do.* T0 cho thấy chỉ có 4 bảng TD (1 VSP nông), nên C3/C4 theo nghĩa checkshot/VSP trượt. Kiểm kê cũng tìm thấy `3DHorizons.xyz` (9 horizon đã minh giải trên khối 3D) và formation tops ở khoảng 1.000 giếng. `FormationCodes.doc` ánh xạ KF2 ↔ F2WC; Carlile ↔ CRLL (trùng tên). Mỗi cặp (thời gian horizon tại giếng, độ sâu top) là một knot TD độc lập với waveform tie. Ngưỡng, luật G-E, luật N* và giả định mức Rm5 **không đổi**; chỉ định nghĩa nguồn TD thay đổi. + - *Tập giếng.* W = giếng có tọa độ header nằm trong footprint 3D (inline/xline chiếu bằng phép affine khớp từ `3DHorizons.xyz`), có top CRLL và F2WC, và có density phủ trọn [CRLL, F2WC] (152 giếng). Cửa sổ nhãn là CRLL → F2WC. **Dev** = các giếng W có inline chiếu ≤ 200 (37 giếng, đầu nam của vòm). **Test** = phần còn lại (115 giếng). Luật này chốt từ số đếm, chưa xem giá trị log nào. Không tính gì trên giếng test (kể cả σ_knot) cho tới G-E. + - *Thiết kế field (nếu đi tiếp).* Knot **chỉ dùng để chấm điểm giếng test và để ước lượng σ_a**. Giếng train được đăng ký bằng waveform tie với prior σ_a như P3/P4; không dùng knot khi đăng ký. Nếu không làm vậy, σ_post ở giếng train co lại theo knot và câu hỏi RML biến mất. Trong bài, phần này gọi là *controlled field experiment* (giữ lại knot ở giếng train), không gọi là quy trình thực hành chuẩn. Reference TD ở giếng test là nội suy tuyến tính theo độ sâu giữa hai knot (vận tốc khoảng không đổi). + - *Pilot P-a (hôm nay, chỉ trên dev, không dùng porosity).* (i) Hình học: đọc được SEG-Y, phép chiếu XY → inline/xline khớp header, horizon khớp với SEG-Y (biên độ tại pick). (ii) Độ phủ horizon: có pick trong bán kính 1 bin tại giếng dev, hoặc nội suy được. (iii) **σ̂_knot (M1, chính)**: với từng horizon, thời gian quan sát được so với 2·z/V̂, trong đó z là độ sâu dưới datum seismic 5500 ft (= TVD − KB + 5500, TVD từ directional survey nếu có, ngược lại TVD = MD) và V̂ là trend bậc hai theo (inline, xline) của vận tốc trung bình, khớp bằng leave-one-out trên dev. σ̂_knot = SD gộp của phần dư. Đây là cận trên, vì nó gồm cả biến thiên vận tốc ngang thật. (iv) Kiểm tra phụ (không quyết định): M2 = phần dư của chênh thời gian giữa hai horizon so với 2∫DT dz ở giếng dev có sonic, chia √2; đối chiếu với bảng TD của 48-X-28 nếu giếng này có trong dev. CI 90% bằng bootstrap theo giếng. + - *Cổng P-a (cơ học).* σ_tol = σ_ref lớn nhất trên lưới T3 sao cho N*(Rm5, N_train = 16, sign test, power 0,8) ≤ số giếng test (115), tức σ_tol = 1,5 ms. Đạt nếu σ̂_knot ≤ σ_tol **và** có knot cho cả hai horizon ở ≥ 80% giếng dev. Lấy σ_ref = σ̂_knot, không nhân hệ số 0,78 của mô hình hai knot (chỉ báo như độ nhạy). **Trượt → dừng Teapot hẳn**; bài giữ Pivot 1. + - *Nếu đạt P-a → pilot P-b (chỉ dev):* dựng pipeline tie/train trên dev, tính C1 (kỹ năng blind trong dev), C2 (σ_post) và C3 (σ̂_a từ knot). Có kết quả P-b rồi mới quyết định chuyển sang T2 (khóa `configs/protocol_teapot.yaml`). diff --git a/docs/research/applicability-teapot.sha256 b/docs/research/applicability-teapot.sha256 new file mode 100644 index 0000000..2d090c1 --- /dev/null +++ b/docs/research/applicability-teapot.sha256 @@ -0,0 +1,2 @@ +ba65d9acbc9e16691a8919828345c67967980a9ccd39eac88da41cf1c07e5076 applicability-teapot.md # hashed 2026-10-29T04:06:34Z before any C1-C4 computation +21602f1397a08b6d05a02d284c2d309bfead72b3562511687cb51518bd9d7ec0 applicability-teapot.md # v2 (Deviation 2) hashed 2026-10-29T07:11:29Z before any sigma_knot computation diff --git a/docs/research/field-dataset-survey.md b/docs/research/field-dataset-survey.md new file mode 100644 index 0000000..e02f17c --- /dev/null +++ b/docs/research/field-dataset-survey.md @@ -0,0 +1,64 @@ +# Khảo sát dataset public cho field test (29/10/2026) + +Mục đích: tìm xem có dataset công khai nào đủ điều kiện cho một field test **có sức mạnh thống kê**, khác với F3 (4 giếng) và Volve (6 giếng). Nguồn: tra cứu web ngày 29/10/2026. Phần lớn số liệu bên dưới **chưa kiểm trên dữ liệu thật**: [W] = theo nguồn web, chưa kiểm; [KT] = đã kiểm trong repo. + +## 1. Tiêu chí (rút từ bài học F3 và Volve) + +| Mã | Tiêu chí | Vì sao | Bài học | +|---|---|---|---| +| Q1 | Giấy phép cho phép công bố, tải được | Bắt buộc | | +| Q2 | Seismic 3D post-stack (miền thời gian, hoặc miền sâu kèm mô hình vận tốc) phủ các giếng | Bài toán | | +| Q3 | **Đủ nhiều giếng test.** Mục tiêu sơ bộ ≥ 15–20 giếng đủ chuẩn, tốt hơn ≥ 30. Con số chính xác lấy từ T3 (`pivot-theory-benchmark.md`) | Power | F3: chênh giữa phương pháp 0.016 p.u., chênh giữa seed 0.13 p.u. | +| Q4 | Nhãn porosity **không suy ra từ sonic** (density/neutron/core) trong cửa sổ seismic | Tránh PHIE = f(DT) | F3: 3/4 giếng là hàm của DT [KT] | +| Q5 | **Time–depth độc lập** (checkshot/VSP) ở các giếng test | Tham chiếu chấm điểm không phải point tie; ước lượng σ_a (rủi ro chính của H2a) | F3: marker không phải checkshot; σ_a không nhận dạng được | +| Q6 | **Có khả năng có kỹ năng ở giếng blind**: giếng dày so với độ dài tương quan ngang; chênh mức porosity giữa giếng không trội | Không có kỹ năng thì không có power | Volve: hằng số thắng mọi mạng; PHIF chênh 8.5–17 p.u. giữa giếng [KT] | +| Q7 | Giếng đứng hoặc có trajectory | Trích nhãn đúng vị trí | Volve phải dựng trajectory từ Compass | + +## 2. Ứng viên + +| Dataset | Q1 giấy phép | Q2 seismic | Q3 giếng | Q4 nhãn | Q5 TD độc lập | Q6 kỹ năng | Đánh giá | +|---|---|---|---|---|---|---|---| +| **Teapot Dome (NPR-3), Wyoming** | Public domain (DOE/RMOTC), phải ghi nguồn; S3 open.source.geoscience [W] | 3D post-stack migrated, 2 ms, ~345 × 188 trace [W] | ~900 giếng có log; ~26 có cả sonic + density; Moon et al. (2016) dùng 64 giếng cho Second Wall Creek, giữ 39 làm validation [W] | Density/neutron, log cũ, cần QC [W] | **Chưa xác nhận**; một nghiên cứu tie nói không có checkshot/VSP [W] | Tốt: giếng rất dày, onshore, mục tiêu nông [W] | **Ứng viên mạnh nhất về Q3, Q6.** Yếu ở Q5 | +| **Groningen (mô hình tĩnh NAM)** | Mở trên YoDa/EPOS-NL, báo EPOS-NL, trích NAM (2020) [W] | PSDM (miền sâu), dưới muối Zechstein [W] | 371 giếng, > 6000 log, top của 12 zone Rotliegend [W] | Nhiều khả năng có density [W] | Checkshot có thể có trên NLOG, chưa kiểm [W] | Trung bình: nhiều giếng lệch theo cụm, ảnh dưới muối | **Mạnh về Q3.** Phải chỉnh bài toán sang miền sâu; định dạng Petrel/RESCUE | +| **NLOG offshore Hà Lan** (khảo sát DEF Z3FUG2012A; dự án Petrel EPOS-NL) | Tải miễn phí; điều khoản chính xác chưa kiểm [W] | DEF 6000–8000 km²; EPOS-NL có 280 cube 3D [W] | EPOS-NL: 6590 giếng, 4752 composite log [W] | Phải tự tính porosity từ RHOB | Một số giếng có TD số [KT ở F3] | Chưa biết | Trong footprint F3: 38 borehole nhưng chỉ thêm được 2 giếng dùng được, vì log bắt đầu dưới cửa sổ nông [KT]. Với DEF phải đổi sang mục tiêu sâu hơn. Cần kiểm kê | +| **Stratton (BEG), Texas** | Mở trên S3, ghi nguồn BEG [W] | 3D land, Frio fluvial, ~7.5 mi² [W] | Có log; số giếng chưa xác nhận [W] | Chưa rõ | **Có VSP** ở giếng hiệu chỉnh [W] | Tốt nếu giếng dày | Ứng viên phụ: có TD độc lập nhưng diện tích nhỏ, N chưa rõ | +| Boonsville (BEG), Texas | **Trả phí** (bản số 145 USD), điều khoản phân phối lại chưa rõ [W] | 3D, 5.5 mi² [W] | 38 giếng [W] | Chưa rõ | Chưa rõ | Tốt | Khó làm benchmark tái lập vì không tải tự do | +| Poseidon, Browse Basin | CC BY (3.0 AU hoặc 4.0, nguồn mâu thuẫn) [W] | 3D ~2900 km² (TGS MDIO trên AWS) [W] | ~8 giếng trong cube; log/VSP qua NOPIMS [W] | Có thể có | NOPIMS có VSP [W] | Kém: giếng thăm dò thưa, sâu | **Lặp lại vấn đề của Volve** (N nhỏ) | +| Taranaki, NZ (NZP&M) | Open-file [W] | Nhiều 3D (Pohokura...) [W] | Chưa xác nhận | Chưa rõ | Chưa rõ | Chưa rõ | Cần kiểm kê; chưa đủ thông tin | +| Volve đầy đủ | CC BY-NC-SA [KT] | ST10010 [KT] | 24 giếng, ~12 có D/S/N [W] (P4 dùng 6) | PHIF theo density [KT] | Chỉ 2 giếng có checkshot [KT] | **Kém** (đã chứng minh) [KT] | Không đề xuất: dữ liệu đã thấy, P4 cấm thiết kế lại, N vẫn nhỏ | +| Penobscot / Kerry | Mở | 3D | 2 / 1 giếng | | | | Loại (Q3) | +| Diskos (Na Uy) / NDR (Anh) | Thành viên đại học miễn phí (Diskos); giấy phép OGA (NDR); **không phân phối lại** [W] | Rất nhiều | Rất nhiều | | | | Không phải "public dataset": người khác không tái lập được | +| Namorado (ANP, Brazil) | Cấp cho đại học [W] | 3D chưa xác nhận | 56 giếng LAS [W] | | | | Truy cập không chắc với đơn vị ngoài Brazil | + +Không tìm thấy benchmark chuẩn nào cho seismic → porosity có nhiều giếng blind dùng chung [W]. + +## 3. Kết luận + +1. **Chưa có dataset nào được xác nhận đạt cả 7 tiêu chí.** Điểm nghẽn là Q5: dataset nhiều giếng (Teapot Dome, Groningen) chưa xác nhận có checkshot ở đủ giếng test; dataset có VSP (Stratton, Poseidon, Volve) thì ít giếng hoặc N chưa rõ. +2. **Teapot Dome** là ứng viên tốt nhất cho Q3 và Q6. Đây cũng là chỗ duy nhất có tiền lệ dùng hàng chục giếng validation. Nếu không có checkshot, vẫn có thể chấm bằng point tie, nhưng khi đó T3 phải tính cả sai số của tham chiếu. +3. **Groningen** là ứng viên thứ hai: N lớn, nhưng miền sâu và dưới muối làm bài toán khác hẳn D2/F3. +4. **Không cái nào làm kịp 31/10.** Mỗi dataset cần kiểm kê (1–2 ngày), dựng nhãn và time–depth, một protocol mới khóa trước khi chạy (P6, không đụng P3/P4), rồi mới chạy. + +## 4. Đề xuất + +- **Trong bài hiện tại:** không thêm field test mới. Mục "Detectability" (T3) nêu cụ thể dataset public nào có thể đạt ngưỡng N (Teapot Dome, Groningen) như một khuyến nghị có căn cứ. +- **Bước tiếp theo, nếu muốn có field test thật:** + 1. Chạy T3 trước để có con số N cần thiết, thay cho mức sơ bộ 15–20 ở Q3. + 2. Kiểm kê Teapot Dome (1 ngày): đếm giếng có density/neutron trong cửa sổ seismic, giếng có sonic để tie, checkshot/VSP, khoảng cách giếng, và tìm xem có checkshot trong kho RMOTC không. + 3. Kiểm kê Groningen song song nếu Teapot Dome trượt Q5. + 4. Nếu đạt: pre-register **dự đoán của T3** (power, tỉ lệ cải thiện kỳ vọng) trên dataset mới trước khi chạy. Khi đó field test kiểm chứng lý thuyết power chứ không chỉ kiểm phương pháp, khớp với hướng theory + benchmark. +- **Lựa chọn rẻ hơn cho trục "simulator khác":** dataset tổng hợp độc lập với D2 (SEAM Phase I có log tổng hợp [W]; Stanford VI-E). Có warp thật, nên trả lời giới hạn "cùng simulator" của benchmark (S2). Giấy phép chưa kiểm. + +## Nguồn + +- Teapot Dome: [ahay.org, Teapot dome dataset](https://www.ahay.org/RSF/book/tccs/welllogs/paper_html/node2.html); [SEG wiki, scavenger hunt](https://wiki.seg.org/wiki/User:Azizuddin/Scavenger_hunt); [Oil IT 2005](https://oilit.com/HTML_Articles/2005_4_22.php); [Moon et al. 2016 (KIOST)](https://sciwatch.kiost.ac.kr/handle/2020.kiost/2160) +- Stratton: [SEG wiki](https://wiki.seg.org/wiki/Stratton_3D_survey); [BEG store](https://store.beg.utexas.edu/cd-rom-sets/2120-sw0003.html) +- Boonsville: [BEG store SW0007](https://store.beg.utexas.edu/seminars-and-workshops/2216-sw0007.html) +- Poseidon: [AWS Registry](https://registry.opendata.aws/tgs-opendata-poseidon); [NOPIMS](https://www.ga.gov.au/nopims/access-and-help2) +- NLOG/EPOS-NL: [NLOG 3D download](https://www.nlog.nl/en/nieuws/new-free-3d-seismic-data-download-map); [DEF survey](https://www.nlog.nl/en/nieuws/additional-north-sea-data-def-survey); [EPOS-NL data](https://www.nlog.nl/en/epos-nl-data) +- Groningen: [YoDa](https://public.yoda.uu.nl/geo/UU01/1QH0MW.html); [GeoExpro](https://geoexpro.com/static-model-giant-groningen-field-publicly-available/) +- Volve: [Frontiers 2020](https://www.frontiersin.org/articles/10.3389/feart.2020.00285/pdf) +- Diskos: [Sodir membership](https://www.sodir.no/en/diskos/About-us/membership/); NDR: [NSTA](https://www.nstauthority.co.uk/data-and-insights/data/themes/seismic/) +- Taranaki: [NZP&M geodata](https://geodata.nzpam.govt.nz/survey/3095909085) +- Namorado: [SBGF 2009](https://sbgf.org.br/mysbgf/eventos/expanded_abstracts/11th_CISBGf/1454_evt_6year_2009.pdf) +- SEAM: [SEG SEAM open data](https://seg.org/seam/open-data/) diff --git a/docs/research/p4-exploratory.md b/docs/research/p4-exploratory.md new file mode 100644 index 0000000..b77c3da --- /dev/null +++ b/docs/research/p4-exploratory.md @@ -0,0 +1,95 @@ +# P4x — exploratory model variants on Volve (post hoc) + +> **Dropped on 2026-10-29** (decision 5 of the Pivot 1 record, `docs/plan.md` §12 item 22). P4x is not summarised, cited or extended; V3 is not run. The job `exploratory/run_p4x.sh` that was running on cuda:0 (560/921 at 03:43 UTC) was stopped at 670/921 (about 04:05 UTC) and killed to free the GPU; the B3d-Sa stage and V3 never ran. A partial summary in `outputs/p4x/summary/` (04:07 UTC), generated before this decision was seen, has been deleted. The remaining output is unused, and Section 6 stays empty. `exploratory/` and `outputs/p4x/` remain on disk as a record only. The text below is kept unchanged as the pre-run declaration. + +Created: 2026-10-29T02:40Z (09:40 +07:00), before any P4x training run, trend fit or P4x metric. +Status: **exploratory and post hoc**. Designed after the locked P4 result (`configs/protocol_volve.yaml`, gate G-D: +no blind-well skill, M2-Sa and B3b indistinguishable) was known, and motivated by a diagnosis of that result that +used outer-test labels (per-well bias of 3.4–5 p.u. with bias-removed RMSE close to the label SD). Nothing here +changes G-D, the P4 verdict or any locked protocol. No result here can support a claim listed in `docs/plan.md` +§10 or a confirmatory statement in the paper; at most it can be reported as an exploratory observation with this +status attached. + +## 1. Purpose + +1. Does a backbone with real blind-well skill on Volve exist within this data (same wells, inputs, labels, folds), + and if it does, does a gap between RML (M2-Sa) and the point tie (B3b) appear once there is skill? +2. If no variant has skill, what does the pattern of failures say about why (between-well level offset versus + within-well shape)? + +## 2. Fixed elements (identical to locked P4) + +- Six wells, label PHIF, main window 2400–2900 ms, 3×3 patch inputs along the deviated path, primary scoring + reference `calibrated`. +- σ_a = 7 ms only; registration banks reused read-only from `outputs/p4/registration/*_sa7.npz` (no new + registration). +- Nested folds of `ml_porosity.volve.folds` (schemes lowo and slot, 22 distinct inner training sets), seeds 0–4. +- Budget selection by inner-validation MSE only, inner models ensembled at the selected budget on the outer test + input (blind key T_out), then the five seeds (moment-matched Gaussian mixture): the unchanged + `ml_porosity.volve.evaluation.neural_predictions` code, called with an in-memory method list. +- Methods per variant: B3b and M2-Sa (required), B3d-Sa (run after the two required methods of every variant; + if not finished it is reported as not run). +- Locked code under `ml_porosity/` is imported read-only; P4x code lives in `exploratory/` (outside the P4 code + lock). Outputs go to `outputs/p4x/`. + +## 3. Variants (complete list; frozen at creation time) + +**V0 — reproduction.** +(a) Re-select and re-score the locked P4 trajectories (`outputs/p4/train`, σ_a = 7) through the P4x harness. The +combined-ensemble RMSE of B3b, B3d-Sa and M2-Sa per scheme and well must equal `outputs/p4/summary/metrics.csv` +within 1e-6. (b) Retrain seed 0 of B3b and M2-Sa for all 22 training sets through the P4x training path +(unmodified `train_trajectory`, cuda:0) and report the maximum absolute difference of the per-budget predictions +from the stored P4 trajectories. A non-zero difference from GPU non-determinism is reported, not hidden. + +**V1a — velocity-trend residual.** Trend v(t) = a + b·V(t), where V is the 2011 TTI PSDM instantaneous interval +velocity (`data/Volve/Seismic/ST10010/Velocities/ST10010ZC11-MIG-VEL...segy`; depth domain, 20 m samples, 50 m +lateral grid), sampled trilinearly at the (inline, crossline, TVDSS) of each time sample of the path. Path: the +reference path for training wells, the blind path of key K for every other target; MD→TVD from the public survey +by linear interpolation, TVDSS = TVD − KB. a, b by ordinary least squares on all labelled samples of the training +wells of the trajectory (B3b bank labels, paired with V on the reference path at the same time sample). The network +(unchanged CNN-GRU, 64 channels, same loss, optimiser, budgets, seeds) learns the residual: targets +(Y_member − v)/s0 with s0 the P4 normalisation SD of the set; prediction μ = v + s0·μ_net, σ = s0·σ_net. The trend +is a function of the input location only, so it is the same for every bank member and method. + +**V1b — TWT-trend residual.** As V1a with v(t) = a + b·t (two-way time in ms), OLS on the same training labels. + +**V2a — narrow CNN-GRU.** The P4 architecture with 8 instead of 64 channels; everything else as P4 (no trend). + +**V2b — linear-Gaussian model.** μ from one Conv1d over the 9 patch channels with kernel 9 (±16 ms) and a bias; +a single learned scalar σ (homoscedastic, softplus). 83 parameters, no dropout. Trained with the same masked bank +loss (M2-Sa: log-sum-exp over the 64 posterior members with λ = 1/τ_c; B3b and B3d-Sa: single-member masked +Gaussian NLL), Adam lr 0.005, gradient clip 5, same budgets, selection and seeds. This is the "ridge-like" +low-capacity model; a closed-form ridge is not used because it cannot be trained on the M2-Sa bank likelihood. + +**V3 (optional) — V1a trend + V2b residual model.** Run only if V0–V2 finish by 05:30Z; otherwise reported as +not run. + +**Reference predictors without training (context only).** Fitted on the outer training wells (B3b labels) and +applied to the outer test well along its blind path T_out: T0 constant (pooled mean, σ = pooled SD); T1a velocity +trend; T1b TWT trend (σ = residual SD of the fit). + +## 4. Metrics + +Per scheme (lowo, slot), per outer test well, per method, combined ensemble, primary reference: RMSE, bias +(mean of prediction − reference), |bias|, bias-removed RMSE (SD of the error), PCC, R² (relative to the test +well's own mean), coverage80 and coverage90, label SD of the test well (population SD on its labelled samples). +Macro = unweighted mean over the six wells. RML–point gap: M2-Sa − B3b in RMSE and bias-removed RMSE, per well +and macro, and the number of wells where M2-Sa < B3b. Porosity units (fraction × 100). + +Blind-well skill (declared criteria): a variant/method/scheme has skill if its macro R² > 0, or if its macro +bias-removed RMSE is at most 0.9 × the macro label SD (a constant prediction gives exactly 1.0 × label SD). +Both are reported with the number of wells that meet each criterion per well. + +## 5. Rules + +- Outer-test labels are read only by scoring, after every prediction is fixed. Trend coefficients use the + training wells of the trajectory (or the outer training wells for T0/T1); the velocity cube is seismic-derived + and available at every location. Budgets are chosen by inner validation only. +- Every variant listed above that is started is reported, including failures and partial runs. No variant is + chosen, dropped or re-tuned using outer-test metrics. A variant added after results are seen will be labelled + as such with its time. +- No p-values (six wells, correlated samples). + +## 6. Results + +(Appended after the runs.) diff --git a/docs/research/pivot-theory-benchmark.md b/docs/research/pivot-theory-benchmark.md new file mode 100644 index 0000000..0109173 --- /dev/null +++ b/docs/research/pivot-theory-benchmark.md @@ -0,0 +1,245 @@ +# Phân tích hiện trạng và hướng chuyển sang bài lý thuyết + synthetic benchmark + +Ngày viết: **29/10/2026**. Trạng thái: **đã chốt** ở mục 6 (29/10/2026); mức A viết xong sớm ngày 29/10 (`docs/plan.md` §12 ý 24). Mục 0–5 giữ nguyên phân tích lúc viết; chỗ nào đã đổi có ghi chú *Cập nhật* hoặc *Sửa* kèm ngày. Mọi số liệu dưới đây lấy từ `docs/plan.md` §12, `docs/theory.md`, `outputs/p2r/summary/`, `outputs/p3/summary/`, `outputs/p4/summary/`, `outputs/p4x/summary/` và bản nháp `paper/sections/`. Không có kết quả mới nào được tính trong tài liệu này. + +Bối cảnh: cả hai field test đều âm (G-C trên F3, G-D trên Volve). Plan §9 đã liệt kê sẵn **Pivot 1** ("chuyển thành bài phân tích: lý thuyết, benchmark và đánh giá có xét registration; phương pháp chỉ là phần phụ"). Tài liệu này rà lại toàn bộ đề tài để tìm các vấn đề tồn đọng, rồi đề xuất cách triển khai Pivot 1 thành một bài **lý thuyết + benchmark**. + +--- + +## 0. Tóm tắt + +1. **Phần đứng được** của đề tài là lý thuyết (Mệnh đề 1, 2; Bổ đề 1–5) và hai kết quả synthetic đã pre-register và đạt (H1; H2a, H2b của P2r). Phần **không đứng được** là mọi claim về field và về calibration. +2. Hai field test không bác bỏ phương pháp. Chúng **không có sức mạnh thống kê** để phát hiện hiệu ứng cỡ 10–20% khi mạng không có kỹ năng ở giếng blind (F3: band PCC ≤ 0.22; Volve: R² < 0 với mọi phương pháp, hằng số thắng mọi mạng). Đây là một kết quả có thể **chuyển thành lý thuyết** (mục 2.1, T3). +3. Lỗ hổng lý thuyết lớn nhất: **cơ chế của lợi ích H2b chưa được giải thích**. Ở 7/8 ô rộng, lợi ích vượt cận khử mờ 1/B(σ_post) của Mệnh đề 1. Giải thích được điều này là đóng góp lý thuyết mới quan trọng nhất của bài mới (T2). *(Cập nhật 29/10: 1/B(σ_post) là cận quần thể ρ* dưới cấu trúc sai số classical, còn tie trung bình posterior gần cấu trúc Berkson; tính cận tại sai số warp thì vẫn vượt ở 6/8 ô rộng. Bài mục 4.3 và 6.3; `docs/theory.md` mục 1.4 và 6.)* *(Sửa lần hai 29/10: nhận định "vượt cận" chỉ đúng với cận classical. Với cận Berkson, tính post hoc, chỉ 3/8 ô vượt tại σ_post (cả ba ở c = 1) và tối đa 1/8 tại sai số warp. Lý do là méo nằm quanh 70 Hz, nơi hai cấu trúc khác nhau nhiều. Câu hỏi của T2 vì vậy là: còn lợi ích nào vượt hiệu chỉnh quần thể của cấu trúc Berkson không. Xem `docs/plan.md` §12 ý 24.)* +4. Benchmark D2 đã có nhưng **chưa thành benchmark**: lưới phase diagram chưa đầy, các trục stress của plan §5.5 (rock physics sai, wavelet sai, σ_b) chưa chạy, chưa đóng gói, chưa có luật so sánh cho người ngoài. +5. Hạn 31/10/2026 **không đủ** cho pivot đầy đủ. Mục 4 chia hai mức: mức A (viết lại khung bài + các mệnh đề rẻ + phân tích power từ số liệu đã có) làm kịp 31/10; mức B (lấp lưới, trục stress, thí nghiệm cơ chế, đóng gói benchmark) cần 1–2 tuần nữa. Ngày là việc của người dùng quyết. *(Cập nhật: người dùng chọn mức B, hạn 14/11/2026; mục 6. Mức A xong ngày 29/10.)* + +--- + +## 1. Kiểm kê bằng chứng + +### 1.1 Bằng chứng dương (đã pre-register, đạt; giữ nguyên trong bài mới) + +| # | Kết quả | Số liệu | Nguồn | +| --- | --- | --- | --- | +| D1 | **Mệnh đề 1 (blur)**: predictor tối ưu MSE dưới misregistration = m tích chập với p_δ; hệ quả cận std ratio, PCC trong băng; L_Var chỉ chỉnh biên độ | Chứng minh dưới (A1) δ ⊥ (X, y) | `docs/theory.md` §1; `paper/sections/04_theory.tex` | +| D2 | **H1** kiểm chứng định lượng Mệnh đề 1 | r(σ) = 1.009 / 1.009 / 1.007 / 1.093 tại σ = 4 / 8 / 16 / 32 ms; chỉ trên dải 6.8–22.5 Hz | `outputs/p2/h1/` | +| D3 | **Mệnh đề 2 (nhận dạng)**: không anchor thì dịch chung của mạng và warp là ridge; sd(β) ≈ σ_a/√ΣK | Chứng minh dưới (B) | `docs/theory.md` §2 | +| D4 | **H4** (anchor là cần thiết) | Bỏ anchor: warp RMSE 3.15 → 31.1 ms (×9.9), band RMSE 0.735 → 1.398 p.u. | P2 | +| D5 | **Bổ đề 1–5**: point tie, hard-min, soft-min, soft-DTW, DILATE là trường hợp riêng của RML_λ; có unit test | Chính xác | `docs/theory.md` §4; `tests/test_losses.py` | +| D6 | **H2a** (P2r): nhãn tại warp trung bình của posterior SMC hơn point tie tốt nhất | c = 1: R10 0.857 / 0.782; R0 0.888 / 0.888; Rm5 0.915 / 0.923 (N = 4 / 16). Phần lớn lợi ích đã có ở c = 0 (macro 0.81 / 0.85 / 0.88) | `outputs/p2r/summary/verdict.json` | +| D7 | **H2b** (P2r): RML trên bank hơn nhãn trung bình khi posterior rộng, tăng theo σ_post | N = 16: 8/8 ô rộng đạt, ρ = −0.85, ô hẹp 0.996 | như trên | +| D8 | **Nhánh σ_a**: lợi ích H2a biến mất khi σ_a sai ×0.5 hoặc ×2 | 3.5 ms: 0.977 / 1.141; 14 ms: 0.985 / 0.928; 0/2 ô | như trên | +| D9 | **P2 (G-B trượt)** là một kết quả về registration: posterior anchor + trọng số IS trên 64 mẫu không co về warp thật (3.25 ms, ngang B3c 3.85 ms); SMC co về 0.56 ms | Đã pre-register, báo cáo như ra | P2, P2 diag | +| D10 | **Audit F3** (C4): PHIE = f(DT) chính xác ở 3/4 giếng; density dự đoán ở 2 giếng; marker không phải checkshot độc lập; TD lệch 14–66 ms | [KT] | plan §1.2 | +| D11 | **Bộ sinh D2** hiệu chỉnh theo F3 (horizon thật, rock physics F3, wavelet F3, prior warp fit trên anchor F3) với warp thật đã biết | 8 realization × 5 regime | `ml_porosity/data/synth_d2.py`, `configs/d2_synth_p2r.yaml` | +| D12 | **Posterior tie SMC** (tempering theo ACF, ước lượng pha, tiêu chí ổn định 0.5 ms) | P = 1024 | `ml_porosity/registration/smc_torch.py` | + +### 1.2 Bằng chứng âm (phải giữ trong bài, chuyển thành "phạm vi") + +| # | Kết quả | Số liệu | +| --- | --- | --- | +| A1 | **H3 bác bỏ**, mọi ensemble under-cover, **tệ hơn khi nhãn tốt hơn** | cov90 ở R10, c = 1, N = 16: B5 0.79; M2-Sa-ens 0.58; Oracle-ens 0.48 | +| A2 | **G-C trượt** (F3): cải thiện 1/4 giếng; coverage 0.524 / 0.609 | M2-Sa 1.272 so với B3c-R 1.256 p.u.; chênh giữa seed tới 0.13 p.u. (8× khoảng cách); band PCC ≤ 0.22 với mọi mạng; chỉ B4b (1.211) thấp hơn mốc "không có nội dung băng" (1.224); B0a trend thắng mọi mạng về RMSE tổng (2.48 p.u.) | +| A3 | **G-D trượt** (Volve): 2/6 và 3/6 giếng; cov90 0.47–0.48 | R² −0.84 đến −1.71 với mọi phương pháp; hằng số tại trung bình giếng train (6.03 / 6.59) thắng mọi mạng; trend theo TWT (P4x, T1b) còn thấp hơn (5.37 / 5.83); mức PHIF giữa giếng chênh 8.5–17 p.u. | +| A4 | σ_a **không xác định được** trên F3: type-II ≈ 0.4 ms (coi marker chính xác), spread marker–horizon 7 ms; LOAO cho z² trung bình 0.21 (prior quá rộng) | F3 nằm ở hai đầu trục σ_post tùy σ_a: 0.6 ms hoặc 2.5–3.4 ms | +| A5 | **Pha wavelet không xác định được** trên F3 (6 ước lượng trải 214°, log-evidence chỉ đổi 1–5 nats) nhưng xác định tốt trên Volve (43°) | registration không phải nút thắt của Volve | +| A6 | Ablation F3: 9/11 biến thể có band RMSE thấp hơn M2-Sa; kích thước bank (1/8/64/256) không có ảnh hưởng; bỏ anchor lại *giảm* band RMSE (1.247) | khớp với giả thuyết "điểm số băng trên F3 không nhạy với timing của nhãn", chưa kiểm | +| A7 | Thứ tự phương pháp **đảo** giữa synthetic và F3: B4a–d (anchor-free) kém B3b 38–53% ở P2 nhưng thấp hơn mọi point tie trên F3 | chưa giải thích | + +### 1.3 Đọc lại chuỗi suy luận: thất bại ở đâu + +Chuỗi claim gốc: *(i)* tie không chắc chắn → *(ii)* nhãn bị blur (MĐ1) → *(iii)* posterior tie tốt + marginalize sửa được (H2a, H2b) → *(iv)* trên field cũng vậy (G-C, G-D) → *(v)* bất định truyền sang dự đoán (H3). + +- (i), (ii): đứng vững, có cả chứng minh lẫn kiểm chứng định lượng. +- (iii): đứng trên synthetic, **có điều kiện** (σ_a đúng, posterior đủ rộng, N đủ lớn). Nhưng *cơ chế* của phần (iii)-H2b chưa rõ (mục 2.1 T2). +- (iv): **không có sức mạnh thống kê.** Trên F3 khoảng cách 0.016 p.u. so với dao động seed 0.13 p.u.; trên Volve mọi mạng thua hằng số. Field test không nói gì về (iii) theo cả hai chiều. Điều đáng nói: *điều này có thể tính trước* từ chính benchmark (mục 2.1 T3), và việc đó chưa làm. +- (v): bác bỏ, và hướng bác bỏ (nhãn tốt hơn → coverage tệ hơn) là một hiện tượng cần lý thuyết (T4), không chỉ là một thất bại. + +Kết luận: bài hiện tại yếu vì nó được *đóng khung* như bài phương pháp có field validation, trong khi bằng chứng thật nằm ở (i)–(iii). Pivot 1 là đóng khung lại cho đúng với bằng chứng, không phải thay đổi bằng chứng. + +--- + +## 2. Vấn đề tồn đọng + +### 2.1 Lỗ hổng lý thuyết (T1–T8) + +Xếp theo mức quan trọng cho bài mới. Cột "chi phí" là ước lượng [ĐX]. + +| ID | Vấn đề | Hiện trạng | Hướng giải | Chi phí | +| --- | --- | --- | --- | --- | +| **T2** | **Cơ chế lợi ích của RML trên bank (H2b).** Ở 7/8 ô rộng (N = 16; c = 1 và 2), tỉ số M2-Sa/B3d-Sa nằm *dưới* cận khử mờ 1/B(σ_post); ví dụ Rm5 c = 1: cận cho phép 0 lợi ích (1.000), đo được 0.982. Chỉ R10tb c = 2 nằm trong cận (0.667 so với 0.634). Hai giả thuyết chưa tách: (a) tăng cường nhãn (regularization), (b) warp trung bình lệch khi posterior đa mode. | Thảo luận trong paper nêu "mechanism is open"; thí nghiệm đối chứng "bank nhiễu ngẫu nhiên cùng độ rộng" **chưa chạy** | Giả thuyết thứ ba, chưa có trong paper, đáng kiểm nhất: **(c) tái đăng ký ngầm (implicit re-registration).** Với λ hữu hạn, Bổ đề 3 cho gradient = NLL có trọng số r = softmax(log π + λℓ). Mạng *dùng chung* giữa các giếng đóng vai trò prior về tính nhất quán liên giếng; responsibilities dồn về các hạt mà nhãn khớp với dự đoán nhất quán đó, tức posterior tie được *tinh chỉnh lại* bằng thông tin từ các giếng khác. Kiểm: (1) tính warp RMSE có trọng số r so với warp RMSE của τ̄ trên P2r; nếu r-weighted < τ̄ thì (c) đúng; (2) đối chứng (a): bank = τ̄ + nhiễu GP cùng σ_post, không mang thông tin; (3) đối chứng (b): tách ô posterior đa mode. Viết thành **Mệnh đề 3**: điều kiện để fixed point của RML_λ có responsibilities tập trung gần warp thật (kiểu EM với prior chia sẻ). *(Cập nhật 29/10: trong bài, (c) là Nhận xét 1, chưa thành mệnh đề; số "Mệnh đề 3" ở đây không phải Mệnh đề 3 của bài, vốn là hai cấu trúc sai số. Tính cận tại sai số warp RMS của B3d-Sa thì 6/8 ô vượt cận (thêm R10tb c = 1: cận 0.710, đo 0.890); R10tb c = 2 vượt mép lưới blur 6 ms nên cận bị kẹp ở 1/B(6 ms). Nguồn: `outputs/p2r/posthoc/`. Khai báo T2 phải ghi rằng các tỉ số này đã được xem post hoc. **Sửa lần hai 29/10:** với cận Berkson (post hoc; `bound_post_b` trong `outputs/p2r/posthoc/bound.csv`), chỉ 3/8 ô vượt tại σ_post và tối đa 1/8 tại sai số warp. Bài thêm test (iv), kiểm Berkson hay classical bằng hiệp phương sai của offset, và test (v), B3d-Sa ở số vòng lặp của Oracle. Câu hỏi của T2 đổi thành "còn lợi ích nào vượt hiệu chỉnh Berkson không". Khai báo phải ghi cả các cận (b), b60 và phổ chéo đã xem.)* | Thấp về GPU (bank P2r và budget đã có; mỗi run < 1 phút); trung bình về viết | +| **T3** | **Lý thuyết về khả năng phát hiện (power) của một field test.** Với n giếng test, chênh lệch thật Δ, độ lệch seed s, và tham chiếu chấm điểm *bản thân là một point tie* với sai số σ_ref, xác suất mà luật "≥ k/n giếng cải thiện" đạt là bao nhiêu? | Paper chỉ nói định tính ("needs more wells") | Hai phần: (1) **giải tích**: band RMSE đo với tham chiếu lệch δ_ref = RMSE thật ⊕ thành phần do δ_ref, chung cho mọi phương pháp → tỉ số bị kéo về 1 (đã quan sát: dải tham chiếu 0.06–0.15 p.u., khoảng cách 0.016 p.u.); (2) **mô phỏng trên D2**: lấy 4 giếng test, chấm bằng một point tie thay vì warp thật, lặp lại qua realization × seed, đếm tần suất luật G-C đạt khi lợi ích thật là 10–20% (đã biết từ H2a). Kết quả là một **đường cong "cần bao nhiêu giếng"**. Biến hai field test âm thành một kết luận định lượng, có thể tính trước. | Thấp (dùng dự đoán đã lưu `outputs/p2r/train/*/cells/*.npz`; chỉ cần code chấm điểm mới) | +| **T4** | **Vì sao nhãn tốt hơn → coverage tệ hơn** (A1). | Chỉ mô tả | Hệ quả trực tiếp của Bổ đề 2 (λ → 0: σ*² hấp thụ Var_π y): head heteroscedastic học *phương sai của nhãn*, không học sai số dự đoán ở giếng mới. Nhãn sạch hơn → σ nhỏ hơn, trong khi sai số epistemic theo không gian (giếng test cách ≥ 1 km) không đổi và seed-ensemble không bắt được. Viết thành **Mệnh đề 4** (hoặc hệ quả): coverage của ensemble seed với head heteroscedastic giảm đơn điệu theo chất lượng nhãn khi sai số không gian trội. Kiểm bằng số liệu H3 đã có (Oracle-ens 0.48 < M2 0.58 < B5 0.79) và tách σ_aleatoric / Var_seed trong các file npz. *(Cập nhật 29/10: thành Mệnh đề 5 của bài, phát biểu qua tỉ số ξ = E s²/E(y − μ)²; phần (a) là đồng nhất thức, (b) và (c) là giới hạn quần thể. T4 post hoc (`scripts/30_t4_coverage.py`): mọi ensemble quá hẹp (ξ 0.19 ở Oracle, tối đa 0.66), và độ dài huấn luyện lẫn với nguồn nhãn, nên "giảm đơn điệu theo chất lượng nhãn" chưa được kiểm.)* | Thấp | +| **T8** | **Posterior đa mode (cycle skip)**: ô có lợi ích lớn nhất (R10tb c = 2, 33%) lại bị gắn cờ "unstable". | Loại khỏi bằng chứng chính | Mệnh đề 1 với p_δ hai điểm ±Δ/2 cho P(f) = cos(πfΔ): nhãn trung bình của hai mode lệch nửa chu kỳ **triệt tiêu** băng seismic tại f = 1/(2Δ). Đây là lý do B3d-Sa sụp ở c = 2 và là trường hợp mà bank *được dự báo* hơn hẳn. Viết thành hệ quả rõ ràng, đưa "cycle-skip regime" vào benchmark như một trục có kiểm soát thay vì gắn cờ bỏ. *(Cập nhật 29/10: Hệ quả 3 của bài; phát biểu chính xác ở `docs/theory.md` mục 6.3: hệ số truyền âm trên 1/(2Δ) < |f| < 3/(2Δ).)* | Thấp (lý thuyết); trung bình (ổn định SMC đa mode hoặc chấp nhận báo cáo biến thiên giữa run) | +| **T1** | **(A1) bị vi phạm khi tie được ước lượng từ chính seismic X** (δ của τ̄ phụ thuộc X) và trên F3 (nhãn và trục thời gian chung DT). | Chỉ ghi là giới hạn | Mở rộng MĐ1: ŷ*(t) = ∫ p(δ \| X) m(t + δ) dδ, bộ lọc *phụ thuộc X* (không còn LTI). Với posterior hiệu chỉnh tốt, Var(δ \| X) ≈ σ_post(X)², cho đúng cận B(σ_post) đang dùng, nay có phát biểu chặt. **Sửa 29/10:** khi viết ra thì không đúng như vậy. Sai số của tie trung bình posterior gần cấu trúc *Berkson* (độc lập với D), không phải classical, nên nó làm *sắc* predictor (bộ lọc 1/Q), không làm mờ. Bài viết thành Mệnh đề 3 (hai cấu trúc) và Mệnh đề 4 (bank hiệu chỉnh: lợi ích quần thể so với nhãn điểm là bậc bốn theo σ); 1/B(σ_post) chỉ là ρ* dưới cấu trúc (a). Xem `docs/theory.md` mục 1.4 (ghi chú sửa) và mục 6. Trường hợp nhãn–trục chung DT: δ tương quan với ∂y/∂t; viết hệ quả về bias (không chỉ blur). | Thấp–trung bình | +| **T7** | **Đánh đổi dịch–pha** trong số hạng tie seismic (MĐ2 chỉ phác thảo). | Nhận xét định tính (43° ở ±30 Hz) | Thông tin Fisher về β từ likelihood tie: I(β) ∝ ∫ (2πf)² S_syn(f) df, trừ phần bị pha hấp thụ. Cho công thức sd(β) theo băng thông và SNR. Giải thích vì sao pha trên F3 không xác định (băng hẹp ở vùng kết hợp 7–23 Hz) mà trên Volve lại xác định. | Trung bình | +| **T5** | **Tương tác giữa N (số giếng) và σ_δ**: phase diagram "khi nào registration quan trọng" (C3 gốc) chỉ có một phần. | P2: c × N đủ nhưng posterior kém; P2r: chỉ c ∈ {0,1,2}, N ∈ {4,16} | Lấp lưới (mục 2.2 S1) rồi fit luật thang: band RMSE² ≈ e_oracle²(N) + e_blur²(σ). Kiểm tính cộng. | GPU 1 ngày | +| **T6** | λ = 1/τ_c là heuristic; F3 cho λ = 1 hơi tốt hơn; P2 diag ≤ 7% khác biệt. | Không claim | Giữ là heuristic; thêm một ablation λ trên benchmark và một đoạn nối với magnitude adjustment (Pauli 2011, Ribatet 2012; chưa đọc toàn văn). Ưu tiên thấp. | Thấp | +| T9 | H1 chỉ kiểm trên 6.8–22.5 Hz; σ = 32 ms lệch 9% chưa rõ nguyên nhân. | Ghi là giới hạn | Thử lại với predictor có công suất ở tần cao hơn (SNR ∞, N = 16, budget lớn) để mở rộng dải kiểm; hoặc chấp nhận và nói rõ. | Thấp | +| T10 | Định vị lý thuyết trong literature **label noise / errors-in-variables**: misregistration là nhiễu ở *chỉ số* (index) chứ không ở *giá trị* nhãn; MĐ1 là analog của attenuation bias. | Chưa có trong related work | Thêm một đoạn related work và một nhận xét; nâng tính tổng quát (áp dụng cho core–log depth shift, 4D time shift, nhãn đăng ký ảnh). | Thấp (viết) | + +### 2.2 Lỗ hổng của benchmark (S1–S8) + +| ID | Vấn đề | Hiện trạng | Việc cần làm | +| --- | --- | --- | --- | +| **S1** | Lưới phase diagram chưa đầy với posterior SMC | P2r: c ∈ {0, 1, 2}, N ∈ {4, 16}, 5 regime | Thêm c = 0.5 (và 1.5), N ∈ {2, 8}; cùng realization 8–15. Hình chính F4 của plan §8 chưa tồn tại ở dạng đầy đủ. | +| **S2** | Các trục stress của plan §5.5 **chưa chạy**: rock physics sai mô hình (φ–DT khác giữa train/test), wavelet sai pha/tần số, σ_b, drift sai mô hình (bước nhảy tại Truncation, jitter tần cao) | Bị cắt theo thứ tự cắt phạm vi | Cần sửa `synth_d2.py` (thêm tham số misspec), chạy ở R10 và Rm5, c = 1, N = 16. Đây là phần khiến benchmark "trung thực" thay vì "cùng simulator". | +| **S3** | B4a–d (anchor-free) chưa chạy lại trong regime SMC của P2r | Chỉ có ở P2 | Chạy lại để bảng kết quả benchmark đầy đủ một protocol. | +| **S4** | Chỉ một backbone trên synthetic | TCN chỉ có ở ablation F3 | Thêm TCN trên 2–3 ô đại diện. | +| **S5** | Thí nghiệm cơ chế (T2) | Chưa có | Xem T2. | +| **S6** | Nghiên cứu khả năng phát hiện (T3) | Chưa có | Xem T3. | +| **S7** | **Đóng gói**: generator + realization cố định (hash) + regime + luật đạt + metric + baseline + hướng dẫn | Code có, nhưng gắn với `scripts/14`, `15`, `18` và protocol nội bộ | Tách thành gói `ml_porosity.benchmark` (hoặc repo riêng), một lệnh sinh dữ liệu, một lệnh chấm, bảng kết quả tham chiếu, giấy phép (horizon F3 là CC BY-SA 3.0), DOI Zenodo. | +| **S8** | Ô c = 2 không ổn định giữa các run SMC | Gắn cờ, loại | Hoặc tăng P / nhiều run và báo cáo biến thiên như một phần của benchmark, hoặc định nghĩa "cycle-skip regime" có kiểm soát (đặt Δ mode tường minh). Gắn với T8. | +| S9 | Chỉ 2 realization dev (900/901) cho mọi quyết định thiết kế | Ghi là giới hạn | Thêm 2–4 realization dev nếu còn thiết kế mới (S2). | +| S10 | Khoảng cách giếng test ≥ 1 km cố định | Một giá trị | Thêm trục khoảng cách (500 m, 1, 2, 4 km) nếu muốn nói về sai số không gian (liên quan T4). | + +### 2.3 Vấn đề field (giữ lại như phạm vi, không giải trong bài mới) + +- F3: nhãn là sonic; F02-1 nhãn khác; marker không độc lập; σ_a và pha không xác định; mạng không có kỹ năng trong băng; tham chiếu chấm điểm là một point tie. +- Volve: 16–37 mẫu nhãn mỗi giếng; mức PHIF giữa giếng chênh lớn; không mạng nào có kỹ năng; P4x chỉ xong V0 (tái lập) và các trend tham chiếu, V1–V3 chưa chạy (`outputs/p4x/summary/checks.json`: danh sách method rỗng). +- Trong bài mới, hai field case phục vụ hai mục đích: (1) **hiệu chỉnh benchmark** (D2 lấy horizon, rock physics, wavelet, prior drift, σ_a từ F3); (2) **minh họa T3**: field test với 4–6 giếng không phát hiện được hiệu ứng cỡ benchmark. Không dùng để claim gì khác. + +### 2.4 Vấn đề về quy trình và độ tin cậy + +- P2r là pre-registration **sau khi P2 trượt** (deviation đã ghi). `protocol_f3` được tag git *sau* khi chạy (bằng chứng khóa là timestamp tự ghi). Bài mới phải giữ nguyên các ghi chú này. +- Pivot 1 có trong plan §9 **trước** mọi field test, nhưng quyết định pivot là **sau** khi thấy kết quả field. Bài phải nói rõ: khung "lý thuyết + benchmark" được chọn sau khi field test trượt; các kết quả synthetic được pre-register trước đó và không đổi. +- Nhiều kết quả hiện "descriptive only". Trong bài benchmark, cần tách rõ: kết quả **confirmatory** (H1, H2a, H2b, H4, σ_a arm), kết quả **benchmark reference** (bảng mọi phương pháp), và **exploratory** (T2, T3, S2 nếu thiết kế sau khi xem dữ liệu). +- `docs/plan.md` §10 (claim cấm) vẫn áp dụng, nhất là: không gọi kết quả synthetic là "generalization ra field"; không claim calibration. + +--- + +## 3. Hướng mới: bài lý thuyết + benchmark + +### 3.1 Luận điểm trung tâm + +> Sai số đăng ký của nhãn (well tie) là một dạng **nhiễu ở chỉ số thời gian**, khác nhiễu nhãn cổ điển. Nó có hiệu ứng *dự đoán được* lên predictor học được (blur theo hàm đặc trưng của sai số; không nhận dạng được dịch chung nếu không có anchor). Trên một benchmark có warp thật, các cách dùng posterior tie (nhãn trung bình, bank) sửa được một phần, với điều kiện rõ ràng (σ_a đúng, posterior đủ rộng, N đủ lớn), và cơ chế của phần sửa thêm là [kết quả T2]. Cuối cùng, benchmark cho biết **một field test cần bao nhiêu giếng** để phát hiện hiệu ứng đó, và hai field test công khai hiện có nằm dưới ngưỡng ấy. + +Tên làm việc (theo plan §9, Pivot 1): *Label registration error in sparse-well seismic property learning: theory, a registration-aware benchmark, and the limits of field validation.* + +### 3.2 Đóng góp đề xuất + +> *Ghi chú 29/10/2026:* "Mệnh đề 3" và "Mệnh đề 4" ở mục 3, 4 và 6 là đánh số lúc lập kế hoạch. Trong bài: Mệnh đề 3 là hai cấu trúc sai số của tie, Mệnh đề 4 là bank hiệu chỉnh, coverage là Mệnh đề 5, reference lệch là Mệnh đề 6; cơ chế bank (T2) chưa thành mệnh đề, giả thuyết tái đăng ký ngầm là Nhận xét 1. + +| | Đóng góp | Thành phần đã có | Thành phần mới | +| --- | --- | --- | --- | +| **C1′** | Lý thuyết nhiễu đăng ký | MĐ1 + hệ quả; MĐ2; Bổ đề 1–5; H1 | T1 (δ phụ thuộc X), T2 (cơ chế bank, Mệnh đề 3), T4 (coverage, Mệnh đề 4), T8 (đa mode), T7 (dịch–pha) tùy thời gian | +| **C2′** | Benchmark có warp thật, hiệu chỉnh theo F3, với luật đạt pre-registered | D2, 5 regime, SMC posterior, kết quả P2 và P2r | S1 lấp lưới, S2 trục misspec, S3, S4, S8, S7 đóng gói | +| **C3′** | Khung loss thống nhất (RML_λ) làm **họ baseline** của benchmark, không phải "phương pháp đề xuất thắng" | Bổ đề 1–5, code | Trình bày lại: bảng phương pháp = các điểm trong không gian (bank, π, λ) | +| **C4′** | Lý thuyết và mô phỏng về **khả năng phát hiện** của field test; audit F3 | Số liệu F3, Volve, P4x; audit C4 | T3 (giải tích + mô phỏng trên D2); viết lại hai field case thành một mục "scope" ngắn, bảng chi tiết vào phụ lục | + +### 3.3 Cấu trúc bài (đề xuất) + +1. Introduction: nhiễu đăng ký của nhãn; vì sao khác label noise; C1′–C4′. +2. Related work: thêm nhóm label noise / errors-in-variables / misaligned supervision; thêm benchmark papers trong geoscience ML (so sánh cách đánh giá). +3. Theory: MĐ1, hệ quả, MĐ2, **Mệnh đề 3 (cơ chế bank)**, **Mệnh đề 4 (coverage)**, hệ quả đa mode; H1. +4. Benchmark: thiết kế D2 (nguồn hiệu chỉnh từ F3 → audit F3 chuyển vào đây hoặc phụ lục), các trục, luật đạt, metric, họ phương pháp (RML_λ), oracle. +5. Results on the benchmark: registration (P2 vs SMC), H2a, H2b, σ_a, S2 misspec, S1 phase diagram, cơ chế (T2), coverage (T4). +6. Detectability and the two field cases: T3; F3 và Volve tóm tắt 1–2 trang, bảng vào phụ lục. +7. Discussion: khi nào cần quan tâm registration; khuyến nghị cho field study (đo σ_a, số giếng, tham chiếu chấm điểm); giới hạn (cùng simulator, một backbone, λ heuristic). +8. Conclusion; data/code/benchmark availability. + +### 3.4 Venue + +- Phù hợp nhất với "theory + benchmark": *Computers & Geosciences* (mạnh về benchmark/code), *Geophysical Prospecting*, *Journal of Applied Geophysics*. Plan §9 nêu *Frontiers in Earth Science*, *Earth Science Informatics* cho Pivot 1. +- Nếu nhấn mạnh lý thuyết tổng quát (T10) có thể cân nhắc venue ML, nhưng lịch không cho phép trong tuần này. Quartile phải tra lại khi nộp [XM]. + +### 3.5 Claim vẫn cấm (kế thừa plan §10) + +Không "first"; không gọi synthetic là generalization ra field; không claim calibration; không claim field superiority; không gọi marker là checkshot; không dùng số liệu luận văn làm baseline. + +--- + +## 4. Kế hoạch với hai mức + +### 4.1 Mức A: kịp 31/10/2026 (chỉ viết + tính toán trên số liệu đã có) — xong ngày 29/10/2026 + +| Việc | Đầu vào | Ghi chú | +| --- | --- | --- | +| A1. Viết lại abstract, intro, contributions, discussion, conclusion theo 3.1–3.3 | bản nháp hiện tại | Chuyển F3/Volve thành mục "scope"; bảng chi tiết sang phụ lục | +| A2. Viết T1, T4, T8 thành mệnh đề/hệ quả (chứng minh ngắn, đều là hệ quả của MĐ1 và Bổ đề 2) | `docs/theory.md` | Không cần GPU | +| A3. T4: tách σ_aleatoric và Var_seed từ `outputs/p2r/train/*/cells/*.npz` để minh họa Mệnh đề 4 | file đã có | Vài giờ | +| A4. T3 phần giải tích + phần mô phỏng dùng dự đoán đã lưu của P2r (chấm 4 giếng test bằng tham chiếu point tie thay vì warp thật, đếm tần suất đạt luật G-C) | `cells/*.npz`, nhãn point tie | 1 ngày; cần kiểm xem npz có lưu nhãn point tie của giếng test hay phải dựng lại từ realization | +| A5. T10: đoạn related work về label noise / errors-in-variables | — | Cần trích dẫn đúng; kiểm bằng OpenAlex | +| A6. Ghi quyết định pivot vào `docs/plan.md` §12 với ngày và lý do; cập nhật `AGENTS.md` | — | Ghi rõ là quyết định sau khi thấy field test | + +**Trạng thái (29/10/2026): A1–A6 xong** (`docs/plan.md` §12 ý 24). +- A1: abstract (292 từ sau lượt tự sửa A6), intro, đóng góp C1–C4, discussion, conclusion, tiêu đề, keywords, `paper/highlights.txt` viết lại theo khung Pivot 1. F3 và Volve thành mục "scope" (bài mục 6.6); chi tiết sang Phụ lục B. +- A2: T1 thành Mệnh đề 3–4 (kèm sửa cách đọc cận, xem hàng T1 ở mục 2.1), T4 thành Mệnh đề 5, T8 thành Hệ quả 3; thêm Nhận xét 1 (λ > 0), Mệnh đề 6 và Hệ quả 4 (reference lệch, dung sai σ_r < σ/√2). +- A3: `scripts/30_t4_coverage.py` → `outputs/t4/` (bài mục 6.3, Bảng `tab:t4`). +- A4: `scripts/27_t3_power.py` → `outputs/t3/` (bài mục 6.5). Khác với phác thảo ở bảng trên: reference là nhãn thật đọc tại một warp nhiễu loạn có độ lớn σ_ref (không phải nhãn point tie), và luật được đánh giá là sign test một phía; luật k-of-n chỉ dùng để chỉ ra nó không phải phép kiểm. Khai báo trước ở `docs/research/applicability-teapot.md` (Deviation 1: mở rộng lưới σ_ref). +- A5: đoạn "Label noise and errors in variables" ở bài mục 2 (Mnih & Hinton 2012 đọc toàn văn; Balakrishnan 1962 chỉ có metadata). +- A6: `docs/plan.md` §12 ý 22–24, `AGENTS.md`, `report.html`, `docs/theory.md` mục 6. Trong A6, agent phát hiện và sửa hai nhận định sai của chính mình về cận ρ*: hệ số giữa hai cấu trúc, và câu "lợi ích vượt cận" (`docs/plan.md` §12 ý 24). + +Mức A cho ra một bản nộp được nhưng benchmark **chưa đầy** (thiếu S1–S3, S7) và cơ chế T2 chỉ ở mức giả thuyết. + +### 4.2 Mức B: thêm 1–2 tuần (GPU + đóng gói) + +| Tuần | Việc | GPU | +| --- | --- | --- | +| 1 | T2: ba thí nghiệm cơ chế (responsibility-weighted warp error; bank nhiễu ngẫu nhiên đối chứng; tách ô đa mode) trên realization 8–15, 2–3 regime | < 0.5 ngày (bank có sẵn, budget 250) | +| 1 | S1: lấp lưới c ∈ {0.5, 1.5}, N ∈ {2, 8} với SMC | ≈ 1 ngày trên 2 GPU (P2r mất vài giờ cho 30 ô; SMC là phần chậm) | +| 1 | S3, S4 | < 0.5 ngày | +| 2 | S2: sửa generator cho misspec rock physics / wavelet / σ_b / drift; dev trên realization mới 902–905; khóa protocol mới; chạy ở 2 regime | 1 ngày code + 1 ngày GPU | +| 2 | S8/T8: regime cycle-skip có kiểm soát | 0.5 ngày | +| 2 | S7: đóng gói benchmark, README, hash, Zenodo | 1–2 ngày | +| 2 | Viết lại §4–5 theo kết quả; review nội bộ | — | + +Mọi thí nghiệm mới ở mức B phải có **protocol mới** (`configs/protocol_bench.yaml`) khóa trước khi chạy, và ghi rõ là thiết kế sau khi đã thấy P2r. T2 và T3 là **exploratory/explanatory**, không phải confirmatory, trừ khi pre-register trên realization mới (16–23). + +### 4.3 Hạ tầng tái dùng và chi phí + +| Thành phần | Tái dùng | Ghi chú | +| --- | --- | --- | +| `ml_porosity/data/synth_d2.py` (267 dòng) | S1, S2 (cần thêm tham số misspec) | Generator identical giữa P2 và P2r | +| `ml_porosity/registration/smc_torch.py`, `warp_prior.py`, `ties.py` | Toàn bộ | P = 1024, tiêu chí ổn định đã có | +| `ml_porosity/losses/rml.py`, `softdtw.py` | Toàn bộ | Bổ đề 1–5 có test | +| `scripts/14_diag_posterior.py`, `15_diag_train.py`, `18_summarize_p2r.py` | S1, S3, T2 | Resume theo cell; nhận realization mới khi protocol khớp hash | +| `outputs/p2r/posterior/*/*_particles.npz` (bank), `outputs/p2r/train/*/cells/*.npz` (μ, σ từng seed trên giếng test) | T2, T3, T4 | 7.7 GB; mô hình không lưu trọng số, cần train lại cho T2 (rẻ) | +| `outputs/p2/h1/` | T9 | — | +| GPU | cuda:0 / cuda:1 theo tải | P2 grid 128 ô × 11 phương pháp × 5 seed: 89 phút; SMC P = 1024 ≈ 3.3× P = 256 | + +--- + +## 5. Rủi ro của hướng mới + +| Rủi ro | Mức | Giảm thiểu | +| --- | --- | --- | +| Reviewer: "benchmark cùng simulator với phương pháp" | Cao | S2 (misspec) là bắt buộc nếu muốn gọi là benchmark; không có S2 thì gọi là "controlled experiment", không gọi là benchmark | +| T2 cho kết quả: lợi ích chỉ là regularization (giả thuyết a) | Trung bình | Vẫn là kết quả có giá trị (nói rõ RML là một dạng augmentation có thông tin); không làm bài sụp | +| Pivot bị đọc là "HARKing" | Trung bình | Pivot 1 có trong plan §9 trước field test; mọi kết quả synthetic đã pre-register; nói thẳng thời điểm quyết định | +| Hạn 31/10 không đủ cho mức B | Chắc chắn | Người dùng chọn: nộp mức A (benchmark chưa đầy, ghi rõ) hoặc dời hạn. *(Đã giải quyết 29/10: mức B, hạn 14/11/2026.)* | +| Bản thảo dài gấp khoảng 2,7 lần giới hạn số từ của venue (thêm 29/10: thân bài khoảng 14.750 từ sau A6; C&G khoảng 5.500 từ theo nguồn thứ cấp, chưa kiểm trên trang chính thức) | Cao | Người dùng bỏ lượt rút gọn độ dài ngày 29/10 (plan §12 ý 25); rủi ro vẫn mở, chưa có biện pháp. Nếu sau này có rút gọn thì không bỏ kết quả âm hay deviation đã ghi (plan §9, R9). | +| Novelty của phần lý thuyết bị trùng với label-noise literature | Thấp–trung bình | T10: tìm kiếm "misaligned labels / index noise / registration noise regression" trước khi viết; khác biệt là nhiễu ở chỉ số + anchor + vật lý | +| Benchmark không ai dùng | Trung bình | S7 làm tử tế: một lệnh sinh, một lệnh chấm, bảng tham chiếu; giấy phép rõ | + +--- + +## 6. Quyết định (chốt 29/10/2026) + +Người dùng chốt ý 1 và 5; ý 2–4 do agent chốt theo bằng chứng (quy ước AGENTS.md: không chờ GVHD). Đã ghi vào `docs/plan.md` §12 ý 22, `AGENTS.md` và `report.html`. + +| # | Việc | Quyết định | Căn cứ | +| --- | --- | --- | --- | +| 1 | Hạn nộp | **Mức B. Hạn mới: thứ 7, 14/11/2026** (dời 2 tuần). Ngưỡng và luật của mọi gate không đổi; chỉ ngày đổi. | Mức A chỉ cho một "controlled study" chưa đầy lưới; mục 4.2 cần 1–2 tuần GPU và đóng gói. | +| 2 | S2 (misspec) | **Bắt buộc, phạm vi hẹp**: ba trục (rock physics sai hệ số; wavelet sai pha và băng thông; σ_b / prior drift sai), hai regime (R10, Rm5), c = 1, N ∈ {4, 16}, realization 8–15, tập phương pháp rút gọn (Oracle, B3c-R, B3d-Sa, M2-Sa). Thiết kế trên dev 902–905; khóa trong `configs/protocol_bench.yaml` trước lần chạy đầu. Nếu đến 10/11 chưa xong S2 thì bài gọi là "controlled synthetic study", không gọi là benchmark. | Rủi ro cao nhất ở mục 5 là "cùng simulator"; không có S2 thì không trả lời được. | +| 3 | T2 | **Exploratory / explanatory**, trên realization 8–15 với bank P2r đã có. Khai báo trước khi chạy ở `docs/research/t2-mechanism.md` (cách làm như P4x). Trong bài là "mechanism analysis" kèm Mệnh đề 3 (*ghi chú 29/10: đánh số lúc lập kế hoạch; trong bài, giả thuyết tái đăng ký ngầm là Nhận xét 1, còn Mệnh đề 3 của bài là hai cấu trúc sai số của tie*); không phải gate, không claim confirmatory. Không sinh realization 16–23 cho T2. | Giả thuyết (c) hình thành sau khi thấy H2b; ba thí nghiệm cần lặp; một lượt SMC riêng cho T2 không vừa hai tuần. | +| 4 | Venue | **Chính: *Computers & Geosciences*.** Dự phòng: *Geophysical Prospecting*. Quartile tra lại khi nộp [XM]. | C&G nhận bài benchmark kèm code và yêu cầu code/data availability, khớp S7. | +| 5 | P4x | **Bỏ hẳn.** Không dùng trong bài, không chạy V3, không tổng hợp. `exploratory/` và `outputs/p4x/` giữ trên đĩa làm hồ sơ, không xóa. Job `exploratory/run_p4x.sh` (cuda:0) ở 560/921 lúc 03:43 UTC 29/10 khi chốt; lệnh dừng từ phiên agent bị từ chối, nên job tự chạy hết (khoảng 40 phút) và kết quả không dùng. | Không phục vụ bài mới; biến thể chọn sau khi thấy nhãn test. | + +### 6.1 Lịch mức B (29/10 → 14/11/2026) + +| Ngày | Việc | Tham chiếu | +| --- | --- | --- | +| T5 29/10 | Chốt quyết định; cập nhật plan, AGENTS, report; khảo sát dataset field public (`field-dataset-survey.md`: chưa có dataset nào xác nhận đủ điều kiện). *Cập nhật:* trong ngày còn thử Teapot Dome (T0 và pilot P-a đều trượt; người dùng chọn quay về lịch mức B; plan §12 ý 23) và viết xong mức A (plan §12 ý 24) | A6; A1–A5 | +| T6 30/10 – T7 31/10 | ~~Mức A: viết lại abstract, intro, contributions, discussion, conclusion theo 3.1–3.3; T1, T4, T8 thành mệnh đề; T4 từ npz; T3 giải tích + mô phỏng trên dự đoán P2r; T10 related work~~ (xong sớm ngày 29/10). Thêm trích dẫn dataset F3 và Volve; còn lại là dự phòng. ~~Lượt rút gọn độ dài~~ (bỏ theo quyết định của người dùng ngày 29/10; plan §12 ý 25) | plan §6.1; rủi ro ở mục 5 | +| CN 1/11 | T2 exploratory: khai báo `t2-mechanism.md` rồi chạy ba thí nghiệm | 4.2 tuần 1 | +| T2 2/11 – T3 3/11 | Sửa generator cho S2 (tham số misspec); dev trên 902–905; viết và **khóa `protocol_bench.yaml`** (S1, S2, S3, S4, S8) kèm `.sha256` và `.lock.json` trước lần chạy đầu | 4.2 | +| T4 4/11 – T5 5/11 | S1 (lấp lưới c ∈ {0.5, 1.5}, N ∈ {2, 8}), S3 (B4 dưới SMC), S4 (backbone thứ hai) trên hai GPU | 4.2 tuần 1 | +| T6 6/11 – T7 7/11 | S2 ba trục; S8/T8 cycle-skip | 4.2 tuần 2 | +| CN 8/11 – T3 10/11 | S7: đóng gói benchmark (một lệnh sinh, một lệnh chấm, bảng tham chiếu, README, hash, Zenodo); viết lại §4–5 theo kết quả | 4.2 | +| T4 11/11 – T5 12/11 | Review nội bộ; hình; phụ lục chứng minh; gói tái lập | — | +| T6 13/11 | Kiểm tra novelty lần cuối; tra quartile; preprint | — | +| **T7 14/11** | **Nộp** | — | + +**Thứ tự cắt phạm vi nếu trễ** (cắt từ trên xuống; không cắt ngưỡng): (1) S4 backbone thứ hai; (2) S8/T8; (3) S2 rút còn một trục rock physics, khi đó tên gọi đổi thành "controlled synthetic study"; (4) S1 rút còn c ∈ {0.5, 1.5} với N = 4/16; (5) T2 chỉ giữ thí nghiệm (1), responsibility-weighted warp error. diff --git a/docs/technical_overview.md b/docs/technical_overview.md index 202a631..4bb164b 100644 --- a/docs/technical_overview.md +++ b/docs/technical_overview.md @@ -1,781 +1,803 @@ -# Tổng quan kỹ thuật: học porosity từ seismic khi well tie không chắc chắn +# Bài giảng: học porosity từ seismic khi không chắc nhãn nằm ở đâu -Cập nhật 27/10/2026, phản ánh trạng thái dự án đến hết ngày 26/10/2026. +Cập nhật 29/10/2026. Phản ánh trạng thái dự án: P0–P4 đã xong (G-C và G-D đều không đạt tiêu chí claim), đang viết bài (P5). Từ 29/10 bài theo Pivot 1: lý thuyết + benchmark synthetic, hạn thứ 7, 14/11/2026; phần viết mức A đã xong sớm (mục 11.7). -Tài liệu này dành cho người mới: chưa làm địa vật lý, chưa quen phần Bayes, hoặc cả hai. Nó giải thích bài toán, ý tưởng, từng thành phần và lý thuyết đằng sau, rồi chỉ ra mỗi thứ nằm ở đâu trong code. Chi tiết đầy đủ, số liệu kiểm tra và chứng minh nằm ở [plan.md](plan.md) và [theory.md](theory.md). +**Bài giảng này dành cho ai.** Người chưa biết gì về địa vật lý, học máy hay thống kê Bayes. Chỉ cần toán phổ thông: hàm số, trung bình, phương sai, hàm mũ. Mỗi khái niệm được giải thích bằng ví dụ đời thường trước, rồi mới đến công thức. Công thức nào khó thì có câu "đọc bằng lời" ngay bên dưới. -**Cách đọc.** -- Mục 1–3: bức tranh lớn, gần như không có công thức. Đọc trước. -- Mục 4: kiến thức nền. Bỏ qua phần nào đã biết. -- Mục 5–6: phương pháp và lý thuyết. -- Mục 7–10: dữ liệu, đối thủ so sánh, cách đánh giá, kết quả hiện tại. -- Mục 11–12: bản đồ code và bảng thuật ngữ. Gặp từ lạ thì tra mục 12. +**Học xong, bạn sẽ hiểu:** +1. Dự án muốn làm gì, và vì sao việc đó khó. +2. Ý tưởng chính (RML) hoạt động ra sao, từng bước. +3. Làm sao biết phương pháp có tốt thật hay không, và vì sao dự án tự trói tay mình bằng các "luật khoá trước". +4. Kết quả đến hôm nay, gồm cả các lần thất bại, và những điều được phép hay không được phép viết trong bài báo. +5. Mỗi phần nằm ở file nào trong code. + +**Cách đọc.** Đọc theo thứ tự từ Bài 1. Mỗi bài kết thúc bằng một khung **Ý chính**. Gặp từ lạ thì tra [Phụ lục A](#phụ-lục-a-thuật-ngữ). Muốn tự kiểm tra thì làm [Phụ lục B](#phụ-lục-b-câu-hỏi-tự-kiểm-tra). Chứng minh đầy đủ ở [theory.md](theory.md); kế hoạch, số liệu và nhật ký quyết định ở [plan.md](plan.md). --- -## 1. Bài toán trong một trang +## Bài 0. Toàn bộ câu chuyện trong năm câu -**Mục tiêu.** Ước lượng **porosity** (độ rỗng: tỉ lệ thể tích lỗ rỗng trong đá) ở mọi điểm của một khối **seismic** 3D, khi chỉ có vài **giếng khoan** đo được porosity. +1. Ta muốn vẽ bản đồ **porosity** (độ rỗng của đá) cho cả một khối đất đá dưới biển, dựa vào ảnh **seismic** phủ toàn vùng và vài **giếng khoan** đo porosity trực tiếp. +2. Seismic đo theo **thời gian** (mili giây), giếng đo theo **độ sâu** (mét). Phép đổi giữa hai trục, gọi là **well tie**, có sai số lớn hơn cả một chu kỳ sóng seismic. +3. Khi huấn luyện mạng nơ-ron trên các cặp (seismic, porosity) bị lệch thời gian như vậy, mạng học ra một phiên bản **bị làm mờ** của sự thật. Dự án chứng minh điều này bằng toán và kiểm chứng bằng thí nghiệm. +4. Ý tưởng sửa lỗi: thay vì tin một phép đổi duy nhất, ta mô tả **mọi phép đổi hợp lý kèm độ tin cậy** (một phân phối xác suất), rồi huấn luyện mạng trên tất cả các phương án đó. Phương pháp này tên là **RML**. +5. Trên dữ liệu mô phỏng, ý tưởng này giúp rõ rệt. Trên 4 giếng thật của F3, nó **không** thắng được đối thủ tốt nhất. Trên mỏ thứ hai (Volve) không phương pháp nào dự đoán được giếng giấu, nên phép so sánh không phân định được gì. Vì vậy bằng chứng của bài là lý thuyết và synthetic; hai mỏ thật chỉ giới hạn phạm vi những gì được nói. -**Hình dung.** Seismic giống ảnh siêu âm của lòng đất: phủ cả vùng nhưng mờ và gián tiếp. Giếng khoan giống vài mẫu sinh thiết: chính xác nhưng chỉ ở vài chỗ. Ta huấn luyện một mô hình học máy ánh xạ "ảnh seismic quanh giếng → đường porosity của giếng", rồi áp mô hình đó cho toàn khối. - -**Chỗ khó.** Hai nguồn dữ liệu dùng hai trục khác nhau: -- Seismic ghi theo **thời gian**: sóng phản xạ mất bao nhiêu mili giây để đi xuống rồi quay lên. -- Log giếng ghi theo **độ sâu**: mét dọc lỗ khoan. - -Muốn ghép một mẫu porosity với đúng đoạn seismic tương ứng, ta cần biết độ sâu z ứng với thời gian t nào. Quan hệ này (**time–depth relationship**, TDR) phải ước lượng, và bước ước lượng gọi là **well tie**. Trên dữ liệu F3 dùng trong bài: -- Sai số của TDR lên tới **14–66 ms** tùy giếng, và thay đổi theo độ sâu. -- Một chu kỳ của sóng seismic chỉ khoảng **17–20 ms**. - -Nghĩa là nhãn porosity có thể bị đặt lệch **một đến vài chu kỳ** so với seismic. Ta đang dạy mô hình bằng những cặp (input, nhãn) mà nhãn bị trượt đi một lượng không biết trước, khác nhau theo độ sâu. - -**Cách làm phổ biến** là chọn một TDR tốt nhất, coi nó là đúng, rồi huấn luyện. **Ý tưởng của bài** là coi độ lệch đó là một **biến ngẫu nhiên chưa biết** (biến ẩn): -1. Ràng buộc nó bằng các điểm neo độc lập (**anchor**) và bằng vật lý truyền sóng. -2. Khi huấn luyện, không chọn một căn chỉnh duy nhất mà **lấy tổng có trọng số trên mọi căn chỉnh hợp lý** (marginalize). -3. Đưa bất định này vào cả cách đánh giá. - -Phương pháp có tên làm việc là **RML** (*Registration-Marginalized Learning*). +Các bài sau giải thích từng câu. --- -## 2. Vì sao lệch thời gian lại nghiêm trọng +## Bài 1. Ta muốn biết gì: porosity -### 2.1 Ví dụ đồ chơi +**Porosity** (độ rỗng, ký hiệu φ) là tỉ lệ thể tích lỗ rỗng trong đá. Hãy hình dung một miếng bọt biển: phần rỗng có thể chứa nước, dầu hoặc khí. +- φ = 0.25 nghĩa là 25% thể tích là lỗ rỗng. +- Trong bài, porosity được ghi bằng **p.u.** (porosity unit), tức φ × 100. Vậy 0.25 = 25 p.u. -Giả sử porosity dao động như một hình sin tần số 50 Hz, tức chu kỳ 20 ms. -- Nhãn lệch 5 ms (một phần tư chu kỳ): nhãn và tín hiệu thật có tương quan bằng 0. -- Nhãn lệch 10 ms (nửa chu kỳ): tương quan bằng −1. Nhãn nói "cao" đúng chỗ thực tế "thấp". +**Vì sao quan tâm.** Porosity cho biết đá chứa được bao nhiêu chất lưu. Đây là một trong những thông tin quan trọng nhất khi đánh giá một mỏ dầu khí, hay một nơi để chôn CO₂ hoặc trữ nhiệt. -Vậy chỉ một độ lệch nhỏ hơn chu kỳ đã đủ biến nhãn thành vô nghĩa, thậm chí ngược dấu, ở các tần số mà seismic mang thông tin. +**Khó ở đâu.** Porosity chỉ đo trực tiếp được ở giếng khoan, mà giếng thì rất đắt và rất thưa. Khối F3 dùng trong bài rộng hàng trăm km² nhưng chỉ có **4 giếng** công khai. Ta cần một cách "nội suy thông minh" từ 4 điểm ra cả khối. -### 2.2 Học bằng MSE trên nhãn lệch ngẫu nhiên thì học được gì? - -Nếu độ lệch δ là ngẫu nhiên, mô hình tối ưu theo MSE sẽ học **trung bình của mọi phiên bản bị dịch** của nhãn. Lấy trung bình nhiều bản dịch của một đường cong là làm mờ nó: các dao động nhanh triệt tiêu nhau, chỉ còn phần chậm. - -Đó là nội dung của **Mệnh đề 1** (mục 6.1). Với δ ~ N(0, σ²), biên độ thành phần tần số f bị nhân với - -$$ -e^{-2\pi^2\sigma^2 f^2}. -$$ - -Với phổ seismic thật của F3 (tâm khoảng 50 Hz): - -| σ_δ | Hệ số ở 40 Hz | Hệ số ở 50 Hz | Phần phương sai trong băng seismic còn lại | -| --- | --- | --- | --- | -| 4 ms | 0.60 | 0.45 | 28% | -| 8 ms | 0.13 | 0.04 | 6% | -| 16 ms | ≈ 0 | ≈ 0 | 2% | - -Chỉ cần σ_δ = 8 ms là gần như toàn bộ chi tiết mà seismic có thể cung cấp bị xoá khỏi mục tiêu học. Trên F3, sai số thực tế còn lớn hơn thế. - -Phép tính này giải thích các "triệu chứng" của mô hình trong luận văn gốc (code trong `code_thesis/`): -- dự đoán bị trơn (smoothing); -- phải thêm loss khớp phương sai (L_Var) vì dự đoán co biên độ; -- phải thêm bước tìm best-shift ±64 ms. - -Những thứ đó là mẹo chữa triệu chứng. Bài này nhắm vào nguyên nhân. +> **Ý chính.** Ta cần porosity ở mọi nơi, nhưng chỉ đo được ở vài giếng. --- -## 3. Ý tưởng và đóng góp +## Bài 2. Hai cách nhìn xuống lòng đất -### 3.1 Research gap +### 2.1 Seismic: "ảnh siêu âm" của lòng đất -Pipeline chuẩn hiện nay: *tie → chuyển nhãn sang thời gian → huấn luyện f(seismic) → đánh giá với nhãn đã tie*. Bất định của tie bị **thu về một điểm trước khi học**. Literature liên quan chia thành ba nhóm tách rời: +**Cách thu.** Một tàu kéo súng hơi phát ra tiếng nổ. Sóng âm đi xuống, gặp ranh giới giữa hai lớp đá khác nhau thì một phần dội ngược lên. Các máy thu ghi lại tiếng vọng. Giống hệt cách siêu âm thai: phát âm thanh vào, nghe tiếng vọng để đoán bên trong có gì. -| Nhóm | Làm gì | Thiếu gì | -| --- | --- | --- | -| L1: tie tự động, tie có bất định (Buland & Omre 2003; Gunning & Glinsky 2006; Wu & Caumon 2017; Tschannen et al. 2022) | Ước lượng tie, có khi kèm posterior của độ lệch | Dừng ở tie, không đưa bất định sang bước học thuộc tính | -| L2: dự đoán thuộc tính bằng deep learning, có UQ | Học seismic → porosity/impedance, có khi ước lượng bất định | Giả định nhãn đã đăng ký đúng | -| L3: loss chịu lệch thời gian (soft-DTW, DILATE, hard-min shift) | Cho phép dự đoán và nhãn lệch nhau | Không anchor, không vật lý, không bất định có kiểm chứng | +**Dữ liệu trông như thế nào.** +- Tại mỗi vị trí trên mặt, ta có một **trace**: một chuỗi số, mỗi số là biên độ tiếng vọng tại một thời điểm. +- Trục dọc của trace là **TWT** (two-way time): thời gian sóng đi xuống rồi quay lên, tính bằng mili giây (ms). Đây là **thời gian, không phải độ sâu**. Điểm này là gốc của mọi rắc rối trong bài. +- F3 ghi một mẫu mỗi 4 ms. +- Các trace xếp thành lưới hai chiều (**inline × crossline**). Mỗi ô lưới là một **bin**. Cả khối 3D gọi là **cube**. -Bài nhắm vào phần giao của ba nhóm: coi sai số đăng ký là biến ẩn, ràng buộc bằng anchor và vật lý, marginalize khi huấn luyện, và tính đến nó khi đánh giá. Theo các lượt tìm kiếm literature đã làm (plan §2.4), chưa thấy công trình nào làm đủ cả bốn việc. Quy tắc viết bài: không dùng chữ "first". - -### 3.2 Bốn đóng góp dự kiến - -- **C1, lý thuyết.** "MSE dưới misregistration = học một target bị làm mờ" (Mệnh đề 1) và điều kiện nhận dạng (Mệnh đề 2). -- **C2, phương pháp RML.** Prior trên warp có điều kiện theo anchor, likelihood tie vật lý, loss marginal likelihood có hiệu chỉnh. -- **C3, giao thức đánh giá có xét registration.** Gồm benchmark synthetic hiệu chỉnh theo F3 và "phase diagram" cho biết khi nào vấn đề này đáng kể. -- **C4, audit dữ liệu F3** cho bài toán porosity (mục 7.1). - -**Không phải đóng góp:** backbone mạng mới, thêm attention, thêm loss, GAN, hay chỉ sửa leakage. - ---- - -## 4. Kiến thức nền - -### 4.1 Địa chấn phản xạ (reflection seismic) - -**Cách thu.** Nguồn phát sóng âm ở mặt (súng hơi ngoài biển). Sóng đi xuống, gặp ranh giới giữa hai lớp đá thì phản xạ một phần lên. Máy thu ghi lại tín hiệu theo thời gian. -- **Trace:** chuỗi biên độ ghi tại một vị trí, theo thời gian. -- **TWT** (two-way time): thời gian đi xuống và về, tính bằng ms. Trục dọc của seismic là TWT, không phải độ sâu. -- **Bước mẫu** của F3 là 4 ms. Tần số Nyquist khi đó là 125 Hz. -- Các trace xếp thành lưới **inline × crossline**. Mỗi ô của lưới là một **bin**. Cả khối gọi là **cube**. Dữ liệu dùng ở đây là **post-stack**: mỗi bin một trace, đã cộng nhiều lần thu. - -**Trở kháng âm và hệ số phản xạ.** -- Acoustic impedance AI = mật độ × vận tốc sóng P. -- Tại ranh giới giữa lớp 1 và lớp 2, hệ số phản xạ là +**Tiếng vọng sinh ra thế nào (mô hình tích chập).** Mỗi lớp đá có một **trở kháng âm** (AI = mật độ × vận tốc sóng). Tại ranh giới giữa hai lớp, phần sóng dội lại tỉ lệ với chênh lệch trở kháng: $$ r = \frac{AI_2 - AI_1}{AI_2 + AI_1}. $$ -**Mô hình tích chập.** Trace seismic xấp xỉ bằng chuỗi hệ số phản xạ theo thời gian tích chập với một xung ngắn gọi là **wavelet**, cộng nhiễu: +Chuỗi các hệ số r theo thời gian gọi là **reflectivity**. Nhưng sóng phát ra không phải một "tách" sắc gọn, mà là một xung ngắn có hình dạng riêng, gọi là **wavelet**. Trace ta ghi được là reflectivity "nhoè" theo hình dạng wavelet, cộng thêm nhiễu: $$ -s(t) = (w * r)(t) + \text{noise}. +s(t) = (w * r)(t) + \text{nhiễu}. $$ -- Wavelet có **băng tần hữu hạn**. F3 có năng lượng ở khoảng 4–83 Hz, đỉnh khoảng 50–60 Hz. Ví dụ wavelet đơn giản: Ricker. -- Wavelet có **pha**: pha không thì đối xứng, pha khác 0 thì méo lệch. Pha thật thường không biết, phải ước lượng. -- **Synthetic seismogram:** lấy log AI ở giếng, chuyển sang thời gian, tính r rồi tích chập với wavelet. Kết quả là trace "nhân tạo", đem so với trace thật tại giếng. +*Đọc bằng lời:* tại mỗi ranh giới đá, đặt một bản sao của wavelet, cao thấp theo r, rồi cộng tất cả lại. Dấu `*` (tích chập) chính là phép "đặt bản sao và cộng" đó. -**Hệ quả quan trọng: seismic gần như mù với tần số thấp.** Dưới khoảng 6 Hz, seismic F3 có rất ít năng lượng (dưới 8 Hz chỉ 1–2%). Phần biến thiên chậm của porosity (xu hướng nén chặt theo độ sâu, mức trung bình) không đến từ seismic. Nó đến từ giếng, từ mô hình tần số thấp (**LFM**) hoặc từ xu hướng theo thời gian. Vì vậy bài tách đánh giá thành hai băng: -- **băng thấp** (< f_c = 6 Hz): chủ yếu là xu hướng; -- **băng seismic** (≥ 6 Hz): phần mà seismic thực sự đóng góp, và cũng là phần bị misregistration phá hỏng. +**Seismic chỉ nghe được một dải tần.** Wavelet của F3 chứa năng lượng chủ yếu từ khoảng 4 đến 83 Hz, mạnh nhất quanh 50–60 Hz. Một chu kỳ sóng ở tần số trội dài khoảng **17–20 ms**. Hệ quả: +- **Seismic gần như điếc với tần số rất thấp** (dưới khoảng 6 Hz). Những biến đổi chậm, như porosity giảm dần theo độ sâu do đá bị nén, seismic không "nghe" được. Phần đó phải lấy từ giếng. +- Vì vậy bài tách mọi phép đo thành hai **băng tần**: **băng thấp** (< 6 Hz, chủ yếu là xu hướng) và **băng seismic** (≥ 6 Hz, phần mà seismic thực sự đóng góp). Băng seismic là phần ta quan tâm nhất. -**Horizon:** một mặt phản xạ liên tục được dò (pick) xuyên qua cube, ví dụ nóc một tầng đá. F3 có 7 horizon và một đứt gãy (FaultA). +**Horizon** là một mặt phản xạ liên tục được người giải đoán dò (pick) xuyên qua cube, ví dụ mặt nóc của một tầng đá. F3 có 7 horizon. -### 4.2 Log giếng (well logs) +### 2.2 Giếng khoan: "mẫu sinh thiết" -**Độ sâu.** -- **MD** (measured depth): chiều dài dọc lỗ khoan. -- **TVD:** độ sâu thẳng đứng. -- **KB** (kelly bushing): mốc đo trên giàn. -- Cả 4 giếng F3 đều thẳng đứng, nên MD và TVD chỉ khác nhau hằng số KB. +Khi khoan, người ta thả thiết bị đo xuống lỗ khoan và ghi các **log**, tức các đường cong theo **độ sâu** (mét): -**Các đường log dùng trong bài** (file định dạng **LAS**): - -| Log | Đo gì | Đơn vị | +| Log | Đo gì | Ghi chú | | --- | --- | --- | -| DT (sonic) | thời gian sóng đi qua 1 m đá, tức nghịch đảo vận tốc (slowness) | µs/m | -| RHOB | mật độ khối | kg/m³ | -| GR | phóng xạ gamma tự nhiên, chỉ thị sét | API | -| PHIE | porosity hiệu dụng (đã tính từ các log khác, không đo trực tiếp) | phân số; báo cáo bằng **p.u.** = ×100 | -| AI | trở kháng âm = RHOB × 10⁶ / DT | | +| DT (sonic) | Thời gian sóng âm đi qua 1 m đá (µs/m). DT lớn nghĩa là đá "chậm" | Dùng để đổi độ sâu sang thời gian (Bài 4) | +| RHOB | Mật độ đá (kg/m³) | | +| GR | Phóng xạ tự nhiên, cho biết đá nhiều sét hay không | | +| PHIE | Porosity hiệu dụng, tính từ các log khác | Đây là **nhãn** ta muốn dự đoán | -**Rock physics** là các công thức nối thuộc tính đá với log. Ví dụ, porosity theo mật độ: +**Độ sâu cũng có vài loại.** MD là chiều dài dọc theo lỗ khoan. TVD là độ sâu thẳng đứng. Giếng thẳng thì hai thứ gần như trùng nhau. Giếng nghiêng (như ở Volve, Bài 11.6) thì khác nhau đáng kể. -$$ -\varphi = \frac{\rho_{ma} - \rho}{\rho_{ma} - \rho_{fl}}, -$$ +**Một sự thật quan trọng về nhãn của F3.** Kiểm tra cho thấy ở 3/4 giếng F3, PHIE là một **hàm tuyến tính chính xác của DT**: PHIE = −0.2018 + 0.0011·DT, với R² = 1.00000. Lý do: mật độ trong bản demo F3 không phải số đo thật mà được suy ra từ sonic. Dự án chấp nhận điều này, dùng nhãn PHIE_DT = −0.2018 + 0.0011·DT cho cả 4 giếng, và **phải nói thẳng trong bài** rằng "porosity" của F3 thực chất là sonic đổi đơn vị. Đây là lý do cần thêm mỏ Volve, nơi porosity được tính độc lập với sonic. -với ρ_ma là mật độ khung đá và ρ_fl là mật độ chất lưu. +### 2.3 Mỗi nguồn mạnh và yếu ở đâu -**Phát hiện về nhãn F3** (plan §1.2d). Ở 3/4 giếng: -- PHIE = −0.2018 + 0.0011·DT chính xác (R² = 1.00000); -- đồng thời PHIE = (2650 − RHOB)/1600. +| | Seismic | Giếng khoan | +| --- | --- | --- | +| Phủ không gian | Toàn khối | Vài điểm | +| Độ phân giải dọc | Thô (cỡ chục mét) | Rất mịn (15 cm) | +| Trục dọc | **Thời gian** (ms) | **Độ sâu** (m) | +| Đo porosity? | Không, chỉ gián tiếp qua trở kháng | Có (gần như trực tiếp) | -Lý do: mật độ trong bản demo F3 ở các giếng này là mật độ **dự đoán từ sonic**, không phải số đo. Vậy "porosity" của F3 thực chất là **sonic biến đổi tuyến tính**. Dự án chọn nhãn chính là PHIE_DT = −0.2018 + 0.0011·DT cho cả 4 giếng (quyết định D-1) và nói thẳng điều này trong bài. Mặt tốt: chuỗi porosity → DT → RHOB → AI được biết chính xác, nên likelihood tie vật lý (mục 5.5) trên F3 không phải xấp xỉ. +Ý tưởng tự nhiên: dạy một mô hình đọc seismic quanh giếng rồi đoán porosity của giếng. Học xong thì đem mô hình áp cho mọi trace của cube. -### 4.3 Quan hệ thời gian–độ sâu (TDR) +> **Ý chính.** Seismic phủ rộng nhưng mờ và đo theo thời gian. Giếng chính xác nhưng thưa và đo theo độ sâu. Muốn ghép hai thứ, phải biết mỗi độ sâu ứng với thời gian nào. -**Từ sonic.** Thời gian hai chiều tại độ sâu z là tích phân slowness: +--- + +## Bài 3. Học máy trong mười phút + +Phần này dành cho ai chưa từng huấn luyện một mô hình. + +**Học có giám sát.** Ta có nhiều cặp (input X, nhãn y). Mô hình là một hàm f có nhiều tham số chỉnh được. **Huấn luyện** là chỉnh tham số sao cho f(X) gần y nhất. + +**Đo "gần" bằng hàm loss.** Phổ biến nhất là **MSE** (mean squared error): trung bình bình phương sai số, (f(X) − y)². Huấn luyện là tìm tham số làm loss nhỏ nhất. + +**Một tính chất của MSE cần nhớ cho Bài 5.** Nếu cùng một input X mà nhãn y lúc thì thế này, lúc thì thế khác (do nhiễu), thì dự đoán tốt nhất theo MSE là **trung bình** của các nhãn đó. MSE không chọn một phương án mà "chia đều". + +**Trong bài này.** +- **Input X:** 9 trace seismic trong ô 3×3 bin quanh giếng, mỗi trace dài 126 mẫu (cửa sổ 600–1100 ms). +- **Nhãn y:** đường porosity tại đúng 126 thời điểm đó. +- **Mô hình:** mạng **CNN–GRU**, giữ nguyên kiến trúc từ luận văn gốc. Phần CNN (tích chập) nhận ra các mẫu hình cục bộ trên trace. Phần GRU (mạng hồi quy hai chiều) cho mỗi điểm "nhìn" được ngữ cảnh phía trên lẫn phía dưới. +- **Mạng không chỉ đoán một con số.** Tại mỗi thời điểm, nó xuất ra **μ** (giá trị dự đoán) và **σ** (độ không chắc chắn). Loss tương ứng là **Gaussian NLL**: phạt khi sai, nhưng phạt nhẹ hơn ở chỗ mạng đã khai σ lớn. Để mạng không khai σ lớn ở mọi chỗ, loss có thêm một khoản phạt cho σ lớn. +- **Ensemble:** huấn luyện 5 bản của cùng mạng với khởi tạo ngẫu nhiên (seed) khác nhau rồi gộp lại. Các bản càng bất đồng thì bất định càng lớn. + +**Vì sao ít giếng là khó.** Với 4 giếng, mỗi lần chỉ có 2–3 giếng để học, tức 2–3 đường cong. Mạng rất dễ **học thuộc** nhãn train (overfitting) thay vì học quy luật chung. + +**Kiểm tra trung thực bằng LOWO.** *Leave-one-well-out:* lần lượt giấu một giếng, học trên các giếng còn lại, rồi chấm trên giếng bị giấu. Giếng bị giấu gọi là **blind well**. Nó không được góp bất cứ thông tin gì vào việc học. + +> **Ý chính.** Mạng học từ các cặp (seismic, porosity). Nếu nhãn của cùng một input không nhất quán, mạng theo MSE sẽ học trung bình của chúng. + +--- + +## Bài 4. Vấn đề cốt lõi: hai chiếc đồng hồ chạy lệch nhau + +### 4.1 Đổi độ sâu sang thời gian + +Để ghép porosity (theo mét) với seismic (theo ms), ta cần biết **mỗi độ sâu z ứng với thời gian t nào**. Quan hệ đó gọi là **TDR** (time–depth relationship). + +**Cách cơ bản: cộng dồn sonic.** DT cho biết sóng mất bao lâu để đi qua mỗi mét đá. Cộng dồn (tích phân) từ trên xuống, rồi nhân 2 vì sóng đi cả xuống lẫn lên, ta được thời gian tại mỗi độ sâu: $$ t(z) = t_{\text{ref}} + 2\int_{z_{\text{ref}}}^{z} \mathrm{DT}(u)\,du. $$ -**Drift.** Thời gian tích phân từ sonic lệch dần so với thời gian seismic, và lệch càng nhiều khi xuống sâu. Nguyên nhân: -- Sonic đo ở tần số kHz, seismic ở vài chục Hz. Vận tốc phụ thuộc tần số (dispersion), nên sonic thấy đá "nhanh" hơn. -- Sonic chỉ đo vùng sát thành lỗ khoan, có thể bị ảnh hưởng bởi lỗ khoan bị sập rộng (washout). -- Log có đoạn thiếu, và mốc thời gian bắt đầu không chắc chắn. +Ta gọi thời gian tính theo cách này là **thời gian sonic**, ký hiệu **τ**. Thời gian thật trên seismic ký hiệu **t**. -Trên F3, drift trong cửa sổ 600–1100 ms thay đổi tới 45 ms bên trong một giếng (F06-1). Một độ lệch hằng số (bulk shift) không mô tả được kiểu sai số này. +### 4.2 Đồng hồ sonic chạy sai: drift -**Nguồn thông tin độc lập về thời gian.** -- **Checkshot/VSP:** đo trực tiếp thời gian sóng từ mặt xuống các độ sâu trong giếng. -- **Marker:** nóc một tầng đá xác định trên log (biết độ sâu), khớp với horizon trên seismic (biết thời gian). Mỗi marker cho một cặp (z_k, t_k), gọi là **anchor**. -- Lưu ý: trên F3, file "Checkshot" thực ra là các cặp marker–horizon, không phải VSP độc lập. Anchor vì vậy mang sai số pick (σ_a), không được coi là chân lý. +Nếu sonic hoàn hảo thì τ = t. Thực tế không phải vậy. Hãy hình dung **hai chiếc đồng hồ**: đồng hồ sonic và đồng hồ seismic. Chúng chạy gần cùng tốc độ nhưng không hẳn, nên càng xuống sâu càng lệch nhau. Độ lệch tích luỹ này gọi là **drift**. Nguyên nhân: +- Sonic đo bằng sóng tần số kHz, seismic dùng sóng vài chục Hz. Đá truyền sóng tần số cao nhanh hơn một chút (hiện tượng tán sắc). +- Sonic chỉ đo lớp đá sát thành lỗ khoan, nơi có thể đã bị khoan làm hỏng. +- Log có đoạn thiếu, và không ai biết chắc thời điểm bắt đầu. -**Bốn TDR mà code dựng cho F3** ([tdr.py](../ml_porosity/data/tdr.py)): +Trên F3, ngay bên trong một giếng (F06-1), drift thay đổi tới **45 ms** trong cửa sổ 600–1100 ms. Vậy không thể sửa bằng cách dịch cả đường đi một hằng số. -| Tên | Cách dựng | Vai trò | -| --- | --- | --- | -| legacy | tích phân DT, t = 0 tại mẫu LAS đầu, không hiệu chỉnh | tái hiện luận văn, chỉ để audit | -| sonic | tích phân DT qua một điểm neo | trục tham chiếu τ | -| calibrated | co giãn thời gian sonic trong từng khoảng giữa hai anchor để đi qua đúng mọi anchor ("marker-calibrated sonic", thực hành chuẩn trong ngành) | **tham chiếu chấm điểm** | -| wlt | mô hình Depth2Time của OpendTect | phân tích độ nhạy của đánh giá | +### 4.3 Các điểm neo: anchor -Các nguồn này không thống nhất với nhau: chênh lệch giữa chúng là 9–36 ms. Bất định registration vì vậy là **thuộc tính của bài toán**, không chỉ là lỗi trong code. +May là có vài điểm mà ta biết cả độ sâu lẫn thời gian một cách độc lập với sonic: +- Trên log giếng, nhà địa chất xác định nóc một tầng đá (**marker**), nên biết **độ sâu** của nó. +- Trên seismic, cùng tầng đá đó hiện ra thành một horizon, nên biết **thời gian** của nó. + +Ghép hai thứ, ta được một cặp (độ sâu, thời gian) gọi là **anchor** (điểm neo). Mỗi giếng F3 có 9–11 anchor trong cửa sổ chính. Anchor cũng không hoàn hảo: người pick có thể lệch vài ms. Độ lệch này được mô tả bằng một độ lệch chuẩn **σ_a** (dự án dùng σ_a = 7 ms). Lưu ý: file tên "Checkshot" của F3 thực ra là các cặp marker–horizon như trên, không phải phép đo thời gian độc lập. ### 4.4 Well tie -**Well tie** là chỉnh TDR sao cho synthetic seismogram tại giếng khớp nhất với trace seismic thật: -1. Đưa log AI sang thời gian bằng TDR hiện tại. -2. Tính reflectivity và tích chập với wavelet để được synthetic. -3. So với trace thật, dịch hoặc co giãn TDR để tăng độ khớp (tương quan). -4. Lặp lại. +**Well tie** là quá trình chỉnh TDR cho khớp nhất. Cách làm: +1. Dùng TDR hiện tại đưa log trở kháng sang thời gian. +2. Tính reflectivity, tích chập với wavelet, được một trace "nhân tạo" gọi là **synthetic seismogram**. +3. So synthetic với trace seismic thật tại giếng, rồi kéo giãn hoặc dịch TDR để hai đường giống nhau hơn. -Tie khó vì nghiệm không duy nhất: -- **Cycle skipping:** lệch đúng một chu kỳ vẫn khớp khá tốt. -- **Pha wavelet:** pha chưa biết có thể bù cho một phần dịch thời gian (theory §2.1). -- **Nhiễu:** tương quan cao có thể chỉ do ngẫu nhiên. +Tie khó vì nhiều đáp án đều trông "khá khớp": +- **Cycle skipping:** dịch lệch đúng một chu kỳ sóng, hai đường vẫn trông giống nhau. +- **Pha của wavelet** không biết trước, và một chút đổi pha có thể bù cho một chút dịch thời gian. +- Nhiễu có thể tạo ra độ khớp cao do ngẫu nhiên. -### 4.5 Học có giám sát trên chuỗi thời gian +### 4.5 Các con số trên F3 -**Dữ liệu cho mạng.** -- **Input X:** patch 3×3 trace seismic quanh giếng, tức 9 kênh. Mỗi kênh dài L = 126 mẫu (600–1100 ms, bước 4 ms) và được chuẩn hoá z-score theo từng kênh trong từng giếng. -- **Output:** đường porosity tại đúng 126 thời điểm đó. +- Thời gian sonic chưa hiệu chỉnh lệch so với anchor từ **14 đến 66 ms**, tuỳ giếng. +- Bốn cách dựng TDR khác nhau (sonic thô, sonic hiệu chỉnh theo anchor, mô hình của OpendTect, ...) chênh nhau **9–36 ms**. +- Một chu kỳ sóng seismic chỉ dài **17–20 ms**. -**Backbone CNN–GRU** ([cnn_gru.py](../ml_porosity/models/cnn_gru.py), giữ nguyên kiến trúc của luận văn): -- 3 lớp tích chập 1D có dilation 1, 2, 4, để bắt mẫu hình cục bộ ở nhiều tầm. -- 2 tầng GRU hai chiều, để mỗi điểm "nhìn" được ngữ cảnh cả phía trên lẫn phía dưới. -- Một nhánh skip 1×1 nối thẳng từ input ra output. +Nghĩa là nhãn porosity có thể bị đặt lệch **một đến vài chu kỳ** so với seismic, và lệch khác nhau ở các độ sâu khác nhau. Bất định này là **bản chất của bài toán**, không phải lỗi lập trình. -**Head heteroscedastic** ([train.py](../ml_porosity/models/train.py), lớp `CNNGRUHetero`): mạng xuất hai đường, μ(t) (dự đoán) và σ(t) > 0 (độ bất định tại từng điểm). Huấn luyện bằng **Gaussian NLL**: +**Cách làm phổ biến trong ngành và trong các bài báo:** chọn TDR tốt nhất, coi là đúng tuyệt đối, rồi huấn luyện. Bài này hỏi: làm vậy thì mất gì? -$$ --\log\mathcal N(y;\mu,\sigma^2) = \log\sigma + \frac{(y-\mu)^2}{2\sigma^2} + \tfrac12\log 2\pi . -$$ - -Chỗ nào khó đoán, mạng được phép khai σ lớn, nhưng phải trả giá ở số hạng log σ. - -**Deep ensemble:** huấn luyện M = 5 mạng với seed khác nhau. -- Phương sai tổng = trung bình σ² của các mạng (bất định **aleatoric**, do dữ liệu) + phương sai giữa các μ (bất định **epistemic**, do mô hình). - -**Sub-window.** Mỗi giếng chỉ là một chuỗi, và chỉ có vài giếng: luận văn thực chất chỉ có 2 chuỗi huấn luyện. Loss vì vậy tính trên nhiều cửa sổ con 64 mẫu chồng lên nhau (P2: bắt đầu ở 0, 2, …, 62). Các cửa sổ không độc lập; đây chỉ là công cụ tối ưu. - -**LOWO** (leave-one-well-out): lần lượt giữ một giếng làm test, huấn luyện trên các giếng còn lại. Với 4 giếng có 4 fold. - -### 4.6 Bayes và lấy mẫu: đủ để hiểu RML - -**Prior, likelihood, posterior.** - -$$ -\underbrace{p(u\mid\text{dữ liệu})}_{\text{posterior}} \propto \underbrace{p(\text{dữ liệu}\mid u)}_{\text{likelihood}}\cdot\underbrace{p(u)}_{\text{prior}} . -$$ - -- Prior: ta tin gì về u trước khi xem dữ liệu. -- Likelihood: u giải thích dữ liệu tốt đến đâu. -- Posterior: niềm tin sau khi kết hợp cả hai. -- Ở đây u là warp (độ lệch thời gian theo độ sâu) của một giếng. - -**Gaussian process (GP)** là phân phối xác suất trên các *hàm*. Mỗi lần rút ngẫu nhiên từ GP cho ra một đường cong. GP được xác định bởi: -- hàm trung bình m; -- **kernel** k(x, x'): hai điểm cách nhau bao xa thì giá trị tương quan bao nhiêu. - -Bài dùng kernel **Matérn-3/2** với hai tham số: -- σ (biên độ): đường cong dao động mạnh cỡ nào; -- ℓ (độ dài tương quan): bao xa thì hai điểm coi như độc lập. Đường cong rút ra liên tục, khả vi một lần, không trơn quá mức. - -**Hyperparameter** là các tham số của prior như (m, σ, ℓ). Chọn chúng bằng **type-II maximum likelihood** (empirical Bayes): chọn bộ giá trị làm cho dữ liệu quan sát (ở đây là anchor) có xác suất cao nhất sau khi đã tích phân hết hàm warp. Nếu thêm prior lên chính hyperparameter thì gọi là **MAP-II**. Chỉ dùng anchor của giếng train, nên không rò rỉ thông tin từ giếng test. - -**Xấp xỉ Gaussian (tuyến tính hoá / Laplace).** Khi warp nhỏ, quan hệ giữa warp và thời gian anchor gần tuyến tính, nên posterior gần Gaussian và tính được bằng công thức đóng. Lặp tuyến tính hoá quanh nghiệm hiện tại (Gauss–Newton) cho nghiệm MAP và một Gaussian xấp xỉ quanh đó. - -**MCMC và elliptical slice sampling.** Muốn có *mẫu* đúng từ posterior thật (phi tuyến, có ràng buộc), ta dùng MCMC: một chuỗi ngẫu nhiên mà sau đủ lâu, các điểm của nó phân phối theo posterior. **Elliptical slice sampling** (Murray, Adams & MacKay 2010) là một MCMC dành cho trường hợp "prior Gaussian × likelihood bất kỳ": -- Mỗi bước, nó đề xuất các điểm trên một ellipse đi qua điểm hiện tại và một mẫu prior mới. -- Nó co dần góc trên ellipse cho tới khi được chấp nhận. -- Không phải chỉnh bước nhảy bằng tay. - -**Importance sampling và ESS** (effective sample size). -- Có S mẫu từ một phân phối q, nhưng muốn phân phối p. Gán cho mẫu s trọng số w_s ∝ p/q. -- ESS đo xem S mẫu có trọng số "đáng giá" bao nhiêu mẫu đều: - -$$ -\mathrm{ESS} = \frac{(\sum_s w_s)^2}{\sum_s w_s^2}. -$$ - -- Nếu một mẫu chiếm gần hết trọng số thì ESS ≈ 1. Hiện tượng này gọi là **suy biến trọng số**. - -> ⚠️ Trong repo, "ESS" có hai nghĩa: *elliptical slice sampling* (thuật toán lấy mẫu) và *effective sample size* (chỉ số trọng số). Phải đọc ngữ cảnh. - -**Tempering.** Nâng likelihood lên luỹ thừa γ ∈ [0, 1]: -- γ = 0 bỏ qua likelihood; -- γ = 1 dùng đủ likelihood; -- γ nhỏ làm phân phối bớt nhọn, giảm suy biến trọng số. - -**SMC tempering** (sequential Monte Carlo): bắt đầu từ γ = 0 với một đám "hạt" (mẫu), tăng γ từng bậc nhỏ. Ở mỗi bậc: -1. tính lại trọng số; -2. resample (nhân bản hạt tốt, bỏ hạt kém); -3. di chuyển các hạt bằng vài bước MCMC. - -Cách này đến được γ = 1 mà không suy biến trọng số. - -**Power likelihood và residual tự tương quan.** Likelihood Gaussian coi 64 mẫu trong cửa sổ là 64 quan sát độc lập. Thực tế các mẫu liên tiếp tương quan với nhau, nên chúng chứa ít thông tin hơn. Coi chúng độc lập làm phân phối quá nhọn (quá tự tin). Cách sửa đơn giản nhất là nâng likelihood lên luỹ thừa λ < 1 (*magnitude adjustment* cho composite likelihood). Đây là nguồn gốc của λ trong RML (mục 5.7). - -### 4.7 Căn chỉnh chuỗi thời gian - -- **Cross-correlation lag:** dịch cả chuỗi một hằng số để tương quan lớn nhất. -- **DTW** (dynamic time warping): tìm đường căn chỉnh đơn điệu tốt nhất giữa hai chuỗi, cho phép co giãn cục bộ. Dải **Sakoe–Chiba** giới hạn độ lệch tối đa |i − j| ≤ band. -- **Soft-DTW** (Cuturi & Blondel 2017): thay "min trên mọi đường" bằng "soft-min", nên khả vi và dùng được làm loss. -- **DILATE** (Le Guen & Thome 2019): soft-DTW cộng một số hạng phạt độ méo thời gian (TDI). - -Các loss này cho phép dự đoán và nhãn lệch nhau, nhưng lệch bao nhiêu thì do chính chúng tự quyết định để khớp tốt nhất. Không có anchor hay vật lý nào ràng buộc. Mệnh đề 2 cho thấy vì sao điều này nguy hiểm. +> **Ý chính.** Đổi độ sâu sang thời gian cần một TDR, và TDR trên F3 sai nhiều hơn một chu kỳ sóng. Anchor giúp ghim TDR tại một số điểm, nhưng giữa các anchor vẫn còn bất định. --- -## 5. Phương pháp RML, từng thành phần +## Bài 5. Lệch một chút thì hỏng đến đâu? -### Workflow chi tiết +### 5.1 Ví dụ đồ chơi -![Detailed RML workflow: from input data to go/no-go gates](figures/workflow.png) +Giả sử porosity dao động như một hình sin chu kỳ 20 ms (tần số 50 Hz): +- Nhãn lệch **5 ms** (một phần tư chu kỳ): nhãn và porosity thật có **tương quan bằng 0**. Nhãn chẳng nói gì cả. +- Nhãn lệch **10 ms** (nửa chu kỳ): tương quan bằng **−1**. Nhãn nói "cao" đúng ở chỗ thật ra là "thấp". -*Hình 1. Workflow chi tiết. Khung nét đứt là các giai đoạn; mũi tên chấm là luồng phụ: log AI dùng để dựng synthetic, và *True warp* (warp thật, chỉ có trên D2) dùng để chấm sai số warp và huấn luyện Oracle. Nhãn trong hình viết bằng tiếng Anh để dùng thẳng cho paper; bảng dưới ghi tên tiếng Anh của từng giai đoạn trong ngoặc. Bản vector: [workflow.svg](figures/workflow.svg); nguồn TikZ: [workflow.tex](figures/workflow.tex).* +Vậy một độ lệch còn nhỏ hơn một chu kỳ đã đủ phá hỏng nhãn ở những tần số mà seismic mang thông tin. -| Giai đoạn | Làm gì | Code | -| --- | --- | --- | -| 1. Tiền xử lý (*Preprocessing*) | Đặt giếng đúng toạ độ rồi trích patch seismic 3×3. Tích phân DT để có trục τ. Ghép marker giếng với horizon seismic thành anchor (τ_k, t_k). | [geometry.py](../ml_porosity/data/geometry.py), [tdr.py](../ml_porosity/data/tdr.py), [horizons.py](../ml_porosity/data/horizons.py) | -| 2. Posterior căn chỉnh (*Registration posterior*) | Prior GP cho warp, cập nhật theo anchor, rồi chấm từng mẫu warp bằng độ khớp synthetic–seismic. Ra S mẫu warp kèm trọng số π_s (mục 5.1–5.5). | [warp_prior.py](../ml_porosity/registration/warp_prior.py), [sampler.py](../ml_porosity/registration/sampler.py), [tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py), [smc.py](../ml_porosity/registration/smc.py) | -| 3. Ngân hàng nhãn (*Label bank*) | Mỗi mẫu warp cho một phiên bản nhãn porosity theo thời gian seismic (mục 5.6). | [labels.py](../ml_porosity/registration/labels.py) | -| 4. Huấn luyện (*Training*) | CNN–GRU nhận patch seismic, dự đoán (μ, σ), học bằng loss RML trên cả bank (mục 5.7). Số bước chọn trên realization dev; ensemble 5 seed. | [bank_train.py](../ml_porosity/models/bank_train.py), [rml.py](../ml_porosity/losses/rml.py) | -| 5. Dự đoán (*Prediction*) | Chỉ cần seismic, không cần warp: ra μ ± σ ở giếng test hoặc cả khối (mục 5.8). | [cnn_gru.py](../ml_porosity/models/cnn_gru.py) | -| 6. Đánh giá (*Evaluation*) | Chấm trên giếng mù với tham chiếu cố định, theo metric và ngưỡng đã khoá trong protocol; so với baseline và Oracle để quyết định cổng (mục 9). | [metrics.py](../ml_porosity/eval/metrics.py) | +### 5.2 Học trên nhãn lệch ngẫu nhiên thì học được gì: hiện tượng làm mờ -Các baseline đi qua cùng luồng này nhưng thay giai đoạn 2–3. Ví dụ, B3b dùng một warp duy nhất (S = 1) từ marker-calibrated sonic; B3d lấy warp trung bình của posterior làm nhãn duy nhất (mục 5.9 và 8). +Giả sử mỗi giếng, mỗi đoạn có một độ lệch δ khác nhau mà ta không biết. Với cùng một kiểu seismic, nhãn lúc thì bị dịch lên, lúc bị dịch xuống. Nhớ lại Bài 3: **MSE học trung bình của các nhãn**. Ở đây đó là trung bình của nhiều bản sao bị dịch của cùng một đường porosity. -Dựng lại hình sau khi sửa `workflow.tex`: chạy `xelatex workflow.tex` trong `docs/figures/` rồi xuất `workflow.pdf` sang PNG (200 dpi) và SVG. +**Hình dung:** chụp ảnh khi tay run. Ảnh nhận được là trung bình của nhiều ảnh bị dịch đi một chút, tức một **ảnh mờ**. Chi tiết nhỏ (tần số cao) triệt tiêu nhau; chỉ hình dạng lớn (tần số thấp) còn lại. -### 5.1 Warp: tham số hoá độ lệch thời gian - -Gọi **τ** là thời gian sonic (tích phân DT từ một điểm neo) và **t** là thời gian seismic thật. Warp là hàm t(τ) ([warp_prior.py](../ml_porosity/registration/warp_prior.py)): +Dự án phát biểu điều này thành **Mệnh đề 1**: nếu δ độc lập với dữ liệu và có phân phối chuẩn với độ lệch chuẩn σ, thì thành phần tần số f của dự đoán tối ưu bị nhân với $$ -t(\tau) = \tau + b + \int_{\tau_0}^{\tau}\big(e^{g(\tau')} - 1\big)\,d\tau' , -\qquad\text{tức là}\qquad \frac{dt}{d\tau} = e^{g(\tau)} . +e^{-2\pi^2\sigma^2 f^2}. $$ -- **b** (bulk offset): dịch chung cả giếng. -- **g(τ)** (hiệu chỉnh log-slowness): "tốc độ chạy" của đồng hồ seismic so với đồng hồ sonic. - - g = 0.05 nghĩa là thời gian seismic trôi nhanh hơn thời gian sonic khoảng 5%, tương đương vận tốc seismic chậm hơn vận tốc sonic khoảng 5%. - - Drift 66 ms trên khoảng 1000 ms ứng với g cỡ 5–6%, một độ lớn hợp lý về vật lý. -- Vì e^g > 0, t luôn tăng theo τ: **đơn điệu theo cấu trúc**. Lớp đá dưới không bao giờ bị đẩy lên trên lớp đá trên. +*Đọc bằng lời:* hệ số này bằng 1 ở tần số 0 (xu hướng giữ nguyên), rồi giảm rất nhanh khi tần số tăng hoặc khi độ lệch σ tăng. -Dạng tương đương theo độ sâu: t(z) = t_ref + b + 2∫DT(u)·e^{g(u)} du. +Với phổ seismic thật của F3: -### 5.2 Prior trên warp +| σ (độ lệch chuẩn của δ) | Hệ số ở 40 Hz | Hệ số ở 50 Hz | Phần phương sai băng seismic còn lại | +| --- | --- | --- | --- | +| 4 ms | 0.60 | 0.45 | 28% | +| 8 ms | 0.13 | 0.04 | 6% | +| 16 ms | ≈ 0 | ≈ 0 | 2% | -- g ~ GP(m_g, Matérn-3/2 với σ_g, ℓ), và b ~ N(0, σ_b²). -- (m_g, σ_g, ℓ) học bằng MAP-II trên anchor của giếng train ([`fit_hyper`](../ml_porosity/registration/warp_prior.py)). -- Ví dụ, fit trên anchor của cả 4 giếng F3 ([`outputs/p2/warp_prior_f3.json`](../outputs/p2/warp_prior_f3.json)) cho m_g ≈ 0.014, σ_g ≈ 0.10, ℓ ≈ 71 ms, σ_b ≈ 19 ms. -- Kiểm tra leave-one-anchor-out: bỏ từng anchor, dự đoán lại nó từ các anchor còn lại. Kết quả: trung bình z² ≈ 0.87, độ phủ 90% ≈ 0.87, tức prior không quá tự tin. +Chỉ cần σ = 8 ms là gần như mọi chi tiết seismic có thể cung cấp đã bị xoá khỏi mục tiêu học. Sai số thật trên F3 còn lớn hơn. -### 5.3 Anchor +**Kiểm chứng (giả thuyết H1).** Dự án cố ý dịch nhãn những lượng ngẫu nhiên đã biết, huấn luyện bằng MSE, rồi đo mức mờ thực tế. Tỉ số "đo / lý thuyết" là 1.009, 1.009, 1.007 ở σ = 4, 8, 16 ms. Lý thuyết khớp trong khoảng 1%. Hai giới hạn: chỉ đo được dải 7–23 Hz; và trên F3 thật, giả thiết "δ độc lập với dữ liệu" không đúng hoàn toàn, vì cùng một log DT sinh ra cả nhãn lẫn trục thời gian (Bài 2.2). -Mỗi anchor là một cặp (τ_k, t_k) với mô hình nhiễu pick: +### 5.3 Giải thích được "triệu chứng" của luận văn gốc + +Mô hình trong luận văn gốc (code ở `code_thesis/`) có ba đặc điểm: +- dự đoán bị trơn; +- phải thêm một loss ép phương sai dự đoán to lên (L_Var), vì dự đoán bị co biên độ; +- phải thêm bước thử dịch ±64 ms để tìm vị trí khớp nhất. + +Mệnh đề 1 cho thấy cả ba là triệu chứng của cùng một bệnh: nhãn bị lệch. Loss L_Var chỉ làm ảnh mờ "to ra", không làm nó nét lại, vì thông tin về pha đã mất. + +> **Ý chính.** Huấn luyện trên nhãn bị lệch ngẫu nhiên giống chụp ảnh khi tay run: mạng học ra một phiên bản bị làm mờ. Mức mờ tính được bằng công thức, và thí nghiệm khớp công thức. + +--- + +## Bài 6. Ý tưởng chính: đừng chọn một đáp án, hãy giữ mọi đáp án hợp lý + +### 6.1 Ví dụ đời thường + +Một giáo viên chấm bài, nhưng tờ đáp án bị in lệch dòng và không ai chắc lệch mấy dòng. +- **Cách 1 (cách phổ biến):** đoán một độ lệch, coi là đúng, chấm theo. Đoán sai thì chấm sai hết. +- **Cách 2 (ý tưởng của bài):** liệt kê mọi độ lệch hợp lý, kèm mức độ tin cậy của từng cái, dựa vào những manh mối chắc chắn (vài câu mà ta biết chắc vị trí, tương ứng với anchor) và dựa vào việc đáp án nào "trông hợp lý" nhất (tương ứng với vật lý). Rồi chấm sao cho học sinh được ghi nhận nếu trả lời khớp với **một trong các** cách căn hợp lý, có ưu tiên theo độ tin cậy. + +### 6.2 Ba bước của RML + +**RML** (*Registration-Marginalized Learning*: học có lấy tổng trên mọi phép căn chỉnh) gồm ba bước: + +1. **Mô tả độ lệch bằng xác suất.** Coi phép đổi thời gian (gọi là **warp**) là một đại lượng chưa biết. Dùng anchor và vật lý truyền sóng để tính **phân phối posterior** của nó: một tập hợp nhiều warp hợp lý, mỗi cái có trọng số (Bài 7). +2. **Dựng ngân hàng nhãn.** Mỗi warp cho ra một phiên bản nhãn porosity theo thời gian. Có 64 warp thì có 64 phiên bản nhãn (Bài 8). +3. **Huấn luyện trên cả ngân hàng.** Loss RML không bắt mạng khớp một nhãn cố định. Nó chấm mạng theo "trung bình mềm" trên mọi phiên bản (Bài 9). + +Sau khi huấn luyện xong, việc dự đoán **không cần warp nữa**: đưa seismic vào, nhận μ ± σ ra. Warp chỉ ảnh hưởng lúc học và lúc chấm điểm. + +### 6.3 Hai cách dùng posterior, và vì sao phân biệt chúng quan trọng + +Khi đã có posterior của warp, có hai cách đưa nó vào huấn luyện: +- **Cách "trung bình":** lấy warp trung bình của posterior, tạo **một** bộ nhãn duy nhất, rồi huấn luyện bình thường. Tên trong code: **B3d-Sa**. +- **Cách "ngân hàng" (RML thật sự):** giữ cả 64 phiên bản và dùng loss RML. Tên trong code: **M2-Sa**. + +Kết quả (Bài 11) cho thấy phần lớn lợi ích đến từ **việc có một posterior tốt**, tức cách "trung bình" đã thắng các phương pháp tie truyền thống. Cách "ngân hàng" chỉ giúp thêm khi posterior **rộng** (bất định lớn). Phân biệt hai cách này giúp bài báo nói đúng thứ gì tạo ra cải thiện. + +> **Ý chính.** Coi phép căn chỉnh là chưa biết, mô tả nó bằng một phân phối, rồi huấn luyện trên mọi phương án hợp lý. Cần tách bạch lợi ích từ "có posterior tốt" với lợi ích từ "học trên cả ngân hàng". + +--- + +## Bài 7. Mô tả độ lệch bằng xác suất + +Đây là bài dài nhất. Nếu chỉ cần ý chính, hãy đọc 7.1 và 7.6. + +### 7.1 Bayes trong một ví dụ + +Bạn đánh rơi chìa khoá đâu đó trên đường từ cổng vào nhà. +- **Prior** (tin gì trước khi có manh mối): chìa khoá có thể ở bất cứ đâu trên đường, nhưng hay rơi gần cửa hơn. +- **Likelihood** (manh mối giải thích được bao nhiêu): hàng xóm nói nghe tiếng leng keng ở gần gốc cây. +- **Posterior** (niềm tin sau khi kết hợp): chìa khoá nhiều khả năng ở gần gốc cây, nhưng vẫn có thể ở chỗ khác. + +Công thức: posterior ∝ likelihood × prior. Trong bài, đại lượng chưa biết là **warp** của từng giếng. Hai nguồn manh mối là **anchor** và **độ khớp synthetic–seismic**. + +### 7.2 Warp: viết độ lệch thành một hàm + +Warp là hàm biến thời gian sonic τ thành thời gian seismic thật t. Dự án viết nó thông qua tốc độ chạy tương đối của hai đồng hồ: + +$$ +\frac{dt}{d\tau} = e^{g(\tau)}, \qquad t(\tau_0) = \tau_0 + b. +$$ + +- **b**: độ dịch chung của cả giếng (đồng hồ seismic bắt đầu sớm hay muộn hơn). +- **g(τ)**: đồng hồ seismic chạy nhanh hay chậm hơn đồng hồ sonic tại từng thời điểm. g = 0.05 nghĩa là nhanh hơn khoảng 5%. Drift 66 ms trên khoảng 1000 ms ứng với g cỡ 5–6%, một mức hợp lý về vật lý. +- Vì e^g luôn dương, t luôn tăng khi τ tăng. Nghĩa là warp **không bao giờ đảo thứ tự các lớp đá**: lớp dưới không bị đẩy lên trên lớp trên. Đây là ràng buộc vật lý cài sẵn vào công thức. + +Code: [warp_prior.py](../ml_porosity/registration/warp_prior.py). + +### 7.3 Prior: những đường cong ngẫu nhiên "trông hợp lý" + +Ta cần nói trước, khi chưa thấy dữ liệu, g(τ) thường trông như thế nào. Công cụ là **Gaussian process (GP)**: một "máy sinh đường cong ngẫu nhiên". Mỗi lần rút, nó cho ra một đường cong. Hai núm điều chỉnh chính: +- **σ_g (biên độ):** đường cong dao động mạnh cỡ nào. +- **ℓ (độ dài tương quan):** hai điểm cách nhau bao xa thì coi như không liên quan. ℓ lớn cho đường cong uốn lượn chậm; ℓ nhỏ cho đường cong lắc nhanh. + +Các núm này không chọn tay mà **học từ anchor của các giếng train** (phương pháp type-II maximum likelihood: chọn giá trị làm cho các anchor quan sát được có xác suất cao nhất). Fit trên F3 cho ℓ ≈ 71 ms, σ_g ≈ 0.10. Kiểm tra bằng cách lần lượt bỏ từng anchor rồi dự đoán lại nó từ các anchor còn lại: prior không quá tự tin. + +### 7.4 Hai nguồn manh mối + +**Manh mối 1: anchor.** Mỗi anchor nói "warp phải đi qua điểm này, sai số khoảng σ_a": $$ t_k = t(\tau_k) + \varepsilon_k,\qquad \varepsilon_k\sim\mathcal N(0,\sigma_a^2). $$ -Protocol P2 dùng σ_a = 7 ms, lấy từ độ lệch robust (MAD) giữa marker và horizon tại 4 giếng F3. Anchor là thứ **ghim thời gian tuyệt đối** (Mệnh đề 2). +**Manh mối 2: vật lý (likelihood tie).** Với mỗi warp ứng viên, dựng synthetic seismogram (Bài 4.4) rồi so với trace thật tại giếng. Warp nào cho synthetic khớp hơn thì được tin hơn. Ở F3 phép so sánh này không phải xấp xỉ, vì nhãn, sonic, mật độ và trở kháng đều suy ra chính xác từ nhau (Bài 2.2). Code: [tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py). -### 5.4 Posterior warp và lấy mẫu +### 7.5 Lấy mẫu: biến posterior thành một đám warp cụ thể -[sampler.py](../ml_porosity/registration/sampler.py): -1. Tính posterior Gaussian xấp xỉ của u = [b, g] bằng Gauss–Newton quanh MAP (`laplace_posterior`). -2. Dùng nó làm "prior" cho elliptical slice sampling, với likelihood là phần sai khác giữa mô hình chính xác (e^g) và bản tuyến tính hoá, cộng ràng buộc |g| ≤ g_max. -3. Lấy S = 64 mẫu warp cho mỗi giếng (`sample_warps`). +Posterior ở đây không có công thức đóng. Cách thực tế là **lấy mẫu**: tạo ra nhiều warp cụ thể sao cho tỉ lệ xuất hiện của chúng đúng theo posterior. -Kết quả là 64 ứng viên t⁽ˢ⁾(τ), mỗi cái đi qua các anchor trong phạm vi sai số σ_a. +**Cách đầu tiên (P2) thất bại.** Ban đầu dự án làm hai bước: rút 64 warp chỉ dựa trên anchor, rồi gán trọng số theo độ khớp vật lý. Vấn đề: độ khớp vật lý quá "nhọn". Một warp chiếm gần hết trọng số, 63 warp kia gần như bằng 0. Hiện tượng này gọi là **suy biến trọng số**. Để tránh nó, quy tắc của P2 phải làm yếu likelihood vật lý đến mức gần như bỏ đi. Kết quả là posterior gần như chỉ dựa vào anchor. -### 5.5 Likelihood tie vật lý +**Cách thứ hai (từ P2r): SMC tempering.** Hình dung một đàn **1024 "hạt"**, mỗi hạt là một warp: +1. Bắt đầu: rút các hạt từ prior + anchor, chưa xét vật lý. +2. Tăng dần "liều" vật lý một chút (luỹ thừa γ đi từ 0 lên 1). +3. Ở mỗi bậc: hạt khớp tốt được nhân bản, hạt khớp kém bị bỏ, rồi mọi hạt được xê dịch ngẫu nhiên một chút để đàn không bị trùng lặp. +4. Lặp lại cho tới khi dùng đủ liều vật lý. -[tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py). Với mỗi mẫu warp, dựng synthetic từ log AI rồi so với seismic thật tại giếng: +Giống tăng dần độ khó cho một đàn thí sinh thay vì ra ngay đề khó nhất. Mức γ cuối cùng được chỉnh theo độ tự tương quan của phần dư, vì các mẫu liền kề trên trace không độc lập, nên coi chúng độc lập sẽ làm posterior quá tự tin. Code: [smc.py](../ml_porosity/registration/smc.py), bản GPU [smc_torch.py](../ml_porosity/registration/smc_torch.py). + +Hậu tố **"-Sa"** trong tên phương pháp (B3d-Sa, M2-Sa) nghĩa là dùng posterior SMC này. + +Trên dữ liệu mô phỏng, đổi sang SMC làm sai số warp giảm từ khoảng **3.3 ms xuống 0.57 ms**, trong khi phương pháp tie truyền thống tốt nhất vẫn sai khoảng 3.8–4.2 ms. + +### 7.6 Độ rộng của posterior: σ_post + +**σ_post** đo posterior còn bất định bao nhiêu (tính bằng ms). Đây là con số quan trọng nhất để hiểu kết quả: +- σ_post **nhỏ** (posterior hẹp): mọi hạt gần như trùng nhau. Ngân hàng nhãn chẳng khác gì một nhãn duy nhất, nên RML không có gì để thêm. +- σ_post **lớn** (posterior rộng): các hạt khác nhau đáng kể. Đây là nơi RML có cơ hội phát huy. + +Trên F3, với σ_a = 7 ms, σ_post khoảng 2.5–3.4 ms. Nhưng σ_a thật trên F3 không biết. Nếu coi marker là gần như chính xác (σ_a ≈ 0.4 ms) thì σ_post chỉ còn 0.56–0.64 ms. Vậy F3 nằm ở đâu đó giữa "hẹp" và "vừa". + +> **Ý chính.** Posterior của warp được dựng từ prior GP, anchor và độ khớp vật lý, rồi biểu diễn bằng một đàn hạt (SMC). Độ rộng σ_post quyết định RML có đất dụng võ hay không. + +--- + +## Bài 8. Từ mỗi warp đến một phiên bản nhãn + +Code: [labels.py](../ml_porosity/registration/labels.py). Với mỗi warp s: +1. **Đảo ngược warp** để biết mỗi thời điểm seismic t ứng với thời gian sonic nào, và do đó ứng với độ sâu nào. Phép đảo luôn làm được vì warp đơn điệu (Bài 7.2). +2. **Đọc porosity** của log tại độ sâu đó. +3. **Lọc chống alias** trước khi lấy mẫu mỗi 4 ms. Log gốc có một mẫu mỗi 15 cm. Lấy mẫu thưa đi mà không lọc trước thì các dao động rất nhanh "giả dạng" thành dao động chậm (alias). Luận văn gốc bỏ qua bước này, nên nhãn của nó bị alias. + +Kết quả cho mỗi giếng là một bảng S × 126: **S phiên bản hợp lý của nhãn** (S = 64), mỗi phiên bản có trọng số π_s. Đó là **ngân hàng nhãn** (label bank). + +> **Ý chính.** Mỗi warp hợp lý cho một phiên bản nhãn. Gom lại thành ngân hàng nhãn. + +--- + +## Bài 9. Huấn luyện mạng bằng loss RML + +### 9.1 Loss trong một câu + +Mạng xuất ra (μ, σ). Với mỗi phiên bản nhãn s, ta đo xem dự đoán khớp phiên bản đó đến đâu (ký hiệu ℓ_s, càng lớn càng khớp). Loss RML gộp các ℓ_s lại bằng một phép **"lấy tổng mềm"**: $$ -p(\mathbf s_w\mid g) = \mathcal N\big(\mathbf s_w;\ \alpha\,\mathbf W\,\mathbf r_w(g),\ \sigma_n^2\mathbf I\big). +\mathrm{RML}_\lambda = -\frac{1}{\lambda n}\log\sum_{s=1}^{S}\pi_{s}\,e^{\lambda\,\ell_{s}} . $$ -- **r_w(g):** reflectivity theo thời gian khi dùng warp g. -- **W:** tích chập với wavelet thống kê pha không lấy từ các trace giếng train, xoay thêm một pha hằng. Pha này chọn trên lưới 15° bằng marginal likelihood (`fit_phase`). -- **α ≥ 0:** hệ số biên độ. α và σ_n được "profile" (thay bằng giá trị tối ưu), nên log p = −(n/2)·log RSS. -- **Trọng số:** π_s ∝ p_s^γ. Trong protocol P2, γ là giá trị lớn nhất sao cho ESS ≥ S/4 (`temper`). +*Đọc bằng lời:* phiên bản nào khớp tốt (ℓ_s lớn) và đáng tin (π_s lớn) thì chiếm phần lớn tổng. Mạng được thưởng nếu dự đoán khớp **tốt với ít nhất vài phiên bản hợp lý**. Nó không bị buộc phải khớp một phiên bản cố định. Loss được tính trên từng cửa sổ con 64 mẫu, nên mỗi đoạn của giếng được "chọn" phiên bản riêng. Code: [rml.py](../ml_porosity/losses/rml.py), hàm `bank_loss`. -Có hai biến thể: -- **M1:** chỉ dùng anchor, π_s đều. -- **M2:** anchor + trọng số vật lý. Đây là phương pháp chính. +### 9.2 Núm λ: từ "trung bình" đến "chọn cái khớp nhất" -Chẩn đoán sau G-B (mục 10.3) thay bước trọng số này bằng **SMC tempering** ([smc.py](../ml_porosity/registration/smc.py); bản GPU ở [smc_torch.py](../ml_porosity/registration/smc_torch.py)), với γ chọn theo tự tương quan của phần dư. +- **λ → 0:** loss trở thành trung bình đều trên mọi phiên bản. Mạng học nhãn trung bình, đúng là ảnh mờ của Bài 5. Không tốt. +- **λ → ∞:** loss chỉ nhìn phiên bản khớp nhất. Mạng có thể "chọn" căn chỉnh để khớp cả nhiễu. Cũng không tốt. +- **Mặc định λ = 1/τ_c**, trong đó τ_c là độ dài tương quan của nhãn trong băng seismic, đo bằng số mẫu (trên dữ liệu mô phỏng, τ_c ≈ 2.7 nên λ ≈ 0.37). Lý do: 64 mẫu liền kề không mang thông tin bằng 64 quan sát độc lập, nên phải "giảm liều". Đây là một **quy tắc kinh nghiệm (heuristic)**, không phải định lý. -### 5.6 Ngân hàng nhãn (label bank) +**Gradient** của loss có một cách hiểu đẹp: nó bằng loss Gaussian thường, nhưng mỗi phiên bản nhãn được nhân với trọng số softmax(log π_s + λℓ_s). Mạng tự nghiêng về những căn chỉnh khớp với điều nó đang học từ các giếng khác, nhưng bị kìm bởi trọng số π và bởi λ. Giống một bước của thuật toán EM. -[labels.py](../ml_porosity/registration/labels.py). Với mỗi mẫu warp s: -1. Đảo ngược t⁽ˢ⁾(τ) để được τ⁽ˢ⁾(t). Phép đảo tồn tại vì warp đơn điệu. -2. Đọc log porosity tại đó: +### 9.3 Các phương pháp cũ là trường hợp đặc biệt -$$ -y^{(s)}(t_i) = (\mathcal A\varphi)\big(\tau^{(s)}(t_i)\big). -$$ - -- **𝒜** là bộ lọc thông thấp chống alias trước khi lấy mẫu 4 ms. Luận văn nội suy thẳng log bước 0.15 m xuống 4 ms nên nhãn bị alias; bước này sửa lỗi đó. -- Mẫu warp nào không phủ hết cửa sổ chính thì nhận trọng số 0. - -Kết quả cho mỗi giếng là một ma trận (S × L): S phiên bản hợp lý của nhãn, kèm trọng số π_s. - -### 5.7 Loss RML - -[rml.py](../ml_porosity/losses/rml.py), hàm `bank_loss`. Với giếng w, cửa sổ con j (n = 64 mẫu) và ứng viên s, độ khớp của ứng viên s với dự đoán (μ, σ) là - -$$ -\ell_{wjs} = \sum_{i\in j}\log\mathcal N\big(y^{(s)}_{w,i};\ \mu_i,\ \sigma_i^2\big). -$$ - -Loss là trung bình theo (w, j) của - -$$ -\mathrm{RML}_\lambda = -\frac{1}{\lambda n}\log\sum_{s=1}^{S}\pi_{ws}\,e^{\lambda\,\ell_{wjs}} . -$$ - -**Đọc bằng lời:** trong mỗi cửa sổ, mạng không bị buộc phải khớp một nhãn cố định. Nó được chấm theo "trung bình mềm" trên mọi nhãn hợp lý, có trọng số theo độ tin cậy π của từng căn chỉnh. - -**λ điều khiển độ "mềm":** -- **λ → 0:** RML bằng NLL trung bình theo π. Nghiệm μ là nhãn trung bình, tức đúng target bị làm mờ của Mệnh đề 1. -- **λ → ∞:** RML chỉ nhìn ứng viên khớp nhất (hard-min). Mạng có thể chọn căn chỉnh để khớp nhiễu. -- **λ = 1/τ_c** (mặc định): - - τ_c = 1 + 2Σ_k ρ(k)² là độ dài tương quan (tính bằng số mẫu) của nhãn train đã lọc thông cao trên 6 Hz. - - Nó hiệu chỉnh việc 64 mẫu tương quan chứa ít thông tin hơn 64 quan sát độc lập (mục 4.6). - - Trên lưới D2: τ_c ≈ 2.7 mẫu, λ ≈ 0.37. - - Đây là **heuristic**, không phải định lý (theory §3). - -**Gradient** của RML là NLL có trọng số: mỗi ứng viên s nhận trọng số r_s = softmax(log π_s + λℓ_s) (theory, Bổ đề 3). Mạng tự nghiêng về những căn chỉnh khớp với dự đoán hiện tại, nhưng bị kìm bởi prior π và bởi λ. Giống một bước EM. - -### 5.8 Dự đoán và bất định - -- Lúc dự đoán **không cần warp**: input seismic, output (μ, σ). Registration chỉ tác động lúc huấn luyện (nhãn sắc hơn, σ không phải "gánh" sai số căn chỉnh) và lúc đánh giá. -- Bất định tổng: σ² của head cộng phương sai giữa 5 thành viên ensemble (M2-ens). - -### 5.9 Các baseline là trường hợp riêng của RML - -Bảng này biến ablation thành một con đường đi từ mô hình cũ tới RML (chứng minh ở theory §4, mỗi bổ đề có test trong [tests/test_losses.py](../tests/test_losses.py)): +Một điểm mạnh về lý thuyết: nhiều phương pháp có sẵn là RML với một lựa chọn cụ thể cho "ngân hàng" và λ (chứng minh ở [theory.md](theory.md) §4, kiểm bằng test trong [test_losses.py](../tests/test_losses.py)): | Phương pháp | Tương ứng trong RML | | --- | --- | -| Tie điểm rồi hồi quy (B3) | S = 1. RML suy biến thành Gaussian NLL (Bổ đề 1) | -| Hard-min shift của luận văn (B4a) | bank = nhãn dịch ±8 mẫu, π đều, λ = ∞ (Bổ đề 2, 4) | -| Soft-min theo bulk shift (B4b) | như trên với λ hữu hạn | -| Soft-DTW (B4c) | bank = mọi đường căn chỉnh đơn điệu trong dải, π đều, λ = 2/γ = 20 (Bổ đề 5) | -| **RML (M1, M2)** | bank = mẫu posterior warp có anchor (+ trọng số vật lý), λ = 1/τ_c | +| Tie một lần rồi huấn luyện (B3) | Ngân hàng chỉ có 1 phiên bản | +| Thử dịch ±64 ms rồi lấy cái khớp nhất (luận văn, B4a) | Ngân hàng = các bản dịch, trọng số đều, λ = ∞ | +| Soft-DTW (B4c) | Ngân hàng = mọi đường căn chỉnh co giãn trong một dải, trọng số đều, λ hữu hạn | +| **RML (M2-Sa)** | Ngân hàng = các hạt posterior có anchor và vật lý | -Khác biệt cốt lõi giữa RML và các loss căn chỉnh chung không nằm ở "min hay soft-min". Nó nằm ở **bank đến từ đâu**: posterior có anchor và vật lý, hay mọi dịch chuyển đều được phép như nhau. +Vậy RML khác các loss căn chỉnh khác **không phải ở công thức "min" hay "soft-min"**, mà ở chỗ **ngân hàng đến từ đâu**: một posterior có anchor và vật lý, hay "mọi kiểu dịch đều được phép như nhau". + +### 9.4 Vì sao bắt buộc phải có anchor (Mệnh đề 2) + +Thử nghĩ: nếu dịch **cả** dự đoán của mạng **lẫn** mọi warp đi cùng một lượng β, loss gần như không đổi. Mạng dùng chung cho mọi giếng, mà mạng tích chập gần như không phân biệt "sớm hơn 5 ms" hay "muộn hơn 5 ms". Giống hai người khiêng một cái thang: cùng bước sang trái một bước thì thang vẫn nằm ngang, không ai biết họ đã dịch. + +Khi đó loss có một "sống núi phẳng" theo β, và lời giải trôi dạt tuỳ ý. Chỉ có thứ gì đó cố định thời gian tuyệt đối mới chặn được trôi dạt này. **Anchor làm đúng việc đó.** Với 4 giếng × 16 anchor và σ_a = 7 ms, độ bất định còn lại của β chỉ khoảng 0.9 ms. + +Hệ quả: soft-DTW, DILATE và loss "thử dịch rồi lấy cái khớp nhất" đều **không có anchor**, nên chúng rơi đúng vào trường hợp sống núi phẳng. + +**Kiểm chứng (giả thuyết H4).** Bỏ anchor đi làm sai số warp tăng từ khoảng 3 ms lên 31–33 ms, và sai số dự đoán trong băng seismic tăng gần gấp đôi. Giả thuyết "anchor là cần thiết" không bị bác bỏ. + +> **Ý chính.** RML chấm mạng theo "tổng mềm" trên ngân hàng nhãn, có núm λ. Nhiều phương pháp cũ là trường hợp đặc biệt của nó. Anchor là bắt buộc, vì không có anchor thì mạng và căn chỉnh có thể cùng trôi mà loss không phát hiện. --- -## 6. Lý thuyết (tóm tắt trực giác) +## Bài 10. Làm sao biết phương pháp có tốt thật? -Chứng minh đầy đủ ở [theory.md](theory.md). +### 10.1 Ba bộ dữ liệu, ba vai trò -### 6.1 Mệnh đề 1: blur +| Bộ | Là gì | Vì sao cần | +| --- | --- | --- | +| **D1: F3** | Khối seismic thật ở phần Hà Lan của Biển Bắc, 4 giếng thẳng | Dữ liệu thật chính. Nhưng không bao giờ biết warp đúng, và nhãn là sonic đổi đơn vị | +| **D2: synthetic** | Dữ liệu mô phỏng dựng theo F3 (địa tầng, rock physics, wavelet, thống kê drift) | "Phòng thí nghiệm": biết warp thật, nên đo được chính xác sai số warp, và có nhiều giếng | +| **D3: Volve** | Mỏ thứ hai ở phần Na Uy của Biển Bắc, 6 giếng nghiêng | Porosity tính từ mật độ–neutron, độc lập với sonic. Kiểm tra xem kết quả có phụ thuộc vào đặc thù của F3 không | -- **Giả thiết:** độ lệch δ độc lập với seismic và nhãn. -- **Kết luận:** predictor tối ưu theo MSE với nhãn lệch là predictor đúng m(t) = E[y | X] **tích chập với phân phối của δ**: +**Các núm của D2:** +- **c**: hệ số nhân độ lớn drift. c = 0 là không lệch; **c = 1 là lệch giống F3**; c = 2 là lệch gấp đôi. +- **N**: số giếng train (4 hoặc 16). +- **Regime**: chất lượng dữ liệu, gồm tỉ số tín hiệu/nhiễu (SNR) của seismic và mật độ anchor. Ví dụ **R10** = SNR 10 dB, đủ anchor (posterior hẹp); **Rm5** = SNR −5 dB, đủ anchor (gần F3 nhất); **R10tb** = chỉ có anchor ở đỉnh và đáy (posterior rộng). +- **Realization**: một lần sinh ngẫu nhiên một "trái đất" mô phỏng. Realization 900 và 901 chỉ dùng để thiết kế (dev), không bao giờ dùng làm kết quả. +- **Oracle**: mô hình học trên nhãn với warp **thật**. Chỉ có trên D2. Đây là trần tham chiếu, không phải đối thủ. -$$ -\hat y^\star(t) = \int p(d)\,m(t+d)\,dd, -\qquad -\delta\sim\mathcal N(\mu_\delta,\sigma^2)\ \Rightarrow\ |P(f)| = e^{-2\pi^2\sigma^2 f^2}. -$$ +### 10.2 Các đối thủ -**Hai hệ quả.** -1. Std ratio (độ lệch chuẩn dự đoán chia độ lệch chuẩn nhãn) và PCC trong băng seismic bị chặn trên bởi các hàm của P(f). -2. Loss khớp phương sai (L_Var) chỉ kéo được *biên độ tổng* về đúng. Nó không khôi phục được phần kết hợp pha đã mất. Tức là dự đoán to ra nhưng vẫn mờ. +Mọi phương pháp mạng dùng **cùng mạng, cùng input, cùng cách tối ưu**. Chúng chỉ khác nhau ở nhãn và loss. Cách so như vậy đảm bảo khác biệt đến từ cách xử lý căn chỉnh, không phải từ mạng to hay nhỏ. -**Kiểm chứng (H1).** Huấn luyện MSE với độ lệch δ biết trước, rồi đo hàm truyền thực tế. Tỉ số đo/lý thuyết r(σ) = 1.009, 1.009, 1.007 ở σ = 4, 8, 16 ms, và 1.093 ở 32 ms. Ngưỡng bác bỏ đã đăng ký trước là [0.5, 2], nên mệnh đề **không bị bác bỏ**. Hai giới hạn: -- Chỉ kiểm được dải 7–23 Hz. -- Ở F3 thật, giả thiết độc lập không đúng chặt, vì cùng log DT sinh ra cả nhãn lẫn trục thời gian. +| Tên | Dễ hiểu là | Trả lời câu hỏi | +| --- | --- | --- | +| B0a | Đường xu hướng theo thời gian, không dùng seismic | Seismic có thêm được gì ngoài xu hướng? | +| B0b | Hồi quy/rừng ngẫu nhiên trên các thuộc tính seismic | Baseline học máy nông | +| B1 | Nghịch đảo trở kháng cổ điển rồi đổi sang porosity | Baseline địa vật lý chuẩn | +| B2 | Mạng của luận văn với 6 loss gốc, pipeline đã sửa lỗi | Nối tiếp luận văn | +| B3a, B3b, B3c, B3c-R | Tie một lần theo các cách khác nhau, từ thô (B3a) đến tốt nhất có dùng seismic (B3c, B3c-R) | Đối thủ "tie điểm" | +| B3d | Một nhãn từ warp trung bình của posterior cũ (P2) | | +| **B3d-Sa** | Một nhãn từ warp trung bình của **posterior SMC** | Chỉ cần posterior tốt là đủ? | +| B4a–d | Nhãn B3b + loss chịu lệch: thử dịch, soft-min, soft-DTW, DILATE | Loss chịu lệch không cần anchor có đủ không? | +| B5 | Ensemble 5 seed của B3b | Bất định tốt hơn có phải chỉ nhờ ensemble? | +| M1, M2 | RML trên posterior cũ (P2) | | +| **M2-Sa** | RML trên ngân hàng 64 hạt SMC | **Phương pháp chính** | -### 6.2 Mệnh đề 2: nhận dạng (vì sao cần anchor) +### 10.3 Luật chơi chống "gian lận vô tình" -Nếu dịch *cùng lúc* đầu ra của mạng thêm β và mọi warp thêm β, loss không đổi, trừ hiệu ứng biên. Lý do: mạng dùng chung cho mọi giếng và gần như bất biến với phép dịch. Vậy nếu không có gì ghim thời gian tuyệt đối, mục tiêu có một "sống núi" (ridge) phẳng theo β và nghiệm không xác định. +Với ít giếng và nhiều lựa chọn, rất dễ vô tình chọn đúng cấu hình làm kết quả đẹp. Dự án dùng bốn hàng rào: -- **Anchor** thêm độ cong ΣK_w/σ_a² theo β. Độ bất định còn lại của dịch chung là +1. **Giếng mù là mù thật.** Giếng test chỉ dùng để chấm điểm. Không dùng log, marker hay bất cứ thông tin nào của nó cho tie, cho huấn luyện, cho việc chọn số bước huấn luyện, hay để dịch dự đoán cho khớp. +2. **Thước đo cố định.** Đáp án dùng để chấm là nhãn theo TDR "sonic hiệu chỉnh bằng marker", chốt trước khi huấn luyện bất kỳ mô hình nào. Không bao giờ đổi sang thước đo khác vì nó cho điểm đẹp hơn. +3. **Đăng ký trước (pre-registration).** Trước mỗi đợt chạy chính, giả thuyết, cách đo và **ngưỡng đạt/trượt** được ghi vào một file protocol (`configs/protocol*.yaml`), rồi khoá bằng mã băm SHA-256. Script từ chối chạy nếu file bị sửa. Giống niêm phong luật chấm thi trước khi mở đề. Muốn đổi luật thì phải tạo protocol mới và ghi rõ là đã đổi (gọi là **deviation**). +4. **Thống kê trung thực.** Báo cáo từng giếng trước rồi mới lấy trung bình. Không tính p-value trên từng mẫu thời gian như thể chúng độc lập. -$$ -\operatorname{sd}(\beta) \approx \Big(\frac{\sum_w K_w}{\sigma_a^2}+\frac{N}{\sigma_b^2}\Big)^{-1/2}\approx\frac{\sigma_a}{\sqrt{\sum_w K_w}} . -$$ +### 10.4 Đo bằng gì -- **Ví dụ.** 4 giếng × 16 anchor với σ_a = 7 ms cho sd(β) ≈ 0.9 ms. Chỉ có prior σ_b = 50 ms với N = 16 giếng thì sd(β) ≈ 12.5 ms. Ở 20 Hz, mức đó đủ làm hệ số cos(2πfβ) về 0. -- **Hệ quả cho B4a–d.** Các loss căn chỉnh chung không có anchor. Chúng rơi đúng vào trường hợp ridge: mạng và căn chỉnh có thể cùng trôi mà loss không phạt. -- **Likelihood tie** về nguyên tắc ghim được thời gian, vì seismic quan sát trên trục cố định. Nhưng một phép dịch nhỏ gần như đánh đổi được với pha hằng của wavelet, nên thông tin về β chỉ đến từ *độ rộng băng*. +| Nhóm | Thước đo | Ý nghĩa | +| --- | --- | --- | +| Độ chính xác | RMSE (p.u.), PCC (tương quan) | Sai bao nhiêu, đúng hình dạng không | +| Theo băng | **RMSE băng seismic** (≥ 6 Hz) | Thước đo quyết định: đúng phần mà lệch thời gian phá hỏng | +| Biên độ | std ratio = độ lệch chuẩn dự đoán / của nhãn | Nhỏ hơn 1 nghĩa là dự đoán bị co, dấu hiệu bị mờ | +| Bất định | **Coverage** 80/90%, CRPS, NLL | Khoảng tin cậy 90% có chứa giá trị thật khoảng 90% số lần không | -**Kiểm chứng (H4).** Bỏ anchor (chỉ còn vật lý) làm sai số warp tăng từ khoảng 3 ms lên khoảng 31–33 ms và RMSE băng tăng gần gấp đôi. Giả thuyết "anchor là cần thiết" **không bị bác bỏ**. +### 10.5 Cổng go/no-go -### 6.3 Phạm vi của lý thuyết +Dự án chia thành các pha. Cuối mỗi pha có một **cổng** với ngưỡng chốt trước. Ngưỡng **không bao giờ đổi**; chỉ ngày có thể đổi. -- **Đã chứng minh dưới giả thiết nêu rõ:** Mệnh đề 1, 2 và Bổ đề 1–5. -- **Heuristic:** λ = 1/τ_c. -- **Chưa làm:** chẩn đoán strain energy của warp; tính nhất quán của estimator; RML-EM (M3). +| Cổng | Câu hỏi | +| --- | --- | +| G-A | Baseline có tái lập được không? | +| G-B | Trên D2 ở drift giống F3, M2 có hơn đối thủ tốt nhất ít nhất 10% RMSE băng (hoặc +0.05 PCC băng) không, và không thua quá 2% khi không có drift? | +| G-C | Trên F3: M2-Sa có hơn đối thủ ở ít nhất 3/4 giếng, **và** coverage 80/90% có nằm trong ±5% của mức danh nghĩa không? | +| G-D | Trên Volve: báo cáo kết quả theo chiều nào cũng được, và giới hạn claim theo kết quả | + +> **Ý chính.** Synthetic cho biết phương pháp có hoạt động khi biết đáp án không; field cho biết nó có dùng được trong thực tế không. Mọi luật chấm được niêm phong trước khi chạy. --- -## 7. Dữ liệu: ba lớp bằng chứng +## Bài 11. Câu chuyện kết quả, theo thứ tự thời gian -### 7.1 D1: F3 Demo 2023 (field chính) +### 11.1 P0–P1 (26/10): dọn nhà và dựng lại baseline -- Khối F3 ở phần Hà Lan của Biển Bắc, bản demo công khai của dGB/OpendTect. -- 4 giếng thẳng đứng: F02-1, F03-2, F03-4, F06-1. -- Cửa sổ chính 600–1100 ms. -- Mỗi giếng có 9–11 anchor trong cửa sổ chính (14–17 trong cửa sổ mở rộng 400–1300 ms). - -**Audit dữ liệu phát hiện các lỗi khiến kết quả luận văn không dùng được làm mốc** (plan §1.1–1.2): -- Toạ độ giếng trong code sai 5–11 km. Mọi trace "tại giếng" thực ra không nằm ở giếng. -- TWT tích phân từ DT không hiệu chỉnh drift: lệch 14–66 ms so với marker. +Kiểm tra code và dữ liệu của luận văn gốc phát hiện nhiều lỗi khiến kết quả cũ **không dùng làm mốc được**: +- Toạ độ giếng sai 5–11 km: trace "tại giếng" thực ra không nằm ở giếng. +- Không hiệu chỉnh drift, nên lệch 14–66 ms. - Giếng validation cũng là giếng train. -- Chỉ có 2 chuỗi huấn luyện. - Nhãn bị alias. -- MSE 0.015 được báo cáo thực ra ứng với R² ≈ −9.8: tệ hơn đoán hằng số. -- Nhãn PHIE là hàm tuyến tính của sonic ở 3/4 giếng (mục 4.2). +- MSE 0.015 được báo cáo thực ra ứng với R² ≈ −9.8, tức tệ hơn đoán một hằng số. -Vì vậy mọi baseline được dựng lại từ đầu (pha P1). +Mọi baseline được dựng lại. Kết quả LOWO trên F3 (trung bình 4 giếng): -### 7.2 D2: synthetic hiệu chỉnh theo F3 (nơi biết đáp án) - -Trên dữ liệu thật không bao giờ biết warp đúng. D2 tạo dữ liệu mô phỏng mà warp thật được biết, để đo trực tiếp ([synth_d2.py](../ml_porosity/data/synth_d2.py), cấu hình [d2_synth.yaml](../configs/d2_synth.yaml)). - -**Cách sinh.** -- **Earth model:** khung địa tầng từ 5 horizon thật của F3. Porosity = trend + offset theo đơn vị địa tầng + trường ngẫu nhiên (các quá trình OU). -- **Rock physics** đúng như F3: porosity → DT → RHOB → AI. -- **Seismic:** tích chập với wavelet F3, cộng nhiễu băng hạn SNR 10 dB. -- **Warp thật:** rút từ prior GP fit trên anchor F3, nhân hệ số **c ∈ {0, 0.5, 1, 2}**. c = 0 là không lệch; **c = 1 là mức drift giống F3**. -- **Anchor:** đặt tại biên các đơn vị địa tầng, có nhiễu pick σ_a = 7 ms. - -**Lưới thí nghiệm chính của P2.** -- 8 realization (lần sinh ngẫu nhiên earth model) × 4 giá trị c × **N ∈ {2, 4, 8, 16}** giếng train, tổng 128 ô. -- 8 giếng test cố định cho mỗi realization, cách mọi giếng khác ≥ 1 km. -- Realization 900 và 901 chỉ dùng để chọn ngân sách bước huấn luyện, không bao giờ dùng cho kết quả. -- **Oracle:** mô hình huấn luyện trên nhãn với warp *thật*. Chỉ có được trên synthetic; là trần tham chiếu, không phải đối thủ. - -### 7.3 D3: Volve (field thứ hai, chưa chạy) - -- Mỏ Volve ở phần Na Uy của Biển Bắc, dữ liệu Equinor công bố theo giấy phép CC BY-NC-SA 4.0. -- Vai trò: porosity ở đây (PHIF) tính từ density–neutron, **độc lập với sonic**. Nó phá vỡ cấu trúc "nhãn = hàm của DT" của F3. -- Đã kiểm kê: 10 giếng có marker TWT, cube post-stack ST10010 đã tải và QC. -- Thí nghiệm dự kiến ngày 28–29/10/2026 (pha P4). - -Ngoài ra, dữ liệu **NLOG** (cổng dữ liệu dầu khí Hà Lan) được dùng để kiểm tra nhãn F3 bằng RHOB đo thật (`scripts/08_d1_label_check.py`). - ---- - -## 8. Các phương pháp được so sánh - -Mọi phương pháp mạng dùng **cùng backbone, cùng input, cùng optimizer và cùng cách chọn ngân sách**. Chúng chỉ khác nhau ở nhãn và loss. - -| ID | Mô tả dễ hiểu | Trả lời câu hỏi | -| --- | --- | --- | -| B0a | Đường xu hướng nén chặt theo thời gian, không dùng seismic | Seismic có thêm gì ngoài trend? | -| B0b | Ridge / random forest / GBM trên các attribute seismic (biên độ, envelope, pha và tần số tức thời, relative AI, TWT) | Baseline ML nông nhưng mạnh | -| B1 | Inversion AI cổ điển (PyLops) với LFM từ giếng train, rồi φ = a + b·AI | Baseline địa vật lý mà reviewer sẽ hỏi | -| B2 | CNN–GRU với 6 loss gốc của luận văn, pipeline đã sửa | Nối tiếp luận văn | -| B3a | Tie điểm kiểu luận văn: neo tại anchor nông nhất, không hiệu chỉnh drift | | -| B3b | Tie điểm marker-calibrated sonic | Tie "chuẩn ngành" | -| B3c | B3b + dịch cục bộ theo tương quan synthetic–seismic (như tie thủ công) | Tie điểm tốt nhất có dùng seismic | -| B3d | Một nhãn duy nhất từ warp trung bình có trọng số của posterior M2 | Dùng posterior nhưng không marginalize | -| B4a–d | Nhãn B3b + loss căn chỉnh chung: hard-min shift, soft-min shift, soft-DTW, DILATE | Có cần anchor/vật lý không, hay loss chịu lệch là đủ? | -| B5 | Ensemble 5 seed của B3b | Calibration tốt lên là nhờ mô hình registration hay chỉ nhờ ensemble? | -| **M1** | RML, bank 64 mẫu warp posterior theo anchor, trọng số đều | | -| **M2** | RML, như M1 + trọng số tie vật lý | **Phương pháp chính** | -| M2-ens | Ensemble 5 seed của M2 | So với B5 cho calibration (H3) | -| M3 | RML-EM: cập nhật cả π trong lúc huấn luyện | Hoãn | -| Oracle | Nhãn với warp thật (chỉ D2) | Trần tham chiếu | - ---- - -## 9. Đánh giá - -### 9.1 Nguyên tắc chống "gian lận vô tình" - -- **Blind well:** giếng test chỉ dùng để chấm điểm. Không dùng DT, RHOB, PHIE hay marker của nó cho huấn luyện, tie, chọn hyperparameter, chọn checkpoint hay dịch hậu kiểm. -- **Tham chiếu chấm điểm cố định:** marker-calibrated sonic, chốt trước khi huấn luyện bất kỳ mô hình nào. Độ nhạy của chính phép chấm được báo cáo bằng cách chấm lại với TDR `.wlt`. Không bao giờ chọn tham chiếu "đẹp nhất". -- **Pre-registration:** - - Protocol, metric và ngưỡng ghi trong [protocol.yaml](../configs/protocol.yaml) (P1) và [protocol_p2.yaml](../configs/protocol_p2.yaml) (P2). - - Mỗi file được khoá bằng SHA-256 trước khi chạy. Script chính từ chối chạy nếu hash không khớp. - - Đổi protocol thì phải tạo version mới. -- **Thống kê trung thực:** báo cáo từng giếng rồi mới trung bình. Không tính p-value trên từng mẫu thời gian như thể chúng độc lập. Sức mạnh thống kê chủ yếu đến từ D2 (bootstrap theo realization). - -### 9.2 Metric ([metrics.py](../ml_porosity/eval/metrics.py)) - -| Nhóm | Metric | Ý nghĩa | -| --- | --- | --- | -| Độ chính xác | RMSE, MAE (p.u.), PCC, R², skill so với B0a | Sai bao nhiêu, đúng hình dạng không | -| Theo băng | RMSE và PCC riêng ở băng thấp (< 6 Hz) và **băng seismic** (≥ 6 Hz) | Seismic có thực sự đóng góp không, hay chỉ có trend | -| Biên độ | std ratio, tỉ số phổ | Kiểm tra trực tiếp hiện tượng blur | -| Calibration | Gaussian NLL, **CRPS**, **coverage** 50/80/90/95% | Khoảng tin cậy 90% có thực sự chứa giá trị thật 90% số lần không | -| Registration | RMSE warp (ms) và coverage 90% của warp (chỉ D2); z-score leave-one-anchor-out (F3) | Bất định của chính warp có đáng tin không | - -**Metric quyết định** của gate G-B là **RMSE trong băng seismic**, vì đó là phần misregistration phá hỏng (mục 2.2). - -### 9.3 Giả thuyết và cổng go/no-go - -| | Giả thuyết | Bác bỏ nếu | -| --- | --- | --- | -| H1 | MSE trên nhãn lệch σ_δ cho dự đoán bị làm mờ đúng như exp(−2π²σ²f²) | Tỉ số đo/lý thuyết ngoài [0.5, 2] | -| H2 | RML tốt hơn tie điểm tốt nhất và loss căn chỉnh chung khi misregistration ≳ 1/8 chu kỳ; ngang bằng khi tie đã tốt | Không có gain so với B3 tốt nhất trong vùng drift thực tế | -| H3 | Khoảng dự đoán của RML calibrate tốt hơn cùng backbone + cùng UQ nhưng không mô hình registration | Coverage chỉ tốt lên nhờ khoảng rộng ra | -| H4 | Không có anchor thì warp và mạng bù trừ nhau; anchor là cần thiết | Bỏ anchor mà kết quả tương đương | - -Lộ trình nén (chốt 27/10/2026): xong toàn bộ bài trước thứ 7, 31/10/2026. Có 4 cổng: -- **G-A** (26/10, đã đánh giá): baseline tái lập được. -- **G-B** (26/10, đã đánh giá, không đạt): M2 hơn đối thủ tốt nhất trên D2 ít nhất 10% RMSE băng (hoặc +0.05 PCC băng) ở c = 1, và không kém quá 2% khi c = 0. -- **G-C** (cuối 28/10): kết quả F3 nhất quán với synthetic. -- **G-D** (cuối 29/10): field thứ hai. - -Sau đó viết bài 29–30/10 (draft v1, v2), review và nộp ngày 31/10. Lịch chi tiết và thứ tự cắt phạm vi nếu trễ ở plan §6. - -Trượt cổng thì chẩn đoán có thời hạn rồi chuyển hướng theo luật đã viết trước (plan §9). - ---- - -## 10. Kết quả hiện tại (đến 26/10/2026) - -### 10.1 P1: baseline trên F3 (LOWO 4 giếng, 5 seed) - -Nhãn PHIE_DT, tham chiếu calibrated, trung bình 4 giếng ([outputs/p1/summary.md](../outputs/p1/summary.md)): - -| | B0a (trend) | B0b-ridge | B1 (inversion) | B2 (luận văn) | B3a | B3b | +| | B0a (xu hướng) | B0b-ridge | B1 | B2 (luận văn) | B3a | B3b | | --- | --- | --- | --- | --- | --- | --- | | RMSE (p.u.) | **2.48** | 2.58 | 3.60 | 3.07 | 2.93 | 2.82 | | PCC băng seismic | −0.13 | **0.24** | −0.02 | 0.15 | −0.02 | 0.15 | -Đọc kết quả: -- Với 3 giếng train, **không mô hình nào thắng đường trend về RMSE tổng**. -- Tương quan trong băng seismic yếu ở mọi phương pháp (≤ 0.24). -- Tie tốt hơn (B3b so với B3a) giúp rõ rệt. -- Khoảng tin cậy của B3 quá hẹp: coverage 90% chỉ khoảng 0.17. +**Điều rút ra:** với 3 giếng train, **không mô hình nào thắng đường xu hướng đơn giản** về RMSE tổng. Tương quan trong băng seismic yếu ở mọi phương pháp. Tie tốt hơn (B3b so với B3a) có giúp. -G-A: điều kiện chuyển hướng không thoả, nên sang P2. +### 11.2 P2 (26/10): lần thử đầu trên synthetic, trượt cổng G-B -### 10.2 P2: lưới D2 chính (protocol đã khoá) +- Ở c = 1, M2 chỉ ngang ngửa đối thủ tốt nhất (tỉ số RMSE băng 0.985–1.045; cần ≤ 0.90). 0/4 ô đạt. +- Ở c = 0, M2 thua 3.9% (giới hạn 2%). +- Điểm đáng chú ý: so với tie chuẩn B3b, M2 vẫn giảm RMSE băng 12–28%. Các loss chịu lệch (B4) không giúp, đúng như Mệnh đề 2 dự đoán. +- **H3 bị bác:** bất định của M2 không tốt hơn ensemble thường. Với ít giếng, mọi mạng tự học σ đều làm σ quá nhỏ vì học thuộc nhãn train. -**G-B không đạt.** -- Ở c = 1, tỉ số RMSE băng M2 / đối thủ tốt nhất là 0.985–1.045. Đối thủ tốt nhất là B3c hoặc B3d. 0/4 ô đạt. -- Ở c = 0, M2 kém B3d 3.9%, vượt ngưỡng 2%. +**Chẩn đoán** (chỉ trên realization dev): nút thắt không nằm ở loss mà ở **posterior**. Trọng số vật lý suy biến (Bài 7.5), nên posterior gần như chỉ dựa vào anchor. Thay bằng SMC thì sai số warp giảm từ 3.3 xuống 0.57 ms. -Những điểm vẫn đáng chú ý: -- So với tie chuẩn B3b, M2 giảm RMSE băng 12–28% ở c = 1. -- Các loss căn chỉnh chung không giúp: B4c/B4d chỉ ngang B3b, còn B4a/B4b kém hơn rõ. Điều này nhất quán với Mệnh đề 2. +### 11.3 P2r (27/10): chạy lại với posterior SMC, có ghi rõ deviation -**Các giả thuyết.** -- H1 **không bị bác** (mục 6.1). -- H3 **bị bác**: M2-ens calibrate kém hơn B5. Ở chế độ ít giếng, mọi loss có σ học được đều làm σ co lại vì mạng nhớ nhãn train. -- H4 **không bị bác** (mục 6.2). +Vì P2 đã trượt, kết luận G-B **giữ nguyên**. P2r là một **protocol mới** ([protocol_p2r.yaml](../configs/protocol_p2r.yaml)), thiết kế sau khi thấy P2 trượt và chỉ dựa trên dữ liệu dev. Nó chạy trên realization mới (8–15). Bài báo phải ghi rõ điều này trong phần Methods. -### 10.3 Chẩn đoán sau G-B (chỉ trên realization dev, chưa khoá) +P2r tách câu hỏi chính làm hai: -**Nút thắt là posterior warp, không phải loss.** -- Trọng số vật lý của M2 quá nhọn: ESS ở γ = 1 chỉ ≈ 1/64. Quy tắc ESS ≥ S/4 vì vậy ép γ xuống 0.02–0.11, và mẫu warp gần như không mang thông tin seismic. -- Thay bằng SMC tempering (γ theo tự tương quan phần dư, pha ước lượng lại), sai số warp ở c = 1 giảm từ khoảng 3.3 ms xuống khoảng 0.57 ms. B3c vẫn ở 3.8–4.2 ms. -- Nhãn từ posterior SMC cho kết quả gần Oracle: RMSE băng thấp hơn B3c 22–23% ở c = 1. +**H2a: chỉ cần posterior tốt có đủ không?** So B3d-Sa (một nhãn từ warp trung bình SMC) với tie điểm tốt nhất. **Đạt** ở cả ba regime đủ anchor (R10, R0, Rm5). Ví dụ R10 ở c = 1: RMSE băng bằng 0.857 lần (N = 4) và 0.782 lần (N = 16) của đối thủ, tức giảm khoảng 14–22%. -**Marginalize trên bank chưa thêm được gì.** So với đối thủ dùng *cùng posterior* nhưng chỉ lấy một nhãn trung bình (B3d-S), M2-S không thắng (tỉ số 0.92–1.03). Điều này khớp Mệnh đề 1: posterior hẹp (độ rộng 90% chỉ 0.9–2.9 ms ở c ≤ 1), nên các ứng viên trong bank gần như trùng nhau và trung bình trên bank không làm mờ đáng kể. +Cần đọc kỹ: B3d-Sa đã thắng tie điểm ngay cả khi **không có drift** (c = 0, tỉ số khoảng 0.81). Vậy phần lớn lợi ích **không đến từ việc xử lý drift**. Phần gắn với drift là: khi c tăng, B3d-Sa giữ gần Oracle, còn đối thủ xấu đi. -**Hệ quả hiện tại.** -- H2 chưa được ủng hộ trước đối thủ cùng posterior. Cải thiện đo được đến từ **posterior tie** (anchor + vật lý + SMC); tie posterior tự nó không mới (Gunning & Glinsky 2006; Buland & Omre 2003), nên điều đem ra kiểm là dùng posterior làm nhãn huấn luyện. -- Cập nhật 27/10/2026: đã khoá `protocol_p2r` (H2 tách thành H2a/H2b, H3 chỉ mô tả, nhánh σ_a); chi tiết ở plan §12 mục 11. -- Việc còn lại đến hết 27/10/2026: - - học σ_a, σ_b; - - chạy lưới stress (SNR thấp, ít anchor, rock physics sai mô hình) để tìm vùng mà posterior đủ rộng cho RML có tác dụng. -- Sau đó chọn một trong hai: - - khoá `protocol_p2r` với posterior SMC và thêm B3d-S vào tập đối thủ; - - hoặc **Pivot 1** (plan §9): bài phân tích về sai số registration của nhãn, với posterior tie là phương pháp, còn RML và nhãn warp trung bình là hai cách dùng posterior đó. +**H2b: học trên cả ngân hàng có thêm được gì không?** So M2-Sa với B3d-Sa. **Đạt** với N = 16: ở 8/8 ô có posterior rộng, M2-Sa tốt hơn, và lợi ích càng lớn khi posterior càng rộng (tương quan hạng ρ = −0.85). Ở các ô posterior hẹp, hai phương pháp ngang nhau (tỉ số 0.996), đúng như Bài 7.6 dự đoán. + +**Nhánh σ_a: trượt.** Khi cố ý đặt sai σ_a (một nửa hoặc gấp đôi giá trị thật), không ô nào đạt. Nghĩa là lợi ích của H2a **cần σ_a được đặt đúng**. Đây là rủi ro lớn nhất cho F3, vì σ_a thật của F3 không biết. + +**H3 (chỉ mô tả):** mọi ensemble, kể cả Oracle, đều cho khoảng tin cậy quá hẹp. Coverage 90% chỉ từ 0.31 đến 0.79, trung vị 0.47. **Không claim gì về calibration.** + +### 11.4 P3 (28/10): F3 thật, trượt cổng G-C + +**Thiết kế: nested LOWO.** +- Vòng ngoài: giấu 1 trong 4 giếng làm test. +- Vòng trong: trong 3 giếng còn lại, lần lượt giấu 1 giếng làm validation, học trên 2 giếng. Validation dùng để chọn số bước huấn luyện và chọn đối thủ tie điểm, không bao giờ dùng giếng test ngoài. +- Tổng cộng 1,320 lần huấn luyện; 12 ablation; hai nhánh σ_a; dự đoán cả khối 649 inline bằng 20 mô hình. +- Protocol: [protocol_f3.yaml](../configs/protocol_f3.yaml), khoá lúc 00:14 ngày 28/10, trước khi chạy. + +**Kết quả: G-C trượt cả hai điều kiện.** +- M2-Sa chỉ hơn đối thủ (B3c-R, được validation chọn ở cả 4 giếng) tại **1/4 giếng** (F03-4, tỉ số 0.981). Cần 3/4. Ba giếng còn lại: F02-1 1.008, F03-2 1.000, F06-1 1.070. +- Coverage 80% là 52.4% (cần 75–85%); coverage 90% là 60.9% (cần 85–95%). +- Đổi σ_a, đổi thước đo hay đổi nhãn đều không làm kết quả đạt. + +**Đọc kết quả thế nào.** +- Mỗi mô hình chỉ học từ 2 giếng. Ở mức này, mạng dự đoán được rất ít nội dung băng seismic. Sai khác giữa các phương pháp **nhỏ hơn sai khác giữa các seed**. +- Một mốc tham chiếu làm sau (chỉ mô tả): nếu dự đoán hoàn toàn không có nội dung băng seismic thì RMSE băng là 1.224 p.u. M2-Sa đạt 1.272, B3c-R 1.256. Chỉ B4b (1.211) thấp hơn mốc này một chút. +- Đường xu hướng B0a vẫn có RMSE tổng tốt nhất (2.48 p.u.). + +**Quyết định:** đóng P3, không chạy lại. Mọi thay đổi thiết kế lúc này đều là lựa chọn sau khi đã thấy nhãn test. Kết luận P2/P2r trên synthetic giữ nguyên, nhưng **không được claim chúng khái quát ra field**. + +### 11.5 Tổng kết đến lúc này + +| Câu hỏi | Trả lời | +| --- | --- | +| Nhãn lệch có làm mạng học ra ảnh mờ không? | Có. Lý thuyết khớp thí nghiệm trong 1% (H1) | +| Có cần anchor không? | Có (H4, Mệnh đề 2) | +| Posterior tie tốt (SMC) có giúp trên synthetic không? | Có, giảm RMSE băng khoảng 8–22% so với tie điểm tốt nhất (H2a), với điều kiện σ_a đúng | +| Học trên cả ngân hàng có thêm gì không? | Có, nhưng chỉ khi posterior rộng (H2b) | +| Khoảng bất định có đáng tin không? | Không, mọi phương pháp đều quá tự tin | +| Trên F3 thật thì sao? | Không thắng; khác biệt nhỏ hơn nhiễu do seed (G-C trượt) | +| Trên Volve thì sao? | Không phân định được: không phương pháp nào thắng một hằng số; G-D không đạt tiêu chí claim (mục 11.6) | +| Nhãn đặt tại tie trung bình posterior thì mạng học ra gì? | Ảnh sắc hơn thật, không mờ: sai số kiểu Berkson (Mệnh đề 3, mục 11.7) | +| Một field test cần gì để thấy được lợi ích? | Reference ở giếng blind chính xác cỡ 1 ms và khoảng 5–18 giếng blind; F3, Volve và Teapot đều không có (mục 11.7) | + +### 11.6 P4 Volve (29/10): G-D không đạt, và phép thử không có lực + +**Vì sao Volve.** Porosity ở Volve (PHIF) tính từ mật độ và neutron, **độc lập với sonic**. Điều này phá vỡ cấu trúc "nhãn = hàm của DT" của F3. + +**Cái khó mới.** Cả 6 giếng đều **nghiêng** (có giếng nghiêng tới 82°). Phải dựng quỹ đạo giếng trong không gian, đổi độ sâu đo dọc lỗ khoan sang độ sâu thẳng đứng, rồi lấy seismic dọc theo đường giếng thay vì một cột thẳng đứng. Nhãn cũng ngắn: chỉ 16–37 mẫu mỗi giếng, tổng 150 mẫu. Code: [deviated.py](../ml_porosity/data/deviated.py), [volve_wells.py](../ml_porosity/data/volve_wells.py), [ml_porosity/volve/](../ml_porosity/volve/). + +**Thiết kế.** Hai cách chia fold: LOWO, và "slot" (giấu cả nhóm giếng khoan chung một lỗ). Vị trí giếng test được đặt bằng mô hình thời gian–độ sâu trung bình của các giếng train, không dùng thông tin của giếng test. Cổng G-D chỉ mô tả: được nói "cải thiện nhất quán" chỉ khi ít nhất 5/6 giếng cải thiện ở cả hai cách chia. Protocol: `configs/protocol_volve.yaml`. + +**Kết quả** (xong 02:21 UTC ngày 29/10 trên server Linux; [plan.md](plan.md) §12 ý 20–21): + +| Tiêu chí đã khóa | lowo | slot | +| --- | --- | --- | +| RML tốt hơn tie điểm được chọn, cần ≥ 5/6 giếng | 2/6 | 3/6 | +| Coverage 80% (cần 75–85%) | 39% | 35% | +| Coverage 90% (cần 85–95%) | 48% | 47% | + +Đổi σ_a sang 3,5 hay 14 ms gần như không đổi gì (RMSE macro lệch ≤ 0,06 p.u.). + +**Vì sao không đọc được kết quả này theo chiều nào.** Mọi phương pháp đều có R² âm: dự đoán giếng giấu còn kém hơn chính trung bình của giếng đó. Sau khi chạy, ta thử một đối chứng "ngây thơ": đoán mọi mẫu bằng một hằng số, là trung bình porosity của các giếng train, không dùng seismic. Hằng số này có RMSE 6,03 (lowo) và 6,59 p.u. (slot), **thấp hơn mọi mạng**. Lý do là porosity trung bình khác nhau nhiều giữa các giếng (8,5–17,0 p.u.); mạng mang theo độ lệch đó, còn dao động của dự đoán dọc giếng không bám nhãn. Các phương pháp tie chỉ khác nhau ở chỗ đặt nhãn theo thời gian, và chênh nhau tối đa 0,25 p.u. trên tổng sai số 6–7 p.u. + +Hình dung: thi chạy giữa hai đôi giày khác nhau một chút, nhưng cả hai vận động viên đều bị chấn thương và đi bộ về đích. Kết quả không cho biết đôi giày nào tốt hơn. Volve vì vậy **không chống và cũng không ủng hộ** RML. + +Một điểm đáng chú ý: registration trên Volve "khỏe" hơn F3. Pha wavelet xác định tốt (các tập train nằm trong cung 43°, F3 là 214°), và độ rộng posterior (trung vị khoảng 4 ms) gần như không theo σ_a. Nút thắt ở Volve không nằm ở tie. + +**Thử thêm (exploratory, không claim).** Sau G-D có chạy thêm vài biến thể mô hình trên Volve: trừ trend vận tốc rồi học phần dư, thêm kênh đầu vào, hay dùng mô hình tuyến tính rất nhỏ. Kế hoạch ghi trước ở [p4-exploratory.md](research/p4-exploratory.md). Vì mọi biến thể được nghĩ ra *sau khi* thấy nhãn test của P4, kết quả chỉ được mô tả, không được dùng để đổi kết luận. Ngày 29/10 hướng này bị bỏ hẳn (Pivot 1, `plan.md` §12 ý 22): job bị dừng giữa chừng, output chỉ giữ làm hồ sơ, không tổng hợp và không đưa vào bài. + +### 11.7 Pivot 1 (29/10): bài thành lý thuyết + benchmark, và một field test cần gì + +**Vì sao đổi hướng.** G-C và G-D đều trượt, nên bài không thể claim cải thiện trên field. Ngày 29/10 dự án chọn Pivot 1 mức B: bài nói về sai số đăng ký của nhãn, gồm lý thuyết và một benchmark synthetic có warp thật; F3 và Volve chỉ là các trường hợp giới hạn phạm vi. Tên làm việc: *Label registration error in sparse-well seismic property learning: theory, a registration-aware benchmark, and the limits of field validation*. Hạn nộp dời sang thứ 7, 14/11/2026 ([plan.md](plan.md) §12 ý 22, 24). + +**Lý thuyết mở rộng** (bài mục 4.3–4.5, chứng minh ở Phụ lục A; bản tiếng Việt ở [theory.md](theory.md) mục 6): +- *Hai kiểu sai số của tie (Mệnh đề 3).* Nếu sai số tie độc lập với nhãn thật (kiểu *classical*), mạng học ra ảnh mờ như Mệnh đề 1. Nếu sai số độc lập với những gì ta đã biết (kiểu *Berkson*), như khi lấy tie là trung bình posterior, thì ngược lại: mạng học ra ảnh *sắc hơn* thật. Cận 1/B(σ_post) dùng cho H2b là cận của kiểu classical. Kiểu Berkson cho cận thấp hơn. Hệ số giữa hai tích phân, e^{4π²σ²f²}, nhỏ ở tần số thấp, nhưng phần méo (trọng số f⁴) nằm quanh 70 Hz, nơi hệ số lớn: ở σ = 2 ms, tích phân Berkson gấp 2,1–2,6 lần. Bản trước ghi "hệ số dưới 1,17". Con số đó sai vì chỉ xét tới 25 Hz (sửa 29/10). +- *Bank hiệu chỉnh (Mệnh đề 4).* Nếu bank là mẫu đúng của posterior, học trên cả bank cho cùng nghiệm quần thể với học trên nhãn thật. Nhưng lợi ích quần thể so với nhãn điểm chỉ ở *bậc bốn* theo σ, nên rất nhỏ khi posterior hẹp. +- *Coverage (Mệnh đề 5)* và *reference lệch (Mệnh đề 6, Hệ quả 4).* Nếu reference dùng để chấm cũng lệch, phép so sánh hai phương pháp chỉ cho đúng chiều khi sai số của reference nhỏ hơn σ/√2. + +**Kiểm tra post hoc trên P2r** ([31_p2r_posthoc.py](../scripts/31_p2r_posthoc.py), [30_t4_coverage.py](../scripts/30_t4_coverage.py); bài mục 6.3). Theo cận classical đã đăng ký, lợi ích của bank vượt cận quần thể ở 7/8 ô rộng khi tính tại σ_post và 6/8 ô khi tính tại sai số warp. Cận Berkson, tính post hoc, là cấu trúc tự nhiên cho nhãn tại warp trung bình. Theo cận này chỉ 3/8 ô vượt tại σ_post, cả ba ở c = 1 và hai ô sát cận. Tại sai số warp thì nhiều nhất 1/8 ô vượt. Vì vậy không nói được rằng lợi ích "vượt cận". Cũng chưa kiểm sai số thật có kiểu Berkson hay không. M2-Sa vẫn kém Oracle ở mọi ô rộng (4–63%). Nguồn lợi ích còn mở (T2, sẽ khai báo trước rồi mới chạy). Mọi ensemble quá hẹp, và độ dài huấn luyện lẫn với nguồn nhãn nên chưa tách được nguyên nhân. + +**Một field test cần gì** (T3, [27_t3_power.py](../scripts/27_t3_power.py); bài mục 6.5). Lấy dự đoán đã lưu của P2r rồi chấm lại bằng một reference cố ý lệch σ_ref. Với reference chính xác, sign test cần 5–18 giếng blind để đạt lực 0,8 ở phần lớn các ô; với σ_ref từ 3 ms trở lên thì 40 giếng cũng không đủ. Luật "≥ k/n giếng cải thiện" của G-C, G-D thực ra không phải phép kiểm: nó đạt ngẫu nhiên với xác suất 0,31 khi có 4 giếng và 0,11 khi có 6 giếng. + +**Điều kiện áp dụng và Teapot Dome** (exploratory; [applicability-teapot.md](research/applicability-teapot.md), [applicability-results.md](research/applicability-results.md); bài mục 6.6). Bốn điều kiện để một field test có ý nghĩa với kết quả synthetic: mạng có kỹ năng ở giếng blind trong băng seismic (C1), posterior tie đủ rộng (C2, chỉ cho so sánh với nhãn trung bình posterior), σ_a xác định được bằng dữ liệu thời gian–độ sâu độc lập ở ít nhất 3 giếng ngoài tập test (C3), và đủ giếng cho phép kiểm có lực (C4). F3 và Volve trượt C1, đạt C2 ([26_applicability.py](../scripts/26_applicability.py)). Thử Teapot Dome: chỉ tối đa 2 giếng có bảng thời gian–độ sâu độc lập (T0 trượt), và pilot dùng cặp horizon–top làm reference thay thế cho sai số 6,75 ms so với dung sai 1,5 ms (P-a trượt) ([28_teapot_inventory.py](../scripts/28_teapot_inventory.py), [29_teapot_pilot.py](../scripts/29_teapot_pilot.py)). Teapot dừng; bài không có field test mới. + +Hình dung: muốn biết đôi giày mới giúp chạy nhanh hơn 1% hay không, cần một đồng hồ bấm giờ sai ít hơn 1% và nhiều lượt chạy. F3, Volve và Teapot đều chưa có đồng hồ đủ chính xác. --- -## 11. Bản đồ code +## Bài 12. Được nói gì, không được nói gì -### 11.1 Module ([ml_porosity/](../ml_porosity/)) +Đây là phần quan trọng khi viết bài. Danh sách đầy đủ ở [plan.md](plan.md) §10. + +**Được nói (có bằng chứng):** +- Huấn luyện trên nhãn lệch tương đương học một mục tiêu bị làm mờ, và mức mờ tính được (Mệnh đề 1, H1). +- Không có anchor thì thời gian tuyệt đối không xác định được; các loss căn chỉnh chung không tự sửa được điều này (Mệnh đề 2, H4). +- Trên synthetic dựng theo F3, nhãn từ posterior SMC hơn tie điểm tốt nhất; RML hơn thêm khi posterior rộng. Cả hai cần σ_a đúng. +- Trên F3, phép thử đăng ký trước đã trượt. +- Trên Volve, phép thử khóa trước cũng trượt; ở đó không phương pháp nào thắng một hằng số, nên phép thử không có lực. +- Tie trung bình posterior có sai số kiểu Berkson, làm sắc chứ không làm mờ predictor; lợi ích quần thể của một bank hiệu chỉnh là bậc bốn theo σ (Mệnh đề 3–4). +- Một phép so sánh tie ở giếng blind cần reference chính xác cỡ 1 ms và đủ giếng (T3, Hệ quả 4); đây là kết quả exploratory. + +**Không được nói:** +- "First" hay "novel" khi chưa kiểm tra novelty xong. +- "Porosity" của F3 mà không nói rằng nó là biến đổi tuyến tính của sonic. +- Bất kỳ con số nào của luận văn gốc dùng làm baseline. +- "Calibrated uncertainty": mọi phương pháp đều under-cover. +- Gọi kết quả chỉ có trên synthetic là "khái quát ra field". Kết quả F3 và Volve không ủng hộ điều đó. +- Dùng Volve làm bằng chứng rằng RML "không hoạt động", hoặc dùng kết quả exploratory P4x làm bằng chứng nó "có hoạt động". +- Nói rằng lợi ích thêm của bank vượt cận quần thể hoặc đã được giải thích. Nó chỉ vượt cận classical. Với cận Berkson, phần lớn lợi ích nằm trong cận, và nguồn lợi ích còn mở (T2). +- Dùng C1–C4 như một tiêu chí đã đăng ký trước: chúng được nêu sau khi cả hai field gate trượt. +- Gọi marker của F3 là checkshot độc lập. +- Bất kỳ kết quả nào có dính lựa chọn (dịch, checkpoint, hyperparameter) dựa trên nhãn test. + +--- + +## Bài 13. Đi vào code + +### 13.1 Luồng xử lý + +![Detailed RML workflow: from input data to go/no-go gates](figures/workflow.png) + +*Hình 1. Luồng xử lý chi tiết. Khung nét đứt là các giai đoạn. Nhãn trong hình bằng tiếng Anh để dùng thẳng cho bài báo. Bản vector: [workflow.svg](figures/workflow.svg); nguồn TikZ: [workflow.tex](figures/workflow.tex). Dựng lại: chạy `xelatex workflow.tex` trong `docs/figures/`, rồi xuất PDF sang PNG (200 dpi) và SVG.* + +| Giai đoạn | Bài | Làm gì | Code | +| --- | --- | --- | --- | +| 1. Tiền xử lý | 2, 4 | Đặt giếng đúng toạ độ, lấy patch 3×3, tích phân DT, ghép marker với horizon thành anchor | [geometry.py](../ml_porosity/data/geometry.py), [tdr.py](../ml_porosity/data/tdr.py), [horizons.py](../ml_porosity/data/horizons.py) | +| 2. Posterior warp | 7 | Prior GP, anchor, likelihood vật lý, SMC | [warp_prior.py](../ml_porosity/registration/warp_prior.py), [tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py), [smc.py](../ml_porosity/registration/smc.py) | +| 3. Ngân hàng nhãn | 8 | Mỗi warp cho một phiên bản nhãn | [labels.py](../ml_porosity/registration/labels.py) | +| 4. Huấn luyện | 9 | CNN–GRU, loss RML, ensemble 5 seed | [bank_train.py](../ml_porosity/models/bank_train.py), [rml.py](../ml_porosity/losses/rml.py) | +| 5. Dự đoán | 6 | Chỉ cần seismic, ra μ ± σ | [cnn_gru.py](../ml_porosity/models/cnn_gru.py) | +| 6. Đánh giá | 10 | Chấm trên giếng mù theo protocol đã khoá | [metrics.py](../ml_porosity/eval/metrics.py) | + +### 13.2 Bản đồ module ([ml_porosity/](../ml_porosity/)) | Khái niệm | File | | --- | --- | -| Bin ↔ toạ độ XY từ `.survey` | [data/geometry.py](../ml_porosity/data/geometry.py) | -| Đọc LAS, SEG-Y, horizon, dữ liệu Volve | [data/las_io.py](../ml_porosity/data/las_io.py), [data/seismic_io.py](../ml_porosity/data/seismic_io.py), [data/horizons.py](../ml_porosity/data/horizons.py), [data/volve_io.py](../ml_porosity/data/volve_io.py) | +| Đọc LAS, SEG-Y, horizon, Volve | [data/las_io.py](../ml_porosity/data/las_io.py), [data/seismic_io.py](../ml_porosity/data/seismic_io.py), [data/horizons.py](../ml_porosity/data/horizons.py), [data/volve_io.py](../ml_porosity/data/volve_io.py) | +| Toạ độ bin ↔ XY | [data/geometry.py](../ml_porosity/data/geometry.py) | | TDR (legacy, sonic, calibrated) | [data/tdr.py](../ml_porosity/data/tdr.py) | -| Log độ sâu → thời gian có chống alias | [data/resample.py](../ml_porosity/data/resample.py) | -| Wavelet (Ricker, thống kê, xoay pha, bình phương tối thiểu) | [data/wavelet.py](../ml_porosity/data/wavelet.py) | -| Reflectivity, synthetic, dịch cục bộ | [data/synthetic.py](../ml_porosity/data/synthetic.py) | +| Đổi log sang thời gian có chống alias | [data/resample.py](../ml_porosity/data/resample.py) | +| Wavelet, synthetic seismogram | [data/wavelet.py](../ml_porosity/data/wavelet.py), [data/synthetic.py](../ml_porosity/data/synthetic.py) | | Bộ sinh D2 | [data/synth_d2.py](../ml_porosity/data/synth_d2.py) | -| Prior GP warp, posterior tuyến tính hoá, MAP-II, leave-one-anchor-out | [registration/warp_prior.py](../ml_porosity/registration/warp_prior.py) | -| Elliptical slice sampling, ESS, tempering | [registration/sampler.py](../ml_porosity/registration/sampler.py) | -| Likelihood tie vật lý, chọn pha | [registration/tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py) | +| Giếng nghiêng (Volve) | [data/deviated.py](../ml_porosity/data/deviated.py), [data/volve_wells.py](../ml_porosity/data/volve_wells.py) | +| Prior GP của warp, posterior tuyến tính hoá | [registration/warp_prior.py](../ml_porosity/registration/warp_prior.py) | +| Lấy mẫu kiểu P2 (elliptical slice sampling) | [registration/sampler.py](../ml_porosity/registration/sampler.py) | | SMC tempering (CPU / GPU) | [registration/smc.py](../ml_porosity/registration/smc.py), [registration/smc_torch.py](../ml_porosity/registration/smc_torch.py) | -| Ngân hàng nhãn theo mẫu warp | [registration/labels.py](../ml_porosity/registration/labels.py) | -| Tie điểm B3a–d, sai số warp | [registration/ties.py](../ml_porosity/registration/ties.py) | -| Đăng ký một ô D2: ghép tất cả các bước trên | [registration/pipeline.py](../ml_porosity/registration/pipeline.py) | -| Loss RML / hard-min, λ = 1/τ_c | [losses/rml.py](../ml_porosity/losses/rml.py) | -| Soft-DTW, DILATE | [losses/softdtw.py](../ml_porosity/losses/softdtw.py) | -| 6 loss của luận văn | [losses/legacy_v2.py](../ml_porosity/losses/legacy_v2.py) | -| CNN–GRU, head heteroscedastic, huấn luyện P1 | [models/cnn_gru.py](../ml_porosity/models/cnn_gru.py), [models/train.py](../ml_porosity/models/train.py) | -| Huấn luyện chung cho mọi phương pháp P2 | [models/bank_train.py](../ml_porosity/models/bank_train.py) | -| Baseline B0b (attribute) và B1 (inversion) | [baselines/attributes.py](../ml_porosity/baselines/attributes.py), [baselines/inversion.py](../ml_porosity/baselines/inversion.py) | -| Metric điểm, theo băng, calibration | [eval/metrics.py](../ml_porosity/eval/metrics.py) | +| Likelihood vật lý, chọn pha wavelet | [registration/tie_likelihood.py](../ml_porosity/registration/tie_likelihood.py) | +| Tie điểm B3a–d | [registration/ties.py](../ml_porosity/registration/ties.py) | +| Ngân hàng nhãn | [registration/labels.py](../ml_porosity/registration/labels.py) | +| Loss RML, soft-DTW, DILATE, loss luận văn | [losses/rml.py](../ml_porosity/losses/rml.py), [losses/softdtw.py](../ml_porosity/losses/softdtw.py), [losses/legacy_v2.py](../ml_porosity/losses/legacy_v2.py) | +| Mạng CNN–GRU và huấn luyện | [models/cnn_gru.py](../ml_porosity/models/cnn_gru.py), [models/train.py](../ml_porosity/models/train.py), [models/bank_train.py](../ml_porosity/models/bank_train.py) | +| Baseline B0b, B1 | [baselines/attributes.py](../ml_porosity/baselines/attributes.py), [baselines/inversion.py](../ml_porosity/baselines/inversion.py) | +| Thước đo | [eval/metrics.py](../ml_porosity/eval/metrics.py) | +| Pipeline P3 (F3) | [f3/](../ml_porosity/f3/): protocol, registration, training, evaluation, volume | +| Pipeline P4 (Volve) | [volve/](../ml_porosity/volve/): folds, loss có mask, registration, training, evaluation | -### 11.2 Chạy +### 13.3 Chạy theo pha -Cài đặt và bảng mô tả từng script ở [README.md](../README.md). Thứ tự: -- `scripts/run_p0.sh`: hạ tầng và test. -- `scripts/run_p1.sh`: audit F3 và baseline LOWO. -- `scripts/run_p2.sh`: prior warp, D2, lưới chính, H1, tổng hợp; chạy trên GPU `cuda:1`. -- `scripts/14_diag_posterior.py` và `scripts/15_diag_train.py`: chẩn đoán sau G-B. +Cài đặt và bảng mô tả từng script ở [README.md](../README.md). -Test nằm trong [tests/](../tests/). Các test quan trọng cho lý thuyết nằm ở [test_losses.py](../tests/test_losses.py) (các trường hợp riêng của RML) và [test_registration.py](../tests/test_registration.py). +| Pha | Driver | Script chính | +| --- | --- | --- | +| P0 | `scripts/run_p0.sh` | test, manifest dữ liệu | +| P1 | `scripts/run_p1.sh` | 01–08 | +| P2 | `scripts/run_p2.sh` | 09–13 | +| P2r | `scripts/run_p2r_main.sh` | 14, 15, 18 | +| P3 | `scripts/run_p3.ps1` (Windows) | 19–21 | +| P4 | `scripts/run_p4.sh`, `scripts/run_p4.ps1` | 23, 24; 25 (post hoc, ngoài khóa) | +| Điều kiện áp dụng, T3, Teapot (exploratory) | | 26, 27; 28, 29 (đọc data/Teapot, chạy bằng `python -P`) | +| T4 và kiểm cận H2b (post hoc trên P2r) | | 30, 31 | +| Hình cho bài báo | | 22 | + +Không chạy lại `04_wavelet_tie.py` và `09_fit_warp_prior_f3.py`, và không ghi đè artifact cũ của chúng (yêu cầu của người dùng; xem [AGENTS.md](../AGENTS.md)). Test nằm trong [tests/](../tests/). Hai file quan trọng nhất cho lý thuyết là [test_losses.py](../tests/test_losses.py) (các trường hợp đặc biệt của RML) và [test_registration.py](../tests/test_registration.py). --- -## 12. Thuật ngữ +## Phụ lục A. Thuật ngữ | Thuật ngữ | Nghĩa | | --- | --- | -| Acoustic impedance (AI) | Mật độ × vận tốc sóng P. Thay đổi AI tạo ra phản xạ | -| Anchor | Cặp (độ sâu, thời gian) độc lập với sonic, ở đây là marker khớp horizon. Có sai số pick σ_a | -| Băng seismic / băng thấp | Phần tín hiệu ≥ 6 Hz (seismic có thông tin) / < 6 Hz (chủ yếu trend) | -| Bank (ngân hàng nhãn) | S phiên bản nhãn ứng với S mẫu warp, kèm trọng số π | -| Blind well | Giếng test hoàn toàn không đóng góp vào huấn luyện | -| Bulk shift | Dịch toàn bộ chuỗi một hằng số thời gian | -| Calibration | Mức khớp giữa bất định khai báo và sai số thực | -| Checkshot / VSP | Đo trực tiếp thời gian truyền sóng tới các độ sâu trong giếng | -| Coverage | Tỉ lệ giá trị thật nằm trong khoảng dự đoán ở một mức danh nghĩa | -| CRPS | Điểm đánh giá cả độ chính xác lẫn độ sắc của phân phối dự đoán (càng nhỏ càng tốt) | -| Cycle skipping | Tie khớp nhầm lệch đúng một chu kỳ wavelet | -| Drift | Lệch tích luỹ theo độ sâu giữa thời gian sonic và thời gian seismic | -| DT (sonic) | Slowness của sóng P, µs/m | -| ESS | (1) Elliptical slice sampling: thuật toán MCMC. (2) Effective sample size: số mẫu hiệu dụng của bộ trọng số | -| Gaussian process (GP) | Phân phối xác suất trên hàm, xác định bởi trung bình và kernel | -| Heteroscedastic | Mạng dự đoán cả độ bất định σ(t) thay đổi theo từng điểm | -| Horizon | Mặt phản xạ được dò liên tục trong cube seismic | -| Inline / crossline / bin | Hai trục của lưới khảo sát và một ô của lưới | -| λ (lambda) | Luỹ thừa trong RML, điều khiển giữa trung bình (λ → 0) và hard-min (λ → ∞) | -| LFM | Low-frequency model: mô hình phần tần số thấp, thường nội suy từ giếng theo horizon | -| LOWO | Leave-one-well-out cross-validation | -| Marginalize | Lấy tổng (tích phân) theo một biến chưa biết thay vì cố định nó ở một giá trị | +| Acoustic impedance (AI) | Mật độ × vận tốc sóng. Ranh giới có AI thay đổi tạo ra tiếng vọng | +| Alias | Dao động nhanh "giả dạng" thành dao động chậm khi lấy mẫu thưa mà không lọc trước | +| Anchor | Cặp (độ sâu, thời gian) độc lập với sonic: marker trên log khớp với horizon trên seismic. Có sai số pick σ_a | +| Băng seismic / băng thấp | Phần tín hiệu ≥ 6 Hz (seismic mang thông tin) / < 6 Hz (chủ yếu là xu hướng) | +| Blind well | Giếng test, không góp thông tin gì vào việc học | +| c | Hệ số nhân drift trong D2. c = 1 giống F3 | +| Calibration, coverage | Khoảng tin cậy x% có chứa giá trị thật khoảng x% số lần không | +| Cổng (gate) G-A…G-D | Điểm quyết định cuối mỗi pha, ngưỡng chốt trước | +| CRPS | Điểm chấm cả độ chính xác lẫn độ sắc của dự đoán dạng phân phối (càng nhỏ càng tốt) | +| Cycle skipping | Tie khớp nhầm, lệch đúng một chu kỳ sóng | +| Deviation | Thay đổi so với protocol đã khoá, phải ghi rõ và báo cáo | +| Drift | Độ lệch tích luỹ theo độ sâu giữa thời gian sonic và thời gian seismic | +| DT (sonic) | Thời gian sóng đi qua 1 m đá, µs/m | +| Ensemble | Gộp nhiều bản mạng huấn luyện với seed khác nhau | +| Gaussian NLL | Loss cho mạng dự đoán cả μ và σ | +| Gaussian process (GP) | "Máy sinh đường cong ngẫu nhiên", điều khiển bởi biên độ và độ dài tương quan | +| Horizon | Mặt phản xạ dò liên tục trong cube seismic | +| LOWO, nested LOWO | Lần lượt giấu một giếng làm test; bản "nested" giấu thêm một giếng trong tập train làm validation | +| λ (lambda) | Núm của RML: λ → 0 là trung bình đều, λ → ∞ là chỉ lấy phiên bản khớp nhất | | Marker | Nóc tầng đá xác định trên log giếng | -| MD / TVD / KB | Độ sâu đo dọc lỗ khoan / độ sâu thẳng đứng / mốc đo trên giàn | -| Misregistration / registration | Sai lệch / việc căn chỉnh giữa trục thời gian của nhãn và của seismic | -| Oracle | Mô hình huấn luyện với warp thật (chỉ có trên synthetic) | +| MD / TVD | Độ sâu đo dọc lỗ khoan / độ sâu thẳng đứng | +| Ngân hàng nhãn (bank) | S phiên bản nhãn từ S warp, kèm trọng số π | +| N | Số giếng train trong D2 | +| Oracle | Mô hình học với warp thật, chỉ có trên synthetic | +| p.u. | Porosity × 100 | | PCC | Hệ số tương quan Pearson | -| PHIE / PHIE_DT | Porosity hiệu dụng trong LAS / nhãn chính của dự án = −0.2018 + 0.0011·DT | -| p.u. | Porosity unit = porosity × 100 | -| Phase diagram | Bản đồ kết quả theo (mức drift c × số giếng N) | -| Post-stack | Seismic đã cộng các lần thu, mỗi bin một trace | -| Pre-registration | Chốt protocol và ngưỡng trước khi chạy, khoá bằng hash | -| Realization | Một lần sinh ngẫu nhiên earth model synthetic | +| PHIE / PHIE_DT / PHIF | Porosity trong file LAS của F3 / nhãn chính của F3 (= −0.2018 + 0.0011·DT) / porosity của Volve | +| Posterior, prior, likelihood | Niềm tin sau / trước khi có dữ liệu / mức dữ liệu ủng hộ một giả thiết | +| Pre-registration | Ghi và khoá giả thuyết, cách đo, ngưỡng trước khi chạy | +| Realization | Một lần sinh ngẫu nhiên "trái đất" mô phỏng | | Reflectivity | Chuỗi hệ số phản xạ theo thời gian | +| Regime (R10, R0, Rm5, R0h, R10tb) | Mức SNR seismic và mật độ anchor trong D2 | | RML | Registration-Marginalized Learning, phương pháp của bài | -| Rock physics | Quan hệ giữa thuộc tính đá (porosity) và log (DT, RHOB, AI) | -| SMC tempering | Lấy mẫu bằng một đám hạt, tăng dần luỹ thừa likelihood γ từ 0 tới 1 | -| Soft-DTW / DILATE | Loss căn chỉnh chuỗi khả vi, không có anchor | -| Std ratio | Độ lệch chuẩn dự đoán / độ lệch chuẩn nhãn. Nhỏ hơn 1 nghĩa là dự đoán bị co | -| Synthetic seismogram | Trace seismic nhân tạo dựng từ log giếng và wavelet | -| τ (tau) | Thời gian sonic: tích phân DT từ một điểm neo | -| Tempering (γ) | Nâng likelihood lên luỹ thừa γ ≤ 1 để bớt nhọn | -| TDR | Time–depth relationship: ánh xạ độ sâu ↔ thời gian | -| Trace | Chuỗi biên độ seismic tại một vị trí | -| TWT | Two-way time: thời gian sóng đi xuống và về (ms) | -| Type-II ML / MAP-II | Chọn hyperparameter của prior bằng cực đại marginal likelihood (có thêm hyperprior thì là MAP-II) | -| Warp | Hàm t(τ) đơn điệu biến thời gian sonic thành thời gian seismic; gồm b và g | -| Wavelet | Xung seismic có băng tần hữu hạn; tích chập với reflectivity cho trace | +| -Sa (hậu tố) | Dùng posterior SMC (B3d-Sa: nhãn từ warp trung bình; M2-Sa: RML trên 64 hạt) | +| σ_a | Sai số pick của anchor (ms) | +| σ_post | Độ rộng posterior của warp (ms) | +| SMC tempering | Lấy mẫu bằng một đàn hạt, tăng dần "liều" likelihood từ 0 tới 1 | +| Soft-DTW / DILATE | Loss căn chỉnh chuỗi có co giãn, không có anchor | +| Std ratio | Độ lệch chuẩn dự đoán / của nhãn; < 1 nghĩa là dự đoán bị co | +| Synthetic seismogram | Trace nhân tạo dựng từ log giếng và wavelet | +| τ (tau) / t | Thời gian sonic (tích phân DT) / thời gian seismic thật | +| TDR | Quan hệ độ sâu ↔ thời gian | +| Trace, TWT, bin, cube | Chuỗi biên độ tại một vị trí / thời gian đi–về / ô lưới / cả khối 3D | +| Warp | Hàm đơn điệu biến τ thành t, gồm độ dịch b và tốc độ tương đối g | +| Wavelet | Xung seismic có băng tần hữu hạn | | Well tie | Chỉnh TDR để synthetic khớp seismic tại giếng | --- -## 13. Đọc tiếp +## Phụ lục B. Câu hỏi tự kiểm tra -- [plan.md](plan.md): kế hoạch đầy đủ, số liệu audit, thiết kế thí nghiệm, rủi ro và các hướng pivot. -- [theory.md](theory.md): chứng minh Mệnh đề 1–2, heuristic λ, Bổ đề 1–5. -- [research/porosity-research-gap-survey.md](research/porosity-research-gap-survey.md): survey literature (mã P01–P15). -- [research/porosity-references.bib](research/porosity-references.bib): tài liệu tham khảo. +
+1. Vì sao không thể ghép thẳng log giếng với trace seismic? + +Log đo theo độ sâu (m), seismic đo theo thời gian (ms). Phải có TDR để đổi, và TDR trên F3 sai 14–66 ms, lớn hơn một chu kỳ sóng (17–20 ms). +
+ +
+2. Nhãn lệch ngẫu nhiên làm dự đoán của mạng ra sao, và vì sao? + +Dự đoán bị làm mờ. MSE học trung bình của các nhãn, ở đây là trung bình của nhiều bản dịch, giống ảnh chụp khi tay run. Các thành phần tần số cao bị nhân với e^{−2π²σ²f²}. +
+ +
+3. Thêm một loss ép phương sai dự đoán to lên (L_Var) có sửa được việc bị mờ không? + +Không. Nó làm biên độ to ra nhưng không khôi phục được thông tin về pha đã mất. Ảnh vẫn mờ, chỉ đậm hơn. +
+ +
+4. Khác biệt cốt lõi giữa RML và soft-DTW là gì? + +Không phải ở công thức "soft-min". Khác ở chỗ ngân hàng căn chỉnh đến từ đâu: RML dùng posterior có anchor và vật lý; soft-DTW cho phép mọi đường căn chỉnh trong một dải với trọng số như nhau, không có anchor. +
+ +
+5. Vì sao bỏ anchor thì hỏng? + +Mệnh đề 2: dịch cả dự đoán lẫn mọi warp cùng một lượng thì loss gần như không đổi, nên không có gì ghim thời gian tuyệt đối. Thí nghiệm: bỏ anchor làm sai số warp tăng từ khoảng 3 ms lên 31–33 ms. +
+ +
+6. Khi nào học trên cả ngân hàng (M2-Sa) có lợi hơn dùng một nhãn trung bình (B3d-Sa)? + +Khi posterior rộng (σ_post lớn). Posterior hẹp thì mọi phiên bản gần như trùng nhau, nên ngân hàng không thêm gì. +
+ +
+7. Vì sao P2r phải ghi là "deviation"? + +Protocol P2 nói nếu G-B trượt thì chẩn đoán rồi pivot. Phương án chạy lại trên realization mới chỉ được thiết kế sau khi đã thấy P2 trượt. Kết luận G-B của P2 vẫn giữ nguyên; P2r là một đăng ký trước mới. +
+ +
+8. Kết quả F3 có nghĩa là phương pháp sai không? + +Không hẳn. Nó nghĩa là trên 4 giếng F3, với 2 giếng train mỗi mô hình, phương pháp không thắng được đối thủ, và khác biệt giữa các phương pháp nhỏ hơn khác biệt giữa các seed. Không được claim ưu thế trên field. Kết luận trên synthetic vẫn đứng, nhưng chỉ trong phạm vi synthetic và với σ_a đúng. +
+ +
+9. Vì sao cần mỏ Volve? + +Nhãn F3 là sonic đổi đơn vị, và cùng log sonic sinh ra cả nhãn lẫn trục thời gian. Porosity ở Volve tính độc lập với sonic, nên kiểm tra được xem kết quả có phụ thuộc vào đặc thù đó không. Thực tế trên Volve không phương pháp nào có kỹ năng ở giếng giấu, nên câu hỏi này vẫn chưa được trả lời (mục 11.6). +
+ +--- + +## Đọc tiếp + +- [plan.md](plan.md): kế hoạch đầy đủ, số liệu audit, thiết kế thí nghiệm, rủi ro, nhật ký quyết định (§12). +- [theory.md](theory.md): chứng minh Mệnh đề 1–2, heuristic λ, Bổ đề 1–5; mục 6 là bản tiếng Việt của Mệnh đề 3–6 và Hệ quả 3–4. +- [research/pivot-theory-benchmark.md](research/pivot-theory-benchmark.md): phân tích và lịch Pivot 1. +- [research/applicability-teapot.md](research/applicability-teapot.md), [research/applicability-results.md](research/applicability-results.md): điều kiện C1–C4, T3 và thử Teapot Dome. +- [research/porosity-research-gap-survey.md](research/porosity-research-gap-survey.md): khảo sát tài liệu. +- [research/p3-code-review.md](research/p3-code-review.md): rà soát code P3. - [`report.html`](../report.html): báo cáo tiến độ có hình. -- Tài liệu gốc nên đọc trước: - - Cuturi & Blondel (2017), soft-DTW; - - Murray, Adams & MacKay (2010), elliptical slice sampling; - - Buland & Omre (2003), tie Bayes; - - Lakshminarayanan et al. (2017), deep ensembles; - - Gneiting & Raftery (2007), CRPS và scoring rules. +- `paper/main.tex`: bản thảo bài báo. +- Tài liệu gốc nên đọc trước: Cuturi & Blondel (2017) về soft-DTW; Buland & Omre (2003) về tie Bayes; Lakshminarayanan et al. (2017) về deep ensemble; Gneiting & Raftery (2007) về CRPS. diff --git a/docs/theory.md b/docs/theory.md index adeed42..901f5a5 100644 --- a/docs/theory.md +++ b/docs/theory.md @@ -2,6 +2,8 @@ Ngày 26/10/2026. Tài liệu này viết phần lý thuyết mà [plan.md](plan.md) §4.6 yêu cầu, ở dạng sẽ đưa vào phụ lục bài báo. +**Bổ sung ngày 29/10/2026 (Pivot 1, [plan.md](plan.md) §12 ý 24):** mục 6 là bản tiếng Việt của mục 4.3–4.5 trong bài (`paper/sections/04_theory.tex`): Mệnh đề 3–6, Hệ quả 3–4, Nhận xét 1, cận ρ* và lập luận mẫu hữu hạn. Số mệnh đề theo bài. Mục 1.4 và 6.4 có ghi chú sửa cách đọc cận 1/B(σ_post): cận đã đăng ký là cấu trúc (a); bài báo thêm cận (b) post hoc. Cũng ngày 29/10, nhận định trước đó "hai cấu trúc gần như cho cùng một cận" đã được rút lại. + - Mục 1–2 là chứng minh, đúng dưới các giả thiết được nêu rõ. - Mục 3 là **heuristic**, không phải định lý. - Mục 4 là các bổ đề ngắn nối các baseline của plan §4.5 với RML. Mỗi bổ đề có test số tương ứng trong `tests/test_losses.py`. @@ -156,7 +158,7 @@ Gọi δ(t) = τ̄(t) − τ(t) là sai số của warp trung bình. Nếu poste 3. Ở 50 Hz, P = 0.95 / 0.90 / 0.82 khi σ_post = 1 / 1.5 / 2 ms. Đây là lý do protocol_p2r lấy σ_post ≥ 1.5 ms làm ranh giới "posterior rộng". **Cận định lượng.** -- Hệ số truyền tại một tần số không phải là con số quyết định metric. Mục 1.3 cho thấy predictor chỉ có công suất kết hợp với nhãn trong khoảng 7–23 Hz. Ở 20 Hz, σ = 1.5 ms cho P = 0.98. +- Hệ số truyền tại một tần số không phải là con số quyết định metric. Mục 1.3 cho thấy predictor chỉ có công suất kết hợp với nhãn trong khoảng 7–23 Hz. Ở 20 Hz, σ = 1.5 ms cho P = 0.98. (Sửa 29/10/2026: méo quần thể có trọng số f⁴, nên trung vị tần số của méo nằm ở 67–72 Hz dù phần lớn công suất ở dưới 25 Hz; xem ghi chú cuối mục.) - Vì vậy ta đo trực tiếp B(σ) = band_rmse(blur_σ(μ)) / band_rmse(μ), với μ là dự đoán của Oracle trên realization dev (`scripts/17_summarize_p2r_dev.py`, phần blur). - Nếu RML khử hết blur, tỉ số M2-S/B3d-S tốt nhất là ≈ 1/B(σ_post). - Trên dự đoán MSE0 của H1 (σ ∈ {4, 8} ms), B(σ) tính theo cách này khớp với suy giảm đo được: 1.33 so với 1.38, và 1.85 so với 1.91. Cách tính vì vậy dự báo đúng mức phạt của nhãn lệch. @@ -168,6 +170,16 @@ Gọi δ(t) = τ̄(t) − τ(t) là sai số của warp trung bình. Nếu poste - Vì vậy B(σ) là kỳ vọng định hướng, không phải cận chặt. H2b được kiểm bằng thực nghiệm. - Dev ở SNR −5 dB vi phạm "cận" này theo chiều ngược lại. Input nhiễu làm dự đoán Oracle vốn đã mượt, nên B(σ) ≈ 1.00 tới σ = 3 ms (1/B ≈ 0.98–1.00). Dù vậy M2-Sa/B3d-Sa đo được là 0.93–0.96 ở N = 16. Phần lợi ích này không đến từ khử blur theo Mệnh đề 1. Hai giải thích ứng viên, chưa tách được trên dev: (i) bank nhãn chống cho mạng nhớ một nhãn lệch duy nhất, tức một dạng tăng cường nhãn; (ii) τ̄ lệch có hệ thống khi posterior đa mode. Vì thế báo cáo không được gán lợi ích của RML cho cơ chế blur, trừ khi có bằng chứng riêng. +**Sửa ngày 29/10/2026 (bài mục 4.3 và 6.3; chi tiết ở mục 6 dưới đây).** +- Hệ quả 1 ở trên coi sai số của warp trung bình là *classical* (độc lập với y), nên B3d-S bị làm mờ. Đó là một giả thiết, không phải hệ quả. Tie lấy bằng trung bình posterior là lý tưởng hoá tự nhiên của cấu trúc *Berkson* (Mệnh đề 3(b)): tối ưu quần thể của nó bị làm **sắc** bởi 1/Q, không bị làm mờ. +- 1/B(σ_post) đúng là ρ* (mục 6.4) dưới cấu trúc (a) với sai số Gauss, lấy dự đoán của Oracle thay cho m (trong bài: 1/B_a). Dưới (b), tích phân méo lớn hơn một hệ số e^{4π²σ²f²}. Với σ = 2 ms, hệ số này là 1,10 ở 25 Hz và 1,77 ở 60 Hz. Trọng số f⁴ đẩy méo lên cao: với dự đoán Oracle của P2r (N = 16), 71–73% công suất kết hợp với nhãn nằm dưới 25 Hz, nhưng trung vị tần số của méo bậc dẫn là 67–72 Hz. Ở đó tích phân (b) bằng 1,5–1,7 lần tích phân (a) tại σ = 1,5 ms, 2,1–2,6 lần tại 2 ms và 3,3–4,6 lần tại 2,5 ms (`outputs/p2r/posthoc/meta.json`, `n16_spectra`). Cận tính cho cấu trúc này vì vậy không dùng được cho cấu trúc kia. Bản ghi trước đó viết "hệ số < 1,17, cấu trúc gần như không đổi cận". Nhận định đó sai vì chỉ xét |f| ≤ 25 Hz. Méo quần thể là bậc bốn theo σ, nên cận rất gần 1 khi posterior hẹp. +- Kiểm post hoc (`scripts/31_p2r_posthoc.py` → `outputs/p2r/posthoc/{bound.csv, blur_ab.csv, meta.json}`). Script đọc summary đã đăng ký và dự đoán Oracle trong `outputs/p2r/train//cells/*.npz`, chạy khoảng 6 phút. Kết quả ở N = 16, 8 ô rộng: + - **Cận (a), đã đăng ký.** Tỉ số M2-Sa/B3d-Sa thấp hơn cận ở 7/8 ô tại σ_post và 6/8 tại sai số warp RMS của B3d-Sa trên giếng train. Ngoại lệ: R10tb c = 2 (σ_post 11,5 ms, sai số warp 19,1 ms; vượt mép lưới blur 6 ms nên `np.interp` trả 1/B(6 ms) = 0,634, cận tính đúng tại σ_post là 0,481; tỉ số 0,667), và R10tb c = 1 khi tính tại sai số warp (4,8 ms so với σ_post 1,9 ms; cận 0,710; tỉ số 0,890). + - **Cận (b), post hoc.** Làm sắc dự đoán Oracle bằng e^{+2π²σ²f²} và tính đúng tại độ rộng của từng ô. Tỉ số thấp hơn cận ở 3/8 ô tại σ_post, cả ba ở c = 1 (R0, R0h, R10tb). Lề ở R0h và R10tb < 0,004, nằm trong CI 95%. Tại sai số warp: 0/8. + - **Hai biến thể của (b).** Làm sắc cũng khuếch đại sai số ước lượng của chính Oracle, nên 1/B_b bị kéo thấp, nhất là ở c = 2. Biến thể b60 giữ hệ số ở giá trị 60 Hz phía trên 60 Hz. Biến thể phổ chéo thay phổ dự đoán Oracle bằng phổ chéo với nhãn thật. Cả hai cho cùng 3/8 tại σ_post; tại sai số warp chỉ còn R0 c = 1 (1/8). Với phổ chéo, cận (a) cũng chỉ bị vượt ở 5/8 ô tại σ_post và 3/8 tại sai số warp. + - **Oracle/B3d-Sa (post hoc; c = 1, N = 16).** 0,927 / 0,919 / 0,758 / 0,933 ở R0 / R0h / R10tb / Rm5. Tỉ số dưới cận (a) ở cả 4 ô, dưới cận (b) tại σ_post ở 3–4 ô tuỳ ước lượng, tại sai số warp ở 1–2 ô. Ở c = 0, mọi cận nằm trong 0,4% quanh 1, nhưng Oracle vẫn tốt hơn B3d-Sa 1–3%. Hai bên còn khác số vòng lặp (500 và 250). +- Vì vậy câu "tỉ số M2-S/B3d-S tốt nhất là ≈ 1/B(σ_post)" chỉ là cận quần thể. Nhận định "lợi ích của bank vượt cận" ghi trước đây không được xác lập. Nó chỉ đúng dưới (a). Dưới (b) nó chỉ còn ở c = 1 và gần như biến mất tại sai số warp đo được. Chưa kiểm sai số của warp trung bình có cấu trúc Berkson hay không (phép kiểm hiệp phương sai ở mục 6.1; T2 test (iv)). Nguồn lợi ích chưa xác định: có thể là hiệu chỉnh quần thể của cấu trúc Berkson, có thể là hiệu ứng mẫu hữu hạn (mục 6.5; T2, `docs/research/t2-mechanism.md`). M2-Sa không đạt Oracle ở ô rộng nào. Ở c = 1, N = 16 nó còn kém Oracle 4–6% (R0, R0h, Rm5) và 17% (R10tb); ở R10tb c = 2 là 63%. Nó đóng 27–46% khoảng cách B3d-Sa–Oracle ở c = 1 và 39–65% ở c = 2. + ## 2. Mệnh đề 2 (nhận dạng) **Thiết lập.** @@ -380,11 +392,96 @@ Test: `test_rml_between_hard_min_and_mixture_mean` và `test_rml_small_lambda_is - Mệnh đề 1 và hai hệ quả: ở mức quần thể, cho predictor tối ưu MSE, dưới (A1); phần phổ cần thêm giả thiết dừng. - Mệnh đề 2: dưới (B); sd(β) là xấp xỉ bậc hai. - Bổ đề 1–5: chính xác, có test số. -- **Heuristic.** λ = 1/τ_c (mục 3). + - Mệnh đề 3–6, Hệ quả 3–4 (mục 6, thêm 29/10/2026): ở mức quần thể; chứng minh ở Phụ lục A của bài. Bank hiệu chỉnh (Mệnh đề 4) là lý tưởng hoá. Hệ quả 4 chỉ cho dấu ở bậc dẫn. +- **Heuristic.** λ = 1/τ_c (mục 3); lập luận mẫu hữu hạn (mục 6.5). - **Chưa làm.** - Tính nhất quán của estimator marginal likelihood (tuỳ chọn ở plan §4.6). - Chẩn đoán strain energy. - RML-EM (M3). + - Xác định nguồn lợi ích của bank: hiệu chỉnh quần thể trong cận ρ* dưới (b), hay hiệu ứng mẫu hữu hạn vượt cận đó (T2, exploratory, `docs/research/t2-mechanism.md`, khai báo trước khi chạy; test (iv) kiểm cấu trúc Berkson hay classical). + - Kiểm phần (b), (c) của Mệnh đề 5: ở P2r độ dài huấn luyện và nguồn nhãn lẫn vào nhau. + +## 6. Cấu trúc sai số của tie, bank hiệu chỉnh, coverage, reference lệch (thêm 29/10/2026) + +Bản tiếng Việt của mục 4.3–4.5 trong bài. Chứng minh ở Phụ lục A của bài (`paper/sections/A_proofs.tex`); ở đây chỉ phát biểu và nêu ý nghĩa. + +**Ký hiệu thêm.** D là toàn bộ dữ liệu ở giếng (seismic, log, anchor); input X là hàm của D. u* là warp thật, y = y^{u*}; û = û(D) là tie điểm với nhãn ỹ = y^{û}. Sai số viết được theo hai chiều: +- ỹ(t) = y(t + δ(t)), với δ(t) = t_{u*}(z_{û}(t)) − t; +- y(t) = ỹ(t + ε(t)), với ε(t) = t_{û}(z_{u*}(t)) − t. + +m̃(t) = E[ỹ(t) | X] là predictor tối ưu của nhãn điểm; P(f) = E e^{i2πfδ}, Q(f) = E e^{i2πfε}. + +### 6.1 Mệnh đề 3 (hai cấu trúc sai số) + +Giả thiết (A2) cho y và ỹ. +- **(a) Classical.** Nếu δ(t) độc lập với y(·) khi biết X, với phân phối có điều kiện p_t(·|X), thì m̃(t) = ∫ p_t(d|X) m(t + d) dd và Var(ỹ(t)|X) = ∫ p_t(d|X) Var(y(t + d)|X) dd + Var_{p_t}[m(t + d)]. +- **(b) Berkson.** Nếu ε(t) độc lập với D khi biết X, với phân phối có điều kiện q_t(·|X), thì m(t) = ∫ q_t(e|X) m̃(t + e) de và Var(y(t)|X) = ∫ q_t(e|X) Var(ỹ(t + e)|X) de + Var_{q_t}[m̃(t + e)]. +- Nếu p_t, q_t không phụ thuộc t thì, trung bình trên cửa sổ và bỏ hiệu ứng biên, nhãn điểm có phương sai có điều kiện lớn hơn dưới (a) và nhỏ hơn dưới (b). Nếu chúng không phụ thuộc cả t lẫn X thì m̃ là m lọc bởi P dưới (a), và m là m̃ lọc bởi Q dưới (b). Với sai số Gauss trung bình 0, phương sai σ², hệ số truyền từ m sang m̃ là e^{−2π²σ²f²} dưới (a) và e^{+2π²σ²f²} dưới (b). + +**Ý nghĩa.** +- (a) là cấu trúc classical của mô hình sai số đo (sai số độc lập với giá trị thật); (b) là cấu trúc Berkson (sai số độc lập với giá trị được gán). Ở đây sai số nằm ở chỉ số thời gian của nhãn, và hai cấu trúc làm lệch predictor học được theo hai chiều ngược nhau: (a) làm mờ predictor và nới rộng phương sai học được; (b) làm sắc predictor và thu hẹp phương sai. +- Tie lấy bằng trung bình posterior, û = E[u* | D], là lý tưởng hoá tự nhiên của (b): E[u* − û | D] = 0 theo cách dựng, và trong mô hình tuyến tính–Gauss u* − û độc lập với D. Với offset b của warp, sai số thời gian bằng sai số posterior của b nên thừa hưởng tính chất này; với drift thì chỉ gần đúng, khi posterior hẹp. +- Tie khớp theo cách khác (ví dụ cực đại tương quan synthetic–seismic) có thể theo một trong hai cấu trúc hoặc không theo cấu trúc nào. Trên dữ liệu synthetic phân biệt được: với offset, classical nghĩa là Cov(b̂ − b*, b*) = 0, Berkson nghĩa là Cov(b* − b̂, b̂) = 0. + +### 6.2 Mệnh đề 4 (bank hiệu chỉnh) + +Bank {(u_s, π_s)} gọi là *hiệu chỉnh* nếu Σ_s π_s G(u_s, D) = E[G(u*, D) | D] với mọi G khả tích. Với bank hiệu chỉnh: +- (a) nhãn trung bình ȳ = Σ_s π_s y^{u_s} thoả ȳ(t) = E[y(t) | D] và E[ȳ(t) | X] = m(t); +- (b) với mọi mạng (μ_θ, σ_θ) chỉ phụ thuộc dữ liệu qua X, E[Σ_s π_s ℓ_s] = E[ℓ*], trong đó ℓ* là log-likelihood cửa sổ của nhãn tại warp thật. + +Do đó giới hạn λ → 0 của RML (Bổ đề 2) có cùng nghiệm tối ưu quần thể với huấn luyện trên nhãn thật (μ = m, σ² = Var(y | X)), và MSE trên nhãn trung bình có nghiệm μ = m. + +**Lưu ý.** +- Hiệu chỉnh là lý tưởng hoá; nó đúng với mẫu posterior chính xác khi S → ∞. Dưới giả thiết này, lấy biên theo posterior khử sai lệch quần thể của cả hai cấu trúc. +- Warp trung bình không có tính chất này. B3d-Sa học nhãn tại warp trung bình ū, không phải nhãn trung bình. Khai triển y^u quanh ū: ȳ − y^{ū} = ½ Σ_s π_s (u_s − ū)ᵀ ∇²_u y^{ū} (u_s − ū) + O(‖u_s − ū‖³), nên hai nhãn chỉ trùng nhau tới bậc một theo độ trải posterior. Nếu sai số thời gian của warp trung bình theo (b), tối ưu quần thể của B3d-Sa bị làm sắc bởi 1/Q, còn của nhãn trung bình thì đúng. + +### 6.3 Hệ quả 3 (hai mode) và Nhận xét 1 (λ > 0) + +- **Hệ quả 3.** Cho sai số (δ dưới (a), ε dưới (b)) hằng trên cửa sổ, bằng ±Δ/2 với xác suất ½ mỗi bên, độc lập với X. Khi đó P = Q = cos(πfΔ), và dưới cả hai cấu trúc hệ số truyền từ m sang m̃ âm khi 1/(2Δ) < |f| < 3/(2Δ): ở đó nhãn điểm kéo mạng về sai dấu. Sai số Gauss cùng phương sai Δ²/4 có P = e^{−π²Δ²f²/2} > 0 ở mọi tần số. Nhãn trung bình của bank hiệu chỉnh có hệ số truyền 1. Dưới (a), bank gồm nhãn điểm dịch ±Δ/2 với trọng số bằng nhau có hệ số truyền cos²(πfΔ) ≥ 0. + - Đảo pha là tính chất của sai số đa mode mà một tóm tắt Gauss che mất. Nếu hai mode cách nhau một chu kỳ trội, Δ = 1/f_0, dải đảo là f_0/2 < |f| < 3f_0/2. Seismic F3 có đỉnh gần 60 Hz, nên dải đảo là 30–90 Hz. Bước nhảy chu kỳ cho sai số kiểu này; ở c = 2 posterior SMC đa mode. Trong ví dụ này, bank đặt tâm tại nhãn điểm chỉ khử đảo dấu bằng cách làm suy giảm thêm băng. +- **Nhận xét 1.** Mệnh đề 4 chỉ nói về giới hạn λ → 0. Khai triển hàm sinh cumulant: RML_λ = −(1/n)[Σ_s π_s ℓ_s + (λ/2) Var_π(ℓ) + O(λ²)]. Số hạng thứ hai thưởng cho predictor khớp một số thành viên của bank tốt hơn hẳn các thành viên khác. Với λ > 0, responsibilities của Bổ đề 3 dồn trọng số về các thành viên khớp với mạng hiện tại, tức một kiểu tái đăng ký ngầm, và nghiệm tối ưu quần thể nói chung không còn là (m, Var(y | X)). + +### 6.4 Bank được lợi tối đa bao nhiêu (ρ*) + +- Vì E[y − m | X] = 0, mọi predictor h chỉ phụ thuộc dữ liệu qua X thoả E|B(h − y)|² = E|B(m − y)|² + E|B(h − m)|². Ở mức quần thể, không phương pháp nào thắng Oracle về band MSE. +- Nếu phương pháp nhãn điểm hội tụ về m̃ và phương pháp bank về m, tỉ số band RMSE của chúng là ρ* = (1 + E|B(m̃ − m)|² / E|B(m − y)|²)^{−1/2}, và không phương pháp nào hơn nhãn điểm quá hệ số này. +- Với sai số không phụ thuộc t và X: E|B(m̃ − m)|² = ∫_{|f|≥f_c} |1 − P|² S_m df dưới (a), và ∫_{|f|≥f_c} |1 − Q|² |Q|^{−2} S_m df dưới (b). Với sai số Gauss, cả hai tích phân bằng (2π²σ²f²)² S_m ở bậc dẫn, nên **méo quần thể là bậc bốn theo σ**. Ngoài bậc dẫn, tích phân (b) lớn hơn tích phân (a) một hệ số e^{4π²σ²f²}. Với σ = 2 ms, hệ số này là 1,10 ở 25 Hz và 1,77 ở 60 Hz. Trọng số f⁴ đẩy méo lên tần số cao. Với dự đoán Oracle của P2r, 71–73% công suất kết hợp với nhãn nằm dưới 25 Hz, nhưng trung vị tần số của méo bậc dẫn là 67–72 Hz. Tích phân (b) bằng 1,5–1,7 lần, 2,1–2,6 lần và 3,3–4,6 lần tích phân (a) tại σ = 1,5, 2 và 2,5 ms. Cận tính cho cấu trúc này vì vậy không dùng được cho cấu trúc kia. Bản trước viết "hệ số < 1,17, cấu trúc gần như không đổi ρ*". Nhận định đó sai vì chỉ xét |f| ≤ 25 Hz (sửa 29/10/2026). +- Cận 1/B(σ_post) dùng ở mục 1.4 và trong H2b là ρ* dưới (a) với sai số Gauss, lấy dự đoán của mạng Oracle thay cho m (trong bài: 1/B_a). Bài báo cũng báo 1/B_b, cùng ước lượng đó dưới (b), tính post hoc (Bảng `tab:h2b`). Kết quả kiểm post hoc ở ghi chú cuối mục 1.4. + +### 6.5 Mẫu hữu hạn (heuristic, không phải định lý) + +- Bản thân sai số của nhãn là bậc một. Với sai số trung bình 0, phương sai σ²: ỹ − y ≈ δ·y′ dưới (a) và ỹ − y ≈ −ε·ỹ′ dưới (b). Ở bậc này trung bình có điều kiện theo X bằng 0, và với sai số hằng trên cửa sổ, phương sai trong băng là σ² ∫_{|f|≥f_c} (2πf)² S_y df. Phần lớn phương sai này chỉ dịch chuyển phần nhiễu nhãn vốn không đoán được từ X. +- Tới bậc hai theo σ và trung bình trên cửa sổ, phương sai có điều kiện mà một mạng học trên ỹ phải hấp thụ tăng khoảng trung bình của σ² m′² dưới (a) và giảm khoảng chừng đó dưới (b) (Mệnh đề 3). Đây là hiệu ứng bậc hai, so với méo bậc bốn của m̃, nên khi có ít giếng, hiệu ứng mẫu hữu hạn có thể lớn hơn sai lệch quần thể. +- Lập luận gợi ý rằng sai số đúng cấu trúc (b) sẽ không làm mạng kém hơn Oracle tới bậc hai, vì nhãn mang ít nhiễu có điều kiện hơn nhãn thật. Bank còn có thể đổi việc học mẫu hữu hạn theo cách ρ* không thấy: phương sai học được hấp thụ độ trải của bank và giảm trọng số các mẫu mà thành viên bank bất đồng; với λ > 0, responsibilities tái đăng ký nhãn trong lúc huấn luyện (Nhận xét 1). Bài mục 6.3 so lợi ích đo được với ρ*. + +### 6.6 Mệnh đề 5 (coverage) + +Ký hiệu: phương pháp j dự báo trung bình μ và phương sai s² ở mọi mẫu test; v_j = E s², w_j = E(y − μ)², ξ_j = v_j / w_j, kỳ vọng lấy trên mẫu test. ξ = 1 nghĩa là phương sai dự báo khớp sai số bình phương trung bình. `scripts/30_t4_coverage.py` ghi ξ ở cột `kappa`. +- (a) Với mọi j và O: ξ_j − ξ_O = (Δv − ξ_O Δw) / w_j, với Δv = v_j − v_O, Δw = w_j − w_O. +- (b) Cho y dừng và (A1) với P thực, 0 ≤ P ≤ 1. So nhãn điểm tại tối ưu quần thể (μ = m̃, s² = Var(ỹ | X)) với Oracle tại tối ưu (μ = m, s² = Var(y | X)). Khi đó ξ_O = 1 và ξ_j − ξ_O = (2 / w_j) ∫ P(1 − P) S_m df ≥ 0. +- (c) Dưới cấu trúc (b) của Mệnh đề 3, với q_t không phụ thuộc t và y dừng, nhãn điểm tại tối ưu quần thể có ξ_j ≤ 1. Bank hiệu chỉnh có ξ_j = 1. +- Nếu y − μ = sZ/√ξ với Z chuẩn tắc độc lập với s, khoảng μ ± z·s phủ với xác suất 2Φ(z√ξ) − 1, tăng theo ξ. + +**Ý nghĩa và T4 (post hoc, bài mục 6.3, Bảng `tab:t4`).** +- (a) là đồng nhất thức, đúng cho mọi ensemble hữu hạn: j phủ nhiều hơn Oracle khi phương sai dự báo vượt Oracle quá ξ_O lần phần sai số bình phương dư. (b) và (c) là giới hạn quần thể: classical làm rộng khoảng của nhãn điểm, Berkson làm hẹp, bank hiệu chỉnh khớp Oracle. +- Ở ô R10, c = 1, N = 16, mọi ensemble đều quá hẹp: ξ là 0,19 ở Oracle và tối đa 0,66 (B5). Vì ξ_O nhỏ, chỉ cần dư một chút phương sai là phủ nhiều hơn Oracle. +- Độ dài huấn luyện và nguồn nhãn lẫn nhau: B3c-R học 500 vòng lặp (như Oracle) đạt cùng ξ với B3d-Sa ở 250 vòng. Trên dev của Thí nghiệm 1, coverage90 của Oracle đơn lẻ giảm 0,47 → 0,23 → 0,10 sau 125/500/2000 vòng lặp. Vì vậy (b) và (c) **chưa được kiểm**. Không claim hiệu chỉnh. + +### 6.7 Mệnh đề 6 (reference lệch) và Hệ quả 4 (dung sai) + +Thiết lập: reference ở giếng blind là y_ref(t) = y(t + ε_r), với ε_r hằng trên cửa sổ, độc lập với dự đoán ŷ và với nhãn thật y, có hàm đặc trưng Q_r; ŷ và y đồng dừng với phổ chéo S_{ŷy}. +- **Mệnh đề 6.** E|B(ŷ − y_ref)|² = E|B(ŷ − y)|² + 2 ∫_{|f|≥f_c} Re[(1 − Q_r(f)) S_{ŷy}(f)] df. + - Với sai số đối xứng, 0 ≤ 1 − Q_r ≤ 2, nên reference phạt sự khớp trong băng với nhãn thật. Số hạng thêm phụ thuộc phương pháp, nên có thể đảo thứ hạng hai phương pháp, và không triệt tiêu khi lấy trung bình qua giếng: thêm giếng blind giảm phương sai của phép so sánh, không giảm độ lệch. +- **Hệ quả 4.** Với hai phương pháp A và B, gọi G là lợi thế band MSE thật của A và G_r là lợi thế đo với y_ref. Khi đó G_r − G = 2 ∫_{|f|≥f_c} Re[(1 − Q_r)(S_{ŷ_B y} − S_{ŷ_A y})] df. + - Lấy ŷ_A = Hm và ŷ_B = HPm với các bộ lọc thực 0 ≤ H, P ≤ 1 (A học Oracle, B học tối ưu bị mờ của (a), cả hai bị co bởi cùng hệ số mẫu hữu hạn H). Khi đó G = ∫ H(1 − P)[2 − H(1 + P)] S_m df ≥ 0 và G_r = ∫ H(1 − P)[2Q_r − H(1 + P)] S_m df. + - Với H = 1 và sai số Gauss trung bình 0 có độ lệch chuẩn σ (tie của nhãn điểm) và σ_r (reference): 2Q_r − 1 − P = 2π²f²(σ² − 2σ_r²) + O(f⁴). Ở bậc dẫn, **lợi thế đo được cùng dấu với lợi thế thật chỉ khi σ_r < σ/√2**. + - Co rút nới điều kiện này, vì 2Q_r − H(1 + P) tăng khi H giảm. Nếu B quá sắc, như dưới (b), với ŷ_B = HKm và K ≥ 1, thì G_r − G = 2 ∫ H(K − 1)(1 − Q_r) S_m df ≥ 0: reference phóng đại lợi thế của A. + - Độc lập giữa ε_r và dự đoán hợp lý với reference từ checkshot hoặc VSP. Reference tie bằng khớp synthetic–seismic phụ thuộc cùng seismic với dự đoán, và sai số của nó thêm một số hạng hiệp phương sai vào công thức của Mệnh đề 6. + +**Kiểm bằng mô phỏng (T3, exploratory; bài mục 6.5, Bảng `tab:t3`; `scripts/27_t3_power.py`).** +- Ở ba ô N = 16, tỉ số band RMSE trung vị M2-Sa/đối thủ cắt 1 ở σ_ref = 3,6–4,3 ms, so với σ/√2 = 3,0/4,1/5,1 ms (sai số warp RMS của B3c-R trên giếng train là 4,2/5,8/7,3 ms ở R10/R0/Rm5): cùng thứ tự, lệch không quá 1 ms. +- Với reference chính xác, sign test một phía (α = 0,05) đạt power 0,8 với 5–18 giếng blind ở 5/6 ô (ô R10, N = 4 không đạt vì ICC 0,45). Ở σ_ref = 1 ms, bốn ô cần 11–30 giếng; ở 2 ms chỉ R0 còn trong 40 giếng (23 và 37); từ 3 ms trở lên không ô nào đạt. +- Luật k-of-n của hai gate field không phải phép kiểm: khi không có khác biệt thật và giếng độc lập, nó vẫn đạt với xác suất 5/16 = 0,31 (n = 4) và 7/64 = 0,11 (n = 6). ## Tài liệu diff --git a/exploratory/p4x_volve.py b/exploratory/p4x_volve.py new file mode 100644 index 0000000..8555255 --- /dev/null +++ b/exploratory/p4x_volve.py @@ -0,0 +1,416 @@ +"""P4x: exploratory, post hoc model variants on Volve (docs/research/p4-exploratory.md). + +Not part of any locked protocol. Imports the locked P4 code read-only (data views, folds, banks, trajectory trainer, +nested selection and scoring) and changes only what a variant declares: a low-frequency trend subtracted from the +targets (V1a velocity, V1b TWT), the network width (V2a) or a linear-Gaussian model (V2b, V3). + + python exploratory/p4x_volve.py paths # velocity/TVDSS along every path (no label) + python exploratory/p4x_volve.py train --variants V0 V1a ... --methods B3b M2-Sa --workers 8 --device cuda:0 + python exploratory/p4x_volve.py summarize # V0a check, every variant, reference predictors +""" + +from __future__ import annotations + +import argparse +import copy +import itertools +import json +import sys +import time +from concurrent.futures import FIRST_COMPLETED, ProcessPoolExecutor, wait +from datetime import datetime, timezone +from multiprocessing import get_context +from pathlib import Path + +import numpy as np + +REPO = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(REPO)) + +from ml_porosity.volve.folds import prediction_targets, target_name # noqa: E402 +from ml_porosity.volve.runner import fold_sets, job_path, load_bundle, reg_path, save_npz # noqa: E402 + +P4 = REPO / "outputs" / "p4" +OUT = REPO / "outputs" / "p4x" +VEL = (REPO / "data/Volve/Seismic/ST10010/Velocities" + / "ST10010ZC11-MIG-VEL.MIG_VEL.VELOCITY.3D.JS-017527.segy") +SA = 7.0 +LABEL = "PHIF" +VARIANTS = { + "V0": dict(trend=None, model="cnn", d=64), # retraining check (seed 0 only) + "V1a": dict(trend="velocity", model="cnn", d=64), + "V1b": dict(trend="twt", model="cnn", d=64), + "V2a": dict(trend=None, model="cnn", d=8), + "V2b": dict(trend=None, model="linear"), + "V3": dict(trend="velocity", model="linear"), +} + + +def stamp() -> str: + return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") + + +def protocol() -> dict: + from ml_porosity.volve.protocol import load_protocol + return load_protocol() + + +# ---------------------------------------------------------------- velocity and depth along every path (no label) + +def velocity_cube(): + import segyio + with segyio.open(VEL, iline=189, xline=193) as f: + cube = segyio.tools.cube(f).astype(np.float64) + il, xl, z = np.asarray(f.ilines, float), np.asarray(f.xlines, float), np.asarray(f.samples, float) + h = np.array([[t[segyio.su.iline], t[segyio.su.xline], t[segyio.su.cdpx], t[segyio.su.cdpy], + t[segyio.su.scalco]] for t in f.header], float) + scale = np.where(h[:, 4] < 0, -1.0 / h[:, 4], np.where(h[:, 4] > 0, h[:, 4], 1.0)) + xy = h[:, 2:4] * scale[:, None] + A = np.c_[xy, np.ones(len(xy))] + coef, *_ = np.linalg.lstsq(A, h[:, :2], rcond=None) # (x, y, 1) -> (il, xl) + resid = np.abs(A @ coef - h[:, :2]).max() + return cube, (il, xl, z), coef, float(resid) + + +def build_paths() -> None: + """V(t) and TVDSS(t) on the main window for every (well, key) path in the dataset: key 'reference' and every + blind key. Uses the well path (public survey) and the seismic-derived velocity only; no log, pick or label.""" + from scipy.interpolate import RegularGridInterpolator + from ml_porosity.volve.data import load_arrays + + p = protocol() + arrays = load_arrays() + cube, (il, xl, z), coef, resid = velocity_cube() + interp = RegularGridInterpolator((il, xl, z), cube, method="linear", bounds_error=True) + main = arrays[f"{p['data']['wells'][0]}/main_mask"].astype(bool) + t_main = arrays[f"{p['data']['wells'][0]}/times_ms"][main] + out, qc = {"times_ms": t_main}, {"affine_max_residual_bins": resid, "paths": {}} + for w in p["data"]["wells"]: + smd, stvd = arrays[f"{w}/survey/md"], arrays[f"{w}/survey/tvd"] + sx, sy, kb = arrays[f"{w}/survey/x"], arrays[f"{w}/survey/y"], float(arrays[f"{w}/kb_msl"]) + keys = ["reference"] + sorted({k.split("/")[2] for k in arrays if k.startswith(f"{w}/blind/")}) + for key in keys: + base = f"{w}/{'reference' if key == 'reference' else 'blind/' + key}" + md = arrays[f"{base}/md"][main] + x, y = np.interp(md, smd, sx), np.interp(md, smd, sy) + tvdss = np.interp(md, smd, stvd) - kb + ij = np.c_[x, y, np.ones_like(x)] @ coef + v = interp(np.c_[ij, tvdss]) + out[f"{w}|{key}/velocity"], out[f"{w}|{key}/tvdss"] = v, tvdss + q = {"dil_vs_dataset": float(np.abs(ij[:, 0] - arrays[f"{base}/il"][main]).max()), + "dxl_vs_dataset": float(np.abs(ij[:, 1] - arrays[f"{base}/xl"][main]).max()), + "v_range": [float(v.min()), float(v.max())]} + if key == "reference": + q["dtvd_vs_dataset_m"] = float(np.abs(tvdss + kb - arrays[f"{base}/tvd"][main]).max()) + qc["paths"][f"{w}|{key}"] = q + OUT.mkdir(parents=True, exist_ok=True) + np.savez_compressed(OUT / "paths.npz", **out) + worst = {k: max(q[k] for q in qc["paths"].values() if k in q) + for k in ("dil_vs_dataset", "dxl_vs_dataset", "dtvd_vs_dataset_m")} + qc["worst"] = worst + (OUT / "paths_qc.json").write_text(json.dumps(qc, indent=1), encoding="utf-8") + print(json.dumps({"affine_max_residual_bins": resid, **worst})) + + +# ---------------------------------------------------------------- trends (training wells of each set only) + +def covariate(paths: dict, kind: str, well: str, key: str) -> np.ndarray: + if kind == "velocity": + return paths[f"{well}|{key}/velocity"] + return paths["times_ms"].astype(float) + + +def fit_trend(kind: str, paths: dict, labels: dict[str, np.ndarray]) -> tuple[float, float, float]: + """OLS of the label on the covariate over all labelled samples of the given wells (path: reference). + Returns (a, b, residual SD).""" + c = np.concatenate([covariate(paths, kind, w, "reference")[np.isfinite(y)] for w, y in labels.items()]) + y = np.concatenate([y[np.isfinite(y)] for y in labels.values()]) + if kind is None or kind == "constant": + return float(y.mean()), 0.0, float(y.std()) + A = np.c_[np.ones_like(c), c] + (a, b), *_ = np.linalg.lstsq(A, y, rcond=None) + return float(a), float(b), float(np.std(y - A @ np.array([a, b]))) + + +def b3b_labels(names) -> dict[str, np.ndarray]: + """B3b-tie labels (fraction, main window, NaN off support) of the wells of a registration set.""" + z = load_bundle(reg_path(P4, names, SA)) + Y = z[f"{LABEL}/B3b"] + return {w: Y[i, 0] for i, w in enumerate(z["wells"])} + + +# ---------------------------------------------------------------- linear-Gaussian model (V2b, V3) + +def linear_factory(method, channels, cfg): + import torch + from torch import nn + import torch.nn.functional as F + + class LinearGaussian(nn.Module): + """μ = Conv1d(patch channels → 1, kernel k) + bias; a single scalar σ = softplus(s) + σ_min.""" + + def __init__(self, in_ch: int, k: int = 9, sigma_min: float = 1e-3): + super().__init__() + self.conv = nn.Conv1d(in_ch, 1, k, padding=k // 2) + self.s = nn.Parameter(torch.zeros(1)) + self.sigma_min = sigma_min + + def forward(self, x): + mu = self.conv(x) + return mu, (F.softplus(self.s) + self.sigma_min).expand_as(mu) + + torch.backends.cudnn.benchmark = False + torch.backends.cudnn.deterministic = True + return LinearGaussian(channels, cfg.get("kernel", 9)) + + +# ---------------------------------------------------------------- one trajectory + +def train_job(job: dict) -> dict: + import torch + import ml_porosity.volve.training as T + from ml_porosity.f3.training import make_model as cnn_factory + from ml_porosity.volve.data import VolveData + + p, v = job["p"], VARIANTS[job["variant"]] + root = OUT / job["variant"] + names = tuple(sorted(job["names"])) + path = job_path(root, names, job["method"], LABEL, job["seed"], SA) + if path.exists(): + return {"cached": True, "path": str(path)} + T.make_model = linear_factory if v["model"] == "linear" else cnn_factory + cfg = dict(p["training"]) + if v["model"] == "cnn": + cfg["d_channels"] = v["d"] + data = VolveData(p, training_wells=names) + bundle = load_bundle(reg_path(P4, names, SA)) + if tuple(bundle["wells"]) != names: + raise RuntimeError("Registration cache contains different wells") + targets = prediction_targets(data.wells, names) + X = np.stack([data.X(w, "reference") for w in names]) + X_targets = np.stack([data.X(w, k) for w, k in targets]) + spec = T.method_spec(bundle, LABEL, job["method"]) + m0, s0 = bundle[f"{LABEL}/norm"] + trend_meta = {} + if v["trend"]: + with np.load(OUT / "paths.npz") as z: + paths = {k: z[k] for k in z.files} + Yb = bundle[f"{LABEL}/B3b"] + a, b, rsd = fit_trend(v["trend"], paths, {w: Yb[i, 0] for i, w in enumerate(names)}) + tr_train = np.stack([a + b * covariate(paths, v["trend"], w, "reference") for w in names]) + tr_targets = np.stack([a + b * covariate(paths, v["trend"], w, k) for w, k in targets]) + spec["Y"] = spec["Y"] - ((tr_train - m0) / s0)[:, None, :] + trend_meta = {"trend": v["trend"], "a": a, "b": b, "residual_sd": rsd} + else: + tr_targets = np.full((len(targets), X.shape[2]), m0) + pred, meta = T.train_trajectory(X, X_targets, spec, job["method"], cfg, job["seed"], p["training"]["budgets"], + job["device"], None, p["runtime"]["cpu_threads_per_worker"]) + pred = {k: (val * s0 + tr_targets if k.endswith("/mu") else val * s0) for k, val in pred.items()} + pred |= {"targets": np.asarray([target_name(w, k) for w, k in targets]), "wells": np.asarray(names), + "norm": bundle[f"{LABEL}/norm"]} + if v["trend"]: + pred["trend_targets"] = tr_targets + save_npz(path, pred) + path.with_suffix(".json").write_text(json.dumps(meta | trend_meta | { + "variant": job["variant"], "training_wells": list(names), "method": job["method"], "seed": job["seed"], + "device": job["device"], "finished": stamp(), "torch": torch.__version__}, indent=1), encoding="utf-8") + return {"cached": False, "path": str(path), "wall_seconds": meta["wall_seconds"]} + + +def run_train(variants, methods, seeds, workers, device) -> None: + p = protocol() + jobs = [dict(p=p, variant=var, names=list(n), method=m, seed=s, device=device) + for var in variants for m in methods for s in ([0] if var == "V0" else seeds) for n in fold_sets(p)] + todo = [j for j in jobs if not job_path(OUT / j["variant"], j["names"], j["method"], LABEL, j["seed"], + SA).exists()] + print(f"{stamp()} train: {len(jobs)} jobs, {len(todo)} to run, workers={workers}, device={device}", flush=True) + begin, done = time.time(), 0 + with ProcessPoolExecutor(workers, mp_context=get_context("spawn")) as ex: + pending = {ex.submit(train_job, j): j for j in todo} + while pending: + finished, _ = wait(pending, return_when=FIRST_COMPLETED) + for f in finished: + j = pending.pop(f) + f.result() + done += 1 + if done % 10 == 0 or not pending: + el = time.time() - begin + print(f"{stamp()} {done}/{len(todo)} {j['variant']} {j['method']} s{j['seed']} " + f"elapsed {el / 60:.1f} min, eta {el / done * (len(todo) - done) / 60:.1f} min", flush=True) + + +# ---------------------------------------------------------------- evaluation + +def extra(y: np.ndarray, mu: np.ndarray, sigma: np.ndarray) -> dict: + """Porosity units; labelled samples only.""" + from scipy.stats import norm + ok = np.isfinite(y) + y, mu, sigma = 100 * y[ok], 100 * mu[ok], np.maximum(100 * sigma[ok], 1e-6) + e = mu - y + bias = e.mean() + out = dict(n=int(ok.sum()), rmse=float(np.sqrt(np.mean(e ** 2))), bias=float(bias), abs_bias=float(abs(bias)), + rmse_debiased=float(np.sqrt(np.mean((e - bias) ** 2))), label_sd=float(y.std()), + pcc=float(np.corrcoef(y, mu)[0, 1]) if mu.std() > 0 else np.nan, + r2=float(1 - np.mean(e ** 2) / y.var())) + for lev in (80, 90): + zq = norm.ppf(0.5 + lev / 200) + out[f"coverage_{lev}"] = float(np.mean(np.abs(e) <= zq * sigma)) + out["debiased_over_sd"] = out["rmse_debiased"] / out["label_sd"] + return out + + +def variant_predictions(variant: str, p: dict, arrays: dict) -> tuple[list[dict], list[str]]: + from ml_porosity.volve.evaluation import neural_predictions + root = OUT / variant + methods = [m for m in ("B3b", "B3d-Sa", "M2-Sa") + if all(job_path(root, n, m, LABEL, s, SA).exists() + for n in fold_sets(p) for s in p["split"]["seeds"])] + if not methods: + return [], [] + q = copy.deepcopy(p) + q["methods"]["main"] = methods + pred, _ = neural_predictions(q, root, arrays, [SA]) + return [a for a in pred if a["seed"] == "ensemble"], methods + + +def reference_predictors(p: dict, arrays: dict, paths: dict) -> list[dict]: + """T0 constant, T1a velocity trend, T1b TWT trend: fitted on the outer training wells (B3b labels), applied + along the outer test well's blind path T_out.""" + from ml_porosity.data.volve_wells import blind_key + from ml_porosity.volve.folds import outer_folds + from ml_porosity.volve.protocol import source_config + p4 = source_config(p)["p4"] + labels = {} + for names in fold_sets(p): + for w, y in b3b_labels(names).items(): + if w in labels and not np.allclose(labels[w], y, equal_nan=True): + raise RuntimeError(f"B3b labels of {w} differ between sets") + labels[w] = y + out = [] + for scheme in p["split"]["schemes"]: + for test, train in outer_folds(p["data"]["wells"], scheme, p4): + key = blind_key(train) + for name, kind in (("T0", "constant"), ("T1a", "velocity"), ("T1b", "twt")): + a, b, rsd = fit_trend(kind, paths, {w: labels[w] for w in train}) + mu = a + b * (covariate(paths, kind, test, key) if kind != "constant" else 0.0) + mu = np.broadcast_to(mu, paths["times_ms"].shape).astype(float) + out.append(dict(variant=name, scheme=scheme, test_well=test, method="trend-only", + mu=mu, sigma=np.full_like(mu, rsd), a=a, b=b)) + return out + + +def summarize() -> None: + import pandas as pd + from ml_porosity.volve.data import VolveData, load_arrays + from ml_porosity.volve.evaluation import neural_predictions + + p = protocol() + arrays = load_arrays() + full = VolveData(p, arrays=arrays) + ref = p["data"]["primary_reference"] + report = {"created": stamp()} + + # V0a: locked trajectories through this harness + locked = pd.read_csv(P4 / "summary" / "metrics.csv") + locked = locked[(locked.seed.astype(str) == "ensemble") & (locked.reference == ref) & (locked.sigma_a_ms == SA)] + pred, _ = neural_predictions(p, P4, arrays, [SA]) + diffs = [] + for a in pred: + if a["seed"] != "ensemble": + continue + row = locked[(locked.scheme == a["scheme"]) & (locked.test_well == a["test_well"]) + & (locked.method == a["method"])] + diffs.append(abs(extra(full.y(a["test_well"], ref), a["mu"], a["sigma"])["rmse"] - float(row.rmse.iloc[0]))) + report["V0a_max_abs_rmse_diff"] = float(max(diffs)) + report["V0a_rows"] = len(diffs) + rows = [] + for a in pred: + if a["seed"] == "ensemble" and a["method"] in ("B3b", "B3d-Sa", "M2-Sa"): + rows.append(dict(variant="P4", scheme=a["scheme"], test_well=a["test_well"], method=a["method"]) + | extra(full.y(a["test_well"], ref), a["mu"], a["sigma"])) + + # V0b: retrained seed-0 trajectories versus the stored P4 ones + v0 = [] + for names in fold_sets(p): + for m in ("B3b", "M2-Sa"): + mine, theirs = job_path(OUT / "V0", names, m, LABEL, 0, SA), job_path(P4, names, m, LABEL, 0, SA) + if not mine.exists(): + continue + a, b = load_bundle(mine), load_bundle(theirs) + assert list(a["targets"]) == list(b["targets"]) + v0.append(max(float(np.max(np.abs(a[k] - b[k]))) for k in a if k.endswith("/mu") or k.endswith("/sigma"))) + report["V0b_trajectories"] = len(v0) + report["V0b_max_abs_diff_fraction"] = float(max(v0)) if v0 else None + report["V0b_median_max_abs_diff_fraction"] = float(np.median(v0)) if v0 else None + + for variant in ("V1a", "V1b", "V2a", "V2b", "V3"): + preds, methods = variant_predictions(variant, p, arrays) + report[f"{variant}_methods"] = methods + for a in preds: + rows.append(dict(variant=variant, scheme=a["scheme"], test_well=a["test_well"], method=a["method"]) + | extra(full.y(a["test_well"], ref), a["mu"], a["sigma"])) + with np.load(OUT / "paths.npz") as z: + paths = {k: z[k] for k in z.files} + for a in reference_predictors(p, arrays, paths): + rows.append({k: a[k] for k in ("variant", "scheme", "test_well", "method")} + | extra(full.y(a["test_well"], ref), a["mu"], a["sigma"]) | dict(trend_a=a["a"], trend_b=a["b"])) + + per = pd.DataFrame(rows) + dest = OUT / "summary" + dest.mkdir(parents=True, exist_ok=True) + per.to_csv(dest / "per_well.csv", index=False) + cols = ["rmse", "abs_bias", "rmse_debiased", "label_sd", "debiased_over_sd", "pcc", "r2", "coverage_80", + "coverage_90"] + g = per.groupby(["variant", "scheme", "method"], sort=False) + macro = g[cols].mean().join(g.size().rename("n_wells")) + macro["wells_r2_pos"] = g.r2.apply(lambda s: int((s > 0).sum())) + macro["wells_debiased_le_0.9sd"] = g.debiased_over_sd.apply(lambda s: int((s <= 0.9).sum())) + macro = macro.reset_index() + macro["skill"] = (macro.r2 > 0) | (macro.rmse_debiased <= 0.9 * macro.label_sd) + macro.to_csv(dest / "macro.csv", index=False) + + gaps = [] + for (variant, scheme), d in per[per.method.isin(["B3b", "M2-Sa"])].groupby(["variant", "scheme"], sort=False): + w = d.pivot(index="test_well", columns="method", values=["rmse", "rmse_debiased"]) + if ("rmse", "M2-Sa") not in w or ("rmse", "B3b") not in w: + continue + dr = w[("rmse", "M2-Sa")] - w[("rmse", "B3b")] + dd = w[("rmse_debiased", "M2-Sa")] - w[("rmse_debiased", "B3b")] + gaps.append(dict(variant=variant, scheme=scheme, macro_gap_rmse=float(dr.mean()), + macro_gap_rmse_debiased=float(dd.mean()), wells_m2_better=int((dr < 0).sum()), + n_wells=int(dr.size), **{f"gap_{k}": float(x) for k, x in dr.items()})) + gaps = pd.DataFrame(gaps) + gaps.to_csv(dest / "gap_m2_minus_b3b.csv", index=False) + (dest / "checks.json").write_text(json.dumps(report, indent=1), encoding="utf-8") + + text = ["# P4x — exploratory Volve variants (post hoc; see docs/research/p4-exploratory.md)", "", + f"Generated {report['created']}. σ_a = 7 ms, primary reference `{ref}`, combined ensembles, " + "porosity units. Exploratory: cannot support plan §10 claims or alter G-D.", "", + "## Checks", "", "```", json.dumps(report, indent=1), "```", "", + "## Macro over wells", "", macro.to_markdown(index=False, floatfmt=".3f"), "", + "## M2-Sa − B3b (RMSE, p.u.; negative = M2-Sa better)", "", + gaps.to_markdown(index=False, floatfmt=".3f") if len(gaps) else "(none)", "", + "Per-well rows: per_well.csv. Skill: macro R² > 0 or macro bias-removed RMSE ≤ 0.9 × macro label SD."] + (dest / "summary.md").write_text("\n".join(text) + "\n", encoding="utf-8") + print(json.dumps(report, indent=1)) + + +def main() -> None: + ap = argparse.ArgumentParser() + ap.add_argument("stage", choices=["paths", "train", "summarize"]) + ap.add_argument("--variants", nargs="+", default=["V0", "V1a", "V1b", "V2a", "V2b"]) + ap.add_argument("--methods", nargs="+", default=["B3b", "M2-Sa"]) + ap.add_argument("--seeds", nargs="+", type=int, default=[0, 1, 2, 3, 4]) + ap.add_argument("--workers", type=int, default=8) + ap.add_argument("--device", default="cuda:0") + a = ap.parse_args() + if a.stage == "paths": + build_paths() + elif a.stage == "train": + run_train(a.variants, a.methods, a.seeds, a.workers, a.device) + else: + summarize() + + +if __name__ == "__main__": + main() diff --git a/exploratory/run_p4x.sh b/exploratory/run_p4x.sh new file mode 100755 index 0000000..429f41f --- /dev/null +++ b/exploratory/run_p4x.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# P4x exploratory driver (docs/research/p4-exploratory.md): required methods of every variant first, then B3d-Sa, +# then the optional V3. Completed trajectories are skipped, so the driver can be restarted. +set -euo pipefail +cd "$(dirname "$0")/.." +DEVICE="${DEVICE:-cuda:0}" +WORKERS="${WORKERS:-8}" +export OMP_NUM_THREADS=2 MKL_NUM_THREADS=2 OPENBLAS_NUM_THREADS=2 NUMEXPR_NUM_THREADS=2 NUMBA_NUM_THREADS=2 \ + PYTHONHASHSEED=0 PYTHONUTF8=1 CUBLAS_WORKSPACE_CONFIG=:4096:8 +run() { scripts/runlog.sh -n "p4x_$1" -- exploratory/p4x_volve.py train --device "$DEVICE" --workers "$WORKERS" "${@:2}"; } +run required --variants V0 V1a V1b V2a V2b --methods B3b M2-Sa +run b3d --variants V1a V1b V2a V2b --methods B3d-Sa +run v3 --variants V3 --methods B3b M2-Sa B3d-Sa diff --git a/logs/index.csv b/logs/index.csv index ed49b28..42daa71 100644 --- a/logs/index.csv +++ b/logs/index.csv @@ -143,3 +143,12 @@ run_id,parent,name,status,exit_code,start,end,wall_s,wall,device,git,dirty,code_ 20261028-001548_p3_all,,p3_all,failed,1,2026-10-28T00:15:48+07:00,2026-10-28T03:57:33+07:00,13305.6,3:41:46,cuda:0,a22f9d951fe3,True,04bf3e1e27b1e1b7,runlog,'C:\Users\PC\Documents\ML-Porosity\.venv\Scripts\python.exe' -X utf8 'C:\Users\PC\Documents\ML-Porosity\scripts\19_run_f3.py' all --device cuda:0 --workers 4 20261028-064743_p3_volume_recovery,,p3_volume_recovery,ok,0,2026-10-28T06:47:43+07:00,2026-10-28T06:50:45+07:00,182.2,0:03:02,cuda:0,a22f9d951fe3,True,04bf3e1e27b1e1b7,runlog,'.\.venv\Scripts\python.exe' -X utf8 operations/resume_f3_volume.py --device cuda:0 20261028-065050_p3_completion_audit,,p3_completion_audit,ok,0,2026-10-28T06:50:50+07:00,2026-10-28T06:51:16+07:00,26.1,0:00:26,,a22f9d951fe3,True,04bf3e1e27b1e1b7,runlog,'.\.venv\Scripts\python.exe' -X utf8 operations/check_f3_completion.py +20261029-011622_p4_benchmark,,p4_benchmark,ok,0,2026-10-29T01:16:22+00:00,2026-10-29T01:16:48+00:00,25.5,0:00:25,cuda:1,7da6b077b6e3,True,d3410f1130a74cc3,runlog,/home/jovyan/lamlvh/ML-Porosity/.venv/bin/python scripts/24_run_volve.py benchmark --device cuda:1 +20261029-011736_p4_lock_primary,,p4_lock_primary,ok,0,2026-10-29T01:17:36+00:00,2026-10-29T01:17:43+00:00,6.2,0:00:06,cuda:1,7da6b077b6e3,True,a6f9ea223246c9b7,runlog,.venv/bin/python scripts/24_run_volve.py lock --device cuda:1 --workers 8 --arms primary +20261029-011750_p4_register_primary,,p4_register_primary,ok,0,2026-10-29T01:17:50+00:00,2026-10-29T01:20:36+00:00,166.6,0:02:47,cuda:1,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py register --device cuda:1 --workers 8 --arms primary +20261029-012257_p4_register_sensitivity,,p4_register_sensitivity,ok,0,2026-10-29T01:22:57+00:00,2026-10-29T01:28:25+00:00,327.6,0:05:28,cuda:0,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py register --device cuda:0 --workers 8 --arms sensitivity +20261029-012036_p4_train_primary,,p4_train_primary,ok,0,2026-10-29T01:20:36+00:00,2026-10-29T02:07:23+00:00,2806.5,0:46:46,cuda:1,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py train --device cuda:1 --workers 8 --arms primary +20261029-020723_p4_summarize_primary,,p4_summarize_primary,ok,0,2026-10-29T02:07:23+00:00,2026-10-29T02:07:32+00:00,8.4,0:00:08,cuda:1,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py summarize --device cuda:1 --workers 8 --arms primary +20261029-012825_p4_train_sensitivity,,p4_train_sensitivity,ok,0,2026-10-29T01:28:25+00:00,2026-10-29T02:21:04+00:00,3159.2,0:52:39,cuda:0,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py train --device cuda:0 --workers 8 --arms sensitivity +20261029-022117_p4_summarize_all,,p4_summarize_all,ok,0,2026-10-29T02:21:17+00:00,2026-10-29T02:21:36+00:00,18.7,0:00:19,cpu,7da6b077b6e3,True,984655c40e2413fc,runlog,.venv/bin/python scripts/24_run_volve.py summarize --device cpu --workers 4 --arms all +20261029-040703_p4x_summarize_partial,,p4x_summarize_partial,ok,0,2026-10-29T04:07:03+00:00,2026-10-29T04:07:10+00:00,7.1,0:00:07,,7da6b077b6e3,True,9b97ea3ba76b1136,runlog,/home/jovyan/lamlvh/ML-Porosity/.venv/bin/python exploratory/p4x_volve.py summarize diff --git a/ml_porosity/data/deviated.py b/ml_porosity/data/deviated.py new file mode 100644 index 0000000..736422a --- /dev/null +++ b/ml_porosity/data/deviated.py @@ -0,0 +1,281 @@ +"""Deviated-well geometry and time–depth relationships (Volve, plan phase P4). + +Conventions: MD and TVD are metres below the rotary kelly bushing (RKB); TVDSS = TVD − (KB − MSL), positive +down; X/Y are projected easting/northing (m) with grid north; times are two-way times (ms) from the seismic datum. + +Seismic time is vertical time, whereas a sonic tool measures slowness along the borehole. The vertical sonic TDR +therefore integrates DT over TVD instead of MD (isotropic, flat-layer approximation). Anisotropy and dip are left +to the anchor calibration and, in RML, to the warp prior. All TDRs stay keyed by MD, so `log_to_time` and +`calibrate_to_anchors` apply unchanged. +""" + +from __future__ import annotations + +from dataclasses import dataclass +from pathlib import Path + +import numpy as np +from scipy import integrate + +from ml_porosity.data.tdr import TDR, US_PER_M_TO_S_PER_M, _interp_extrap, calibrate_to_anchors + +_COLUMNS = ("MD", "Inc", "Azim", "TVD") +_NODE_STEP_M = 1.0 # MD spacing of TDR nodes outside the logged interval (TVD is curved between survey stations) + + +def _tangent(inc_deg, azi_deg) -> np.ndarray: + """Unit tangent (east, north, down) from inclination and grid azimuth in degrees.""" + i, a = np.radians(inc_deg), np.radians(azi_deg) + return np.stack([np.sin(i) * np.sin(a), np.sin(i) * np.cos(a), np.cos(i)], axis=-1) + + +def _mc_step(t0: np.ndarray, t1: np.ndarray, dmd) -> np.ndarray: + """Minimum-curvature displacement over arc length `dmd` between unit tangents t0 and t1 (exact on a circular arc).""" + beta = np.arccos(np.clip(np.sum(t0 * t1, axis=-1), -1.0, 1.0)) + small = beta < 1e-9 + rf = np.where(small, 1.0, 2.0 / np.where(small, 1.0, beta) * np.tan(beta / 2)) + return 0.5 * np.asarray(dmd, dtype=float)[..., None] * (t0 + t1) * rf[..., None] + + +def read_compass_header(path: str | Path) -> dict[str, str]: + """`key: value` lines above `SURVEY LIST` in a Compass survey export.""" + head = {} + for s in Path(path).read_text(encoding="latin-1").splitlines(): + if s.strip() == "SURVEY LIST": + return head + if ":" in s: + k, v = s.split(":", 1) + head[k.strip()] = v.strip() + raise ValueError(f"{path}: no SURVEY LIST section") + + +@dataclass(frozen=True) +class Trajectory: + """Survey stations of one wellbore.""" + + name: str + md: np.ndarray # (N,) m RKB, strictly increasing + inc: np.ndarray # deg + azi: np.ndarray # deg from grid north + tvd: np.ndarray # m RKB + x: np.ndarray # easting (m) + y: np.ndarray # northing (m) + kb_msl: float = 0.0 # RKB elevation above MSL (m) + + def __post_init__(self): + arrays = {k: np.asarray(getattr(self, k), dtype=float) for k in ("md", "inc", "azi", "tvd", "x", "y")} + n = arrays["md"].size + if n < 2 or any(a.shape != (n,) for a in arrays.values()): + raise ValueError("trajectory arrays must be 1-D of equal length ≥ 2") + if np.any(np.diff(arrays["md"]) <= 0): + raise ValueError(f"trajectory {self.name!r}: MD is not strictly increasing") + for k, a in arrays.items(): + object.__setattr__(self, k, a) + + @classmethod + def from_compass(cls, path: str | Path, name: str | None = None) -> Trajectory: + """Read a Compass "ACTUAL" survey export (header, then `SURVEY LIST`, a column line, a unit line and + one row per station: MD, Inc, Azim, TVD, X/Y offsets, UTM E/N, DLS).""" + head = read_compass_header(path) + if head.get("Calculation Method") != "Minimum Curvature" or head.get("North Reference") != "Grid": + raise ValueError(f"{path}: expected minimum curvature and grid north, got {head.get('Calculation Method')!r}" + f" / {head.get('North Reference')!r}") + lines = Path(path).read_text(encoding="latin-1").splitlines() + start = next(k for k, s in enumerate(lines) if s.strip() == "SURVEY LIST") + if tuple(lines[start + 1].split()[:4]) != _COLUMNS or "UTM N/S" not in lines[start + 1]: + raise ValueError(f"{path}: unexpected survey columns {lines[start + 1]!r}") + if lines[start + 2].split()[:2] != ["m", "RKB"]: + raise ValueError(f"{path}: MD is not referenced to RKB") + rows = np.array([[float(v) for v in s.split()] for s in lines[start + 3:] if s.strip()]) + if rows.ndim != 2 or rows.shape[1] != 9: + raise ValueError(f"{path}: expected 9 numeric columns per station") + md, inc, azi, tvd, _, _, x, y, _ = rows.T + kb = float(head["KB-MSL"].removesuffix("m")) + return cls(name or head.get("WELLBORE NAME", Path(path).name), md, inc, azi, tvd, x, y, kb) + + def recompute(self) -> np.ndarray: + """Station positions (x, y, tvd) by minimum curvature from the first station; QC against the listed ones.""" + t = _tangent(self.inc, self.azi) + start = np.array([self.x[0], self.y[0], self.tvd[0]]) + return np.vstack([start, start + np.cumsum(_mc_step(t[:-1], t[1:], np.diff(self.md)), axis=0)]) + + def dls(self) -> np.ndarray: + """Dogleg severity (deg/30 m) of each survey interval.""" + t = _tangent(self.inc, self.azi) + beta = np.arccos(np.clip(np.sum(t[:-1] * t[1:], axis=-1), -1.0, 1.0)) + return np.degrees(beta) * 30.0 / np.diff(self.md) + + def at(self, md) -> tuple[np.ndarray, np.ndarray, np.ndarray]: + """(tvd, x, y) at MD: minimum curvature between stations, anchored on the listed station coordinates + (the small closure residual of each interval is spread linearly over it). No extrapolation.""" + md = np.asarray(md, dtype=float) + if np.any(md < self.md[0] - 1e-9) or np.any(md > self.md[-1] + 1e-9): + raise ValueError(f"trajectory {self.name!r}: MD outside the survey {self.md[0]}–{self.md[-1]} m") + i = np.clip(np.searchsorted(self.md, md, side="right") - 1, 0, self.md.size - 2) + dmd = self.md[i + 1] - self.md[i] + f = np.clip((md - self.md[i]) / dmd, 0.0, 1.0) + t = _tangent(self.inc, self.azi) + t0, t1 = t[i], t[i + 1] + beta = np.arccos(np.clip(np.sum(t0 * t1, axis=-1), -1.0, 1.0)) + sb = np.sin(beta) + small = sb < 1e-9 + w0 = np.where(small, 1 - f, np.sin((1 - f) * beta) / np.where(small, 1.0, sb)) + w1 = np.where(small, f, np.sin(f * beta) / np.where(small, 1.0, sb)) + tf = w0[..., None] * t0 + w1[..., None] * t1 # tangent at fraction f of the circular arc + tf = tf / np.linalg.norm(tf, axis=-1, keepdims=True) + p = np.stack([self.x, self.y, self.tvd], axis=-1) + closure = p[i + 1] - p[i] - _mc_step(t0, t1, dmd) + q = p[i] + _mc_step(t0, tf, f * dmd) + f[..., None] * closure + return q[..., 2], q[..., 0], q[..., 1] + + def tvdss(self, md) -> np.ndarray: + return self.at(md)[0] - self.kb_msl + + +def vertical_sonic_tdr(md, tvd, dt_us_per_m, md0: float, t0_ms: float, name: str = "sonic") -> TDR: + """Vertical-time sonic TDR through (md0, t0_ms): t(md) = t0 + 2·∫ DT dTVD from md0 to md. + + Only valid DT samples are used (gaps are integrated as DT varying linearly between their ends). md0 must lie + within the valid DT range, and TVD must increase strictly along it (no well turning upwards).""" + md, tvd, dt = (np.asarray(v, dtype=float) for v in (md, tvd, dt_us_per_m)) + ok = np.isfinite(dt) & (dt > 0) & np.isfinite(tvd) + md_v, tvd_v, dt_v = md[ok], tvd[ok], dt[ok] + if md_v.size < 2: + raise ValueError("no valid DT") + if np.any(np.diff(tvd_v) <= 0): + raise ValueError("TVD does not increase strictly over the logged interval") + if not md_v[0] <= md0 <= md_v[-1]: + raise ValueError(f"anchor MD {md0} lies outside the valid DT range {md_v[0]}–{md_v[-1]} m") + t = 2000.0 * integrate.cumulative_trapezoid(dt_v * US_PER_M_TO_S_PER_M, tvd_v, initial=0.0) + return TDR(md_v, t - np.interp(md0, md_v, t) + t0_ms, name) + + +def _sorted_anchors(anchor_md, anchor_twt_ms) -> tuple[np.ndarray, np.ndarray]: + za, ta = np.asarray(anchor_md, dtype=float), np.asarray(anchor_twt_ms, dtype=float) + order = np.argsort(za, kind="stable") + za, ta = za[order], ta[order] + if np.any(np.diff(za) <= 0) or np.any(np.diff(ta) <= 0): + raise ValueError("anchors must be strictly increasing in MD and TWT") + return za, ta + + +def _nodes(traj: Trajectory, lo: float, hi: float, extra=()) -> np.ndarray: + """Survey stations, a regular MD grid and `extra` points strictly inside (lo, hi), clipped to the survey.""" + grid = np.arange(np.ceil(traj.md[0]), traj.md[-1], _NODE_STEP_M) + z = np.union1d(np.union1d(grid, traj.md), np.asarray(extra, dtype=float)) + return z[(z > lo) & (z < hi)] + + +def calibrated_vertical_tdr(traj: Trajectory, md, dt_us_per_m, anchor_md, anchor_twt_ms, edge_m: float = 30.0, + name: str = "calibrated") -> TDR: + """Marker-calibrated vertical sonic TDR (the scoring reference of plan §5.2) over the whole survey. + + Within the valid DT range: the vertical sonic through the first anchor in that range, stretched between + consecutive anchors in the range and bulk-shifted beyond them (`calibrate_to_anchors`). Outside the valid DT + range, which only places the well path in time and never carries labels: piecewise linear in TVD through the + anchors there, continued at the outermost segment's velocity; with no anchor on that side, constant vertical + velocity equal to the median sonic velocity over the adjacent `edge_m` of logged hole.""" + md, dt = np.asarray(md, dtype=float), np.asarray(dt_us_per_m, dtype=float) + ok = np.isfinite(dt) & (dt > 0) + if ok.sum() < 2: + raise ValueError("no valid DT") + md_v, dt_v = md[ok], dt[ok] + m0, m1 = md_v[0], md_v[-1] + za, ta = _sorted_anchors(anchor_md, anchor_twt_ms) + inside = (za >= m0) & (za <= m1) + if inside.sum() < 2: + raise ValueError(f"{traj.name}: fewer than two anchors within the valid DT range {m0}–{m1} m") + base = vertical_sonic_tdr(md_v, traj.at(md_v)[0], dt_v, za[inside][0], ta[inside][0]) + core = calibrate_to_anchors(base, za[inside], ta[inside], name) + + def extend(nodes: np.ndarray, beyond: np.ndarray, edge_md: float, edge_t: float, edge_dt: np.ndarray): + if nodes.size == 0: + return nodes + zc = np.r_[traj.at(za[beyond])[0], traj.at(edge_md)[0]] + tc = np.r_[ta[beyond], edge_t] + zn = traj.at(nodes)[0] + if zc.size >= 2: + order = np.argsort(zc) + return _interp_extrap(zn, zc[order], tc[order]) + return edge_t + 2000.0 * (zn - zc[0]) / float(np.median(1e6 / edge_dt)) + + up, down = za < m0, za > m1 + md_up = _nodes(traj, -np.inf, m0, za[up]) + md_down = _nodes(traj, m1, np.inf, za[down]) + t_up = extend(md_up, up, m0, core.twt_ms[0], dt_v[md_v <= m0 + edge_m]) + t_down = extend(md_down, down, m1, core.twt_ms[-1], dt_v[md_v >= m1 - edge_m]) + return TDR(np.r_[md_up, core.md, md_down], np.r_[t_up, core.twt_ms, t_down], name) + + +def anchor_tdr(traj: Trajectory, anchor_md, anchor_twt_ms, name: str = "anchors") -> TDR: + """Piecewise linear in TVD between anchors, without the sonic. Meaningful only within the anchor span.""" + za, ta = _sorted_anchors(anchor_md, anchor_twt_ms) + nodes = np.union1d(_nodes(traj, za[0], za[-1]), za) + return TDR(nodes, np.interp(traj.at(nodes)[0], traj.at(za)[0], ta), name) + + +def path_at_times(traj: Trajectory, tdr: TDR, t_ms) -> dict[str, np.ndarray]: + """Well position at each time of `t_ms` under `tdr`. Below TD (or above the first station) the position is + held at the end station, i.e. the path continues vertically; `beyond` flags those samples.""" + md = tdr.depth_at(t_ms) + tvd, x, y = traj.at(np.clip(md, traj.md[0], traj.md[-1])) + return {"md": md, "tvd": tvd, "x": x, "y": y, "beyond": (md < traj.md[0]) | (md > traj.md[-1])} + + +def tvdss_td_model(trajs: list[Trajectory], tdrs: list[TDR], z) -> np.ndarray: + """Mean TWT over wells at TVDSS `z`; each well's MD-keyed TDR is mapped through its own trajectory and + extrapolated linearly beyond its nodes. Used to place a held-out well in time without its own TD data.""" + z = np.asarray(z, dtype=float) + out = [] + for traj, tdr in zip(trajs, tdrs, strict=True): + md = tdr.md[(tdr.md >= traj.md[0]) & (tdr.md <= traj.md[-1])] + zs = traj.tvdss(md) + if np.any(np.diff(zs) <= 0): + raise ValueError(f"{traj.name}: TVDSS does not increase strictly along the TDR nodes") + out.append(_interp_extrap(z, zs, tdr.time_at(md))) + return np.mean(out, axis=0) + + +def tdr_from_tvdss(traj: Trajectory, z_model, t_model, name: str = "tvdss_model") -> TDR: + """MD-keyed TDR of `traj` over its survey from a TVDSS → TWT function (z_model, t_model).""" + md = np.union1d(_nodes(traj, -np.inf, np.inf), traj.md) + return TDR(md, _interp_extrap(traj.tvdss(md), np.asarray(z_model, float), np.asarray(t_model, float)), name) + + +def composite_patch(cube, il, xl, times_ms, radius: int = 1, method: str = "bilinear", + cache: dict | None = None) -> np.ndarray: + """Seismic patch along a well path, shape (C, L) with C = (2r+1)²: channel (di, dx), in the IL-major order of + `SeismicCube.patch`, holds at sample n the trace at (il[n] + di, xl[n] + dx) evaluated at times_ms[n], which + must lie on the cube's sample grid. 'bilinear' interpolates the four surrounding bins; 'nearest' takes the + nearest one. `cube` needs `times_ms`, `dt_ms` and `trace(il, xl)`; `cache` maps (il, xl) to traces.""" + if method not in ("bilinear", "nearest"): + raise ValueError(f"unknown method {method!r}") + il, xl, t = (np.asarray(v, dtype=float) for v in (il, xl, times_ms)) + k = np.rint((t - cube.times_ms[0]) / cube.dt_ms).astype(int) + if np.any(k < 0) or np.any(k >= len(cube.times_ms)) or not np.allclose(cube.times_ms[k], t, rtol=0, atol=1e-6): + raise ValueError("times_ms must lie on the cube's sample grid") + cache = {} if cache is None else cache + + def add(out: np.ndarray, i: np.ndarray, j: np.ndarray, w: np.ndarray) -> None: + on = w > 0 + for key in set(zip(i[on].tolist(), j[on].tolist())): + if key not in cache: + cache[key] = cube.trace(*key) + sel = on & (i == key[0]) & (j == key[1]) + out[sel] += w[sel] * cache[key][k[sel]] + + channels = [] + for di in range(-radius, radius + 1): + for dx in range(-radius, radius + 1): + fi, fj = il + di, xl + dx + out = np.zeros(t.size) + if method == "nearest": + add(out, np.rint(fi).astype(int), np.rint(fj).astype(int), np.ones(t.size)) + else: + i0, j0 = np.floor(fi).astype(int), np.floor(fj).astype(int) + wi, wj = fi - i0, fj - j0 + for a, b, w in ((0, 0, (1 - wi) * (1 - wj)), (0, 1, (1 - wi) * wj), + (1, 0, wi * (1 - wj)), (1, 1, wi * wj)): + add(out, i0 + a, j0 + b, w) + channels.append(out) + return np.stack(channels).astype(np.float32) diff --git a/ml_porosity/data/volve_wells.py b/ml_porosity/data/volve_wells.py new file mode 100644 index 0000000..3177697 --- /dev/null +++ b/ml_porosity/data/volve_wells.py @@ -0,0 +1,126 @@ +"""P4 Volve wells: survey, petrophysical logs and TWT anchors of one wellbore (`p4` section of configs/d3_volve.yaml). + +Logs are taken from the petrophysical interpretation (WLC_PETRO_COMPUTED_INPUT/OUTPUT LAS, MD from RKB) and +converted to the F3 units: DT µs/m, RHOB kg/m³, AI = RHOB·Vp in (m/s)·(kg/m³). Anchors are the well picks with a +TWT, minus the excluded surfaces and quality flags; picks at the same MD (e.g. SHETLAND GP. Top = Ekofisk Fm. Top) +or within `min_sep_m` of a shallower anchor are one marker. +""" + +from __future__ import annotations + +from dataclasses import dataclass, field + +import numpy as np +import pandas as pd + +from ml_porosity.data.deviated import Trajectory, read_compass_header +from ml_porosity.data.las_io import read_las +from ml_porosity.paths import volve_root + +FT_M = 0.3048 +_UNITS = {"DT": {"us/ft"}, "RHOB": {"g/cm3"}, "NPHI": {"v/v", "v/v_decimal"}, "PHIF": {"v/v", "v/v_decimal"}} +ANCHOR_COLUMNS = ["surface", "qlf", "md", "tvd", "tvdss", "twt_ms", "x", "y"] + + +@dataclass(frozen=True) +class VolveWell: + name: str # short name used in P4, e.g. "F-11 T2" + pick_name: str # name in the well picks, e.g. "NO 15/9-F-11 T2" + traj: Trajectory + header: dict[str, str] # Compass survey header + logs: pd.DataFrame # index MD (m RKB) within the survey; DT, RHOB, NPHI, GR, PHIF, AI + anchors: pd.DataFrame # ANCHOR_COLUMNS, strictly increasing in MD and TWT + excluded: pd.DataFrame # picks with a TWT that are not anchors: ANCHOR_COLUMNS + `reason` + qc: dict = field(default_factory=dict) # loader counts: DT samples rejected, samples dropped beyond the survey + + def valid_range(self, curve: str) -> tuple[float, float]: + v = self.logs[curve].dropna() + return float(v.index[0]), float(v.index[-1]) + + def label_support(self, label: str = "PHIF") -> tuple[float, float]: + """MD range of the label within the valid DT range: labels are never placed by an extrapolated TDR.""" + (a, b), (c, d) = self.valid_range(label), self.valid_range("DT") + if max(a, c) >= min(b, d): + raise ValueError(f"{self.name}: {label} and DT do not overlap") + return max(a, c), min(b, d) + + +def blind_training_wells(test: str, scheme: str, p4: dict) -> tuple[str, ...]: + """Wells whose data may be used when `test` is held out: `lowo` all others, `slot` all outside its slot group.""" + if scheme == "lowo": + out = set(p4["wells"]) - {test} + elif scheme == "slot": + group = next(set(g) for g in p4["slot_groups"] if test in g) + out = set(p4["wells"]) - group + else: + raise ValueError(f"unknown blind scheme {scheme!r}") + return tuple(w for w in p4["wells"] if w in out) + + +def blind_key(wells) -> str: + """npz key of the blind input placed in time by the TD model of `wells` (any order).""" + return "+".join(sorted(wells)) + + +def well_anchors(picks: pd.DataFrame, pick_name: str, exclude_surfaces, exclude_qlf, + min_sep_m: float = 0.0) -> tuple[pd.DataFrame, pd.DataFrame]: + """(anchors, excluded) for one well from `read_well_picks` output. A pick at most `min_sep_m` below the last + kept anchor is dropped, preferring picks without a quality flag at equal MD; picks at the same MD must agree + in TWT.""" + p = picks[(picks.well == pick_name) & picks.twt_ms.notna()].copy() + p["reason"] = "" + p.loc[p.qlf.isin(exclude_qlf), "reason"] = "qlf " + p.qlf + p.loc[p.surface.isin(exclude_surfaces), "reason"] = "surface" + cand = p[p.reason == ""].assign(flagged=lambda d: d.qlf != "").sort_values(["md", "flagged"], kind="stable") + keep: list = [] + for i, r in cand.iterrows(): + if keep and r.md - p.at[keep[-1], "md"] <= min_sep_m: + first = p.loc[keep[-1]] + if r.md == first.md and abs(r.twt_ms - first.twt_ms) > 0.1: + raise ValueError(f"{pick_name}: picks at MD {r.md} disagree in TWT") + p.at[i, "reason"] = (f"same MD as {first.surface}" if r.md == first.md + else f"{r.md - first.md:.2f} m below {first.surface}") + else: + keep.append(i) + anchors = p.loc[keep, ANCHOR_COLUMNS].reset_index(drop=True) + if np.any(np.diff(anchors.twt_ms) <= 0): + raise ValueError(f"{pick_name}: anchor TWT does not increase with MD") + excluded = p.loc[p.reason != "", ANCHOR_COLUMNS + ["reason"]].sort_values("md", kind="stable") + return anchors, excluded.reset_index(drop=True) + + +def load_volve_well(name: str, cfg: dict, picks: pd.DataFrame) -> VolveWell: + p4, spec, root = cfg["p4"], cfg["p4"]["wells"][name], volve_root() + survey = root / p4["survey_dir"] / spec["survey"] + traj = Trajectory.from_compass(survey, name) + folder = root / cfg["well_logs_dir"] / spec["logs"] / p4["log_subdir"] + li, ui, _ = read_las(folder / p4["las_input"]) + lo, uo, _ = read_las(folder / p4["las_output"]) + units = ui | {"PHIF": uo.get("PHIF", "")} + for c, ok in _UNITS.items(): + if units.get(c, "").lower() not in ok: + raise ValueError(f"{name}: unexpected unit {units.get(c)!r} for {c}") + + # OUTPUT is sampled on the INPUT MD grid (0.1 m; 0.5 ft for F-12) + key = np.round(li.index.to_numpy(), 3) + phif = pd.Series(lo["PHIF"].to_numpy(), index=np.round(lo.index.to_numpy(), 3)) + if not phif.index.isin(key).all(): + raise ValueError(f"{name}: OUTPUT depths are not on the INPUT grid") + dt_ft = li["DT"].to_numpy(dtype=float) + lo_ft, hi_ft = p4["dt_valid_us_per_ft"] + bad = np.isfinite(dt_ft) & ((dt_ft < lo_ft) | (dt_ft > hi_ft)) + dt = np.where(bad, np.nan, dt_ft) / FT_M + rhob = li["RHOB"].to_numpy(dtype=float) * 1000.0 + logs = pd.DataFrame({"DT": dt, "RHOB": rhob, "NPHI": li["NPHI"].to_numpy(dtype=float), + "GR": li["GR"].to_numpy(dtype=float), "PHIF": phif.reindex(key).to_numpy(dtype=float), + "AI": rhob * 1e6 / dt}, index=pd.Index(li.index.to_numpy(dtype=float), name="MD")) + + # Only positions on the survey can be placed in time. F-12 has GR down to 4187 m below its 3520 m TD. + inside = (logs.index >= traj.md[0]) & (logs.index <= traj.md[-1]) + beyond = logs[~inside].notna().sum() + if beyond[["DT", p4["label"]]].any(): + raise ValueError(f"{name}: DT or {p4['label']} beyond the survey {traj.md[0]}–{traj.md[-1]} m") + anchors, excluded = well_anchors(picks, spec["picks"], cfg["anchor_exclude_surfaces"], p4["anchor_exclude_qlf"], + p4["anchor_min_sep_m"]) + qc = {"n_dt_rejected": int(bad.sum()), "n_beyond_survey": {c: int(n) for c, n in beyond.items() if n}} + return VolveWell(name, spec["picks"], traj, read_compass_header(survey), logs[inside], anchors, excluded, qc) diff --git a/ml_porosity/volve/__init__.py b/ml_porosity/volve/__init__.py new file mode 100644 index 0000000..2dc96e0 --- /dev/null +++ b/ml_porosity/volve/__init__.py @@ -0,0 +1 @@ +"""P4: blind-well Volve experiments with partial labels, separate from the frozen P3 (F3) modules.""" diff --git a/ml_porosity/volve/data.py b/ml_porosity/volve/data.py new file mode 100644 index 0000000..96241b1 --- /dev/null +++ b/ml_porosity/volve/data.py @@ -0,0 +1,144 @@ +"""P4 data views (plan §5.2): private arrays of the training wells, seismic-only blind inputs of every other well. + +A restricted view (training_wells given) keeps, for a well outside the training set, only + + times_ms, main_mask, kb_msl, survey/* the well path, known without its logs or picks + blind//{seismic_patch, md, il, xl, beyond} only for K ⊇ training_wells, well ∉ K + +so its logs, picks, TDRs, reference path and the label-centred bin (il, xl, x, y: placed at the middle of the +label interval) are never loaded. Labels, the reference input and registration observations of such a well +raise RuntimeError. The full view (training_wells None) is for scoring only. +""" + +from __future__ import annotations + +import numpy as np + +from ml_porosity.data.resample import log_to_time +from ml_porosity.data.tdr import TDR +from ml_porosity.models.bank_train import zscore_patch +from ml_porosity.paths import outputs_dir +from ml_porosity.registration.warp_prior import WarpGrid + +PUBLIC = frozenset({"times_ms", "main_mask", "kb_msl"}) +PUBLIC_PREFIXES = ("survey/",) + + +def npz_path(): + return outputs_dir() / "volve" / "volve_wells.npz" + + +def load_arrays(path=None) -> dict[str, np.ndarray]: + with np.load(npz_path() if path is None else path) as z: + return {k: z[k] for k in z.files} + + +def blind_members(key: str) -> frozenset[str]: + return frozenset(key.split("+")) + + +def visible(key: str, training_wells: frozenset[str] | None) -> bool: + """Whether the flat npz key "/" belongs to a view on `training_wells`.""" + well, item = key.split("/", 1) + if training_wells is None or well in training_wells: + return True + if item in PUBLIC or item.startswith(PUBLIC_PREFIXES): + return True + if item.startswith("blind/"): + members = blind_members(item.split("/")[1]) + return well not in members and training_wells <= members + return False + + +class VolveData: + def __init__(self, protocol: dict, training_wells: tuple[str, ...] | None = None, + arrays: dict[str, np.ndarray] | None = None): + self.protocol = protocol + self.wells = list(protocol["data"]["wells"]) + self.label = protocol["data"]["label"] + self.training_wells = None if training_wells is None else frozenset(training_wells) + if self.training_wells is not None and not self.training_wells <= set(self.wells): + raise ValueError("Unknown training well") + source = load_arrays() if arrays is None else arrays + self.arrays = {k: v for k, v in source.items() + if k.split("/", 1)[0] in self.wells and visible(k, self.training_wells)} + self.t = self.ext(self.wells[0], "times_ms") + self.main = self.ext(self.wells[0], "main_mask").astype(bool) + self.t_main = self.t[self.main] + self.dt = float(np.diff(self.t)[0]) + for w in self.wells: + if not (np.array_equal(self.ext(w, "times_ms"), self.t) + and np.array_equal(self.ext(w, "main_mask").astype(bool), self.main)): + raise ValueError(f"Volve time axes differ: {w}") + r = protocol["registration"] + f = r["fine_dt_ms"] + self.grid = WarpGrid(*r["tau_range_ms"], r["warp_dtau_ms"]) + self.tau = np.arange(r["tau_range_ms"][0], r["tau_range_ms"][1] + f / 2, f) + self.t_fine = np.arange(self.t[0] - 300, self.t[-1] + 300 + f / 2, f) + + def is_training(self, well: str) -> bool: + return self.training_wells is None or well in self.training_wells + + def ext(self, well: str, key: str) -> np.ndarray: + try: + return self.arrays[f"{well}/{key}"] + except KeyError: + raise KeyError(f"{well}/{key} is not in this data view") from None + + def blind_keys(self, well: str) -> list[str]: + head = f"{well}/blind/" + return sorted({k[len(head):].split("/")[0] for k in self.arrays if k.startswith(head)}) + + def patch(self, well: str, key: str) -> np.ndarray: + """(C, n_ext) seismic patch: key 'reference' (calibrated path, training wells only) or a blind key.""" + if key == "reference": + if not self.is_training(well): + raise RuntimeError("The reference path of a held-out well uses its own picks and DT") + return self.ext(well, "reference/seismic_patch") + if well in blind_members(key): + raise RuntimeError(f"Blind key {key!r} contains its own well {well!r}") + return self.ext(well, f"blind/{key}/seismic_patch") + + def X(self, well: str, key: str) -> np.ndarray: + """Network input (C, L) on the main window.""" + return zscore_patch(self.patch(well, key), self.main) + + def y(self, well: str, reference: str, label: str | None = None) -> np.ndarray: + """Label on the main window under TDR `reference`; NaN outside its support.""" + if not self.is_training(well): + raise RuntimeError("Held-out labels are unavailable in a training data view") + return self.ext(well, f"{reference}/{label or self.label}")[self.main] + + def training_observations(self, names: tuple[str, ...]) -> list[dict]: + """Registration inputs of training wells on the sonic time axis τ (vertical sonic through the first anchor + in the DT range). Anchors: in the DT range and inside the ext window. `lik`: ext samples from the first to + the last finite calibrated AI sample (the tie likelihood is evaluated there only).""" + if self.training_wells is not None and not set(names) <= self.training_wells: + raise RuntimeError("Held-out logs and anchors are unavailable in a training data view") + r = self.protocol["registration"] + obs = [] + for name in names: + sonic = TDR(self.ext(name, "tdr/sonic/md"), self.ext(name, "tdr/sonic/twt_ms"), "sonic") + md = self.ext(name, "log/md") + amd, att = self.ext(name, "anchors_md"), self.ext(name, "anchors_twt_ms") + keep = self.ext(name, "anchors_in_dt").astype(bool) & (att >= self.t[0]) & (att <= self.t[-1]) + if keep.sum() < 1: + raise ValueError(f"No anchor in the DT range: {name}") + resampled, valid = {}, {} + for curve in ("AI", self.label): + v = log_to_time(md, self.ext(name, f"log/{curve}"), sonic, self.tau, + fine_dt_ms=r["log_fine_dt_ms"], cutoff_frac=r["log_cutoff_frac"]) + good = np.isfinite(v) + if good.sum() < 2: + raise ValueError(f"No sonic-domain log: {name}/{curve}") + resampled[curve] = np.interp(self.tau, self.tau[good], v[good]) + valid[curve] = good + ok = np.flatnonzero(np.isfinite(self.ext(name, "calibrated/AI"))) + lik = np.zeros(self.t.size, bool) + lik[ok[0]: ok[-1] + 1] = True + seis = self.ext(name, "reference/seismic_patch") + obs.append({"name": name, "tau_k": sonic.time_at(amd[keep]), "t_k": att[keep].astype(float), + "ai_log": resampled["AI"], "labels": {self.label: resampled[self.label]}, + "label_valid": {self.label: valid[self.label]}, "lik": lik, + "seis": seis[len(seis) // 2].astype(float)}) + return obs diff --git a/ml_porosity/volve/evaluation.py b/ml_porosity/volve/evaluation.py new file mode 100644 index 0000000..978da25 --- /dev/null +++ b/ml_porosity/volve/evaluation.py @@ -0,0 +1,287 @@ +"""P4 nested selection, scoring and the descriptive G-D report. + +Selection (the budget of each trajectory, the point competitor of each outer fold) reads validation labels through +the data view of the outer training wells, VolveData(training_wells=T_out), which holds no label, log or pick of the +outer test well. Outer-test labels are read only by `score`, after every prediction is fixed. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +import numpy as np +import pandas as pd + +from ml_porosity.data.volve_wells import blind_key +from ml_porosity.eval.metrics import gaussian_metrics, point_metrics +from ml_porosity.f3.evaluation import choose_budget +from ml_porosity.f3.progress import write_json +from ml_porosity.f3.training import ensemble +from ml_porosity.volve.data import VolveData, load_arrays +from ml_porosity.volve.folds import inner_folds, outer_folds, target_name +from ml_porosity.volve.losses import finite_runs, highpass_segment +from ml_porosity.volve.protocol import source_config +from ml_porosity.volve.runner import arm_methods, fold_sets, job_path, load_bundle, reg_path + +Z90 = 1.6448536269514722 +COLUMNS = ["rmse", "mae", "pcc", "r2", "std_ratio", "coverage_80", "coverage_90", "nll", "crps", "mean_sigma", + "band_rmse", "band_pcc"] + + +def neural_predictions(p: dict, root: Path, arrays: dict, sigmas: list[float]) -> tuple[list[dict], list[dict]]: + """Per scheme, outer fold, σ_a arm, method and seed: the budget with the lowest mean validation MSE over the + inner wells (original scale, labelled samples; earliest tie), the inner models ensembled at that budget on the + outer test input (key T_out), then the seeds ensembled.""" + p4 = source_config(p)["p4"] + label, ref, budgets = p["data"]["label"], p["data"]["primary_reference"], p["training"]["budgets"] + cache, predictions, selections = {}, [], [] + for scheme in p["split"]["schemes"]: + for test, outer_train in outer_folds(p["data"]["wells"], scheme, p4): + view = VolveData(p, training_wells=outer_train, arrays=arrays) + folds = inner_folds(outer_train) + labels = {v: view.y(v, ref) for v, _ in folds} + test_key = blind_key(outer_train) + for sa in sigmas: + for method in arm_methods(p, sa): + fold = dict(scheme=scheme, test_well=test, method=method, label=label, sigma_a_ms=sa) + per_seed = [] + for seed in p["split"]["seeds"]: + curves, members = [], [] + for v, t_in in folds: + path = job_path(root, t_in, method, label, seed, sa) + if path not in cache: + cache[path] = load_bundle(path) + z = cache[path] + if tuple(z["wells"]) != tuple(sorted(t_in)): + raise RuntimeError(f"Trajectory trained on other wells: {path}") + names = list(z["targets"]) + y = labels[v] + ok = np.isfinite(y) + i = names.index(target_name(v, blind_key(t_in))) + curves.append([np.mean((z[f"{b}/mu"][i][ok] - y[ok]) ** 2) for b in budgets]) + members.append((z, names.index(target_name(test, test_key)))) + budget = choose_budget(np.array(curves), budgets) + mu, sigma = ensemble(np.stack([z[f"{budget}/mu"][i] for z, i in members]), + np.stack([z[f"{budget}/sigma"][i] for z, i in members])) + entry = fold | dict(seed=seed, members=len(folds), test_key=test_key, mu=mu, sigma=sigma) + predictions.append(entry) + per_seed.append(entry) + selections.append(fold | dict( + seed=seed, budget=budget, + validation_mse=float(np.mean(np.asarray(curves)[:, budgets.index(budget)])), + validation_wells=";".join(v for v, _ in folds), + validation_keys=";".join(blind_key(t) for _, t in folds), + training_sets=";".join(",".join(t) for _, t in folds))) + mu, sigma = ensemble(np.stack([e["mu"] for e in per_seed]), np.stack([e["sigma"] for e in per_seed])) + predictions.append(fold | dict(seed="ensemble", members=sum(e["members"] for e in per_seed), + test_key=test_key, mu=mu, sigma=sigma)) + return predictions, selections + + +def references(full: VolveData, well: str, p: dict) -> list[str]: + """The scoring references that exist for a well (NIVSP and OPTIMIZED only at F-11 T2).""" + return [r for r in p["data"]["references"] if f"{well}/{r}/{full.label}" in full.arrays] + + +def desc_band(y: np.ndarray, mu: np.ndarray, f_c: float, dt: float, min_samples: int) -> dict: + """High-passed (< f_c removed) reference and prediction on each finite reference run of ≥ min_samples, pooled. + Runs are shorter than one period at f_c: descriptive only.""" + runs = [(a, b) for a, b in finite_runs(y) if b - a >= min_samples] + if not runs: + return {"band_samples": 0, "band_rmse": np.nan, "band_pcc": np.nan, "band_std_ratio": np.nan} + t = np.concatenate([highpass_segment(y[a:b], f_c, dt) for a, b in runs]) + q = np.concatenate([highpass_segment(mu[a:b], f_c, dt) for a, b in runs]) + m = point_metrics(t, q) + return {"band_samples": int(t.size)} | {f"band_{k}": m[k] for k in ("rmse", "pcc", "std_ratio")} + + +def score(full: VolveData, pred: dict, reference: str, p: dict) -> dict: + """Metrics in porosity units on the samples where the reference exists; references with fewer than + min_label_samples samples are listed but not scored.""" + y = 100 * full.y(pred["test_well"], reference) + mu, sigma = 100 * pred["mu"], np.maximum(100 * pred["sigma"], 1e-6) + ok = np.isfinite(y) + row = {k: v for k, v in pred.items() if k not in ("mu", "sigma")} | dict(reference=reference, + n_reference=int(ok.sum())) + if ok.sum() < p["data"]["min_label_samples"]: + return row | dict(scored=False) + m = p["metrics"] + return (row | dict(scored=True) | point_metrics(y, mu) | gaussian_metrics(y[ok], mu[ok], sigma[ok]) + | desc_band(y, mu, m["f_c_hz"], full.dt, m["desc_band_min_samples"])) + + +def best_shift(full: VolveData, pred: dict, reference: str, max_shift: int) -> dict: + """Lag (samples, positive = prediction later) maximising PCC with the reference; diagnostic only, smallest |lag| + on ties. Never alters a score.""" + y = full.y(pred["test_well"], reference) + idx = np.flatnonzero(np.isfinite(y)) + best = (-np.inf, 0) + for s in sorted(range(-max_shift, max_shift + 1), key=abs): + j = idx + s + if j[0] < 0 or j[-1] >= pred["mu"].size: + continue + r = point_metrics(y[idx], pred["mu"][j])["pcc"] + if np.isfinite(r) and r > best[0]: + best = (r, s) + return {"best_shift_samples": best[1], "best_shift_ms": best[1] * full.dt, "best_shift_pcc": best[0]} + + +def gate_gd(metrics: pd.DataFrame, selection: pd.DataFrame, p: dict) -> dict: + """G-D: report every well in either direction; claim wording follows protocol_volve gate.claim_rules.""" + g, sa = p["gate"], p["registration"]["sigma_a_ms"] + rules = g["claim_rules"] + primary = metrics[(metrics.reference == p["data"]["primary_reference"]) & (metrics.seed.astype(str) == "ensemble") + & (metrics.sigma_a_ms == sa)] + within = lambda c, band: band[0] - 1e-12 <= c <= band[1] + 1e-12 + schemes = {} + for scheme in p["split"]["schemes"]: + rows = [] + for well in p["data"]["wells"]: + sel = selection[(selection.scheme == scheme) & (selection.test_well == well) + & (selection.sigma_a_ms == sa) & selection.method.isin(g["point_competitors"])] + scores = sel.groupby("method").validation_mse.mean() + if len(scores) != len(g["point_competitors"]): + return {"evaluated": False, "reason": "Incomplete point competitors"} + competitor = str(scores.idxmin()) + pick = {} + for role, method in (("candidate", g["candidate"]), ("competitor", competitor), + ("same_posterior", g["same_posterior_method"])): + hit = primary[(primary.scheme == scheme) & (primary.test_well == well) & (primary.method == method)] + if len(hit) != 1 or not bool(hit.iloc[0].scored): + raise ValueError(f"Incomplete G-D predictions: {scheme}/{well}/{method}") + pick[role] = hit.iloc[0] + a, b, d = pick["candidate"], pick["competitor"], pick["same_posterior"] + rows.append(dict(well=well, competitor=competitor, competitor_validation_mse=float(scores[competitor]), + n=int(a.n), rmse=float(a.rmse), competitor_rmse=float(b.rmse), + ratio=float(a.rmse / b.rmse), improved=bool(a.rmse < b.rmse), + same_posterior_rmse=float(d.rmse), improved_vs_same_posterior=bool(a.rmse < d.rmse), + coverage_80=float(a.coverage_80), coverage_90=float(a.coverage_90))) + frame = pd.DataFrame(rows) + c80, c90 = float(frame.coverage_80.mean()), float(frame.coverage_90.mean()) + wins = int(frame.improved.sum()) + schemes[scheme] = dict( + improved_wells=wins, n_wells=len(rows), macro_rmse=float(frame.rmse.mean()), + macro_competitor_rmse=float(frame.competitor_rmse.mean()), + macro_same_posterior_rmse=float(frame.same_posterior_rmse.mean()), + improved_vs_same_posterior_wells=int(frame.improved_vs_same_posterior.sum()), + coverage_80=c80, coverage_90=c90, + consistent_improvement=wins >= rules["min_improved_wells"], + coverage_in_band=within(c80, rules["coverage_80"]) and within(c90, rules["coverage_90"]), + per_well=rows) + claims = {"consistent_improvement": all(s["consistent_improvement"] for s in schemes.values()), + "calibrated": all(s["coverage_in_band"] for s in schemes.values())} + return dict(evaluated=True, descriptive=True, schemes=schemes, claims=claims, note=g["note"]) + + +def registration_table(p: dict, root: Path, sigmas: list[float]) -> pd.DataFrame: + """Per training set and well: γ, particles, posterior spread and label support per method (fewest and most + samples over the members; training wells only).""" + rows = [] + for names in fold_sets(p): + for sa in sigmas: + meta = json.loads(reg_path(root, names, sa).with_suffix(".json").read_text(encoding="utf-8")) + for d in meta["diagnostics"]: + rows.append(dict(training_wells=";".join(names), sigma_a_ms=sa, phase0=meta["phase0"], + phase_R=meta["phase_R"], lam=meta["lambda"], tau_c=meta["tau_c"], + wall_seconds=meta["wall_seconds"], lik_start_ms=d["lik_ms"][0], + lik_stop_ms=d["lik_ms"][1], + **{k: v for k, v in d.items() if not isinstance(v, (list, dict))}, + **{f"label_samples_{m}": n for m, n in d["label_samples"].items()}, + **{f"label_samples_max_{m}": n for m, n in d["label_samples_max"].items()})) + return pd.DataFrame(rows) + + +def summarize(p: dict, root: Path, sigmas: list[float], arrays: dict | None = None) -> dict: + arrays = load_arrays() if arrays is None else arrays + pred, sel = neural_predictions(p, root, arrays, sigmas) + full = VolveData(p, arrays=arrays) + frame = pd.DataFrame([score(full, a, ref, p) for a in pred for ref in references(full, a["test_well"], p)]) + selections = pd.DataFrame(sel) + gate = gate_gd(frame, selections, p) + smoke = root.name == "smoke" + if smoke: + gate = {"evaluated": False, "reason": "Smoke run; not the registered P4 experiment", "pipeline_check": gate} + dest = root / "summary" + dest.mkdir(parents=True, exist_ok=True) + frame.to_csv(dest / "metrics.csv", index=False) + selections.to_csv(dest / "selection.csv", index=False) + registration_table(p, root, sigmas).to_csv(dest / "registration.csv", index=False) + ens = frame[(frame.seed.astype(str) == "ensemble") & frame.scored.astype(bool)] + groups = ens.groupby(["scheme", "sigma_a_ms", "reference", "method"]) + macro = groups[COLUMNS].mean().join(groups.size().rename("n_wells")).reset_index() + macro.to_csv(dest / "macro.csv", index=False) + shifts = [{k: v for k, v in a.items() if k not in ("mu", "sigma")} + | best_shift(full, a, p["data"]["primary_reference"], p["metrics"]["best_shift_max_samples"]) + for a in pred if a["seed"] == "ensemble"] + pd.DataFrame(shifts).to_csv(dest / "best_shift_DIAGNOSTIC_ONLY.csv", index=False) + saved = {} + for i, a in enumerate(pred): + saved[f"{i}/mu"], saved[f"{i}/sigma"] = a["mu"], a["sigma"] + np.savez_compressed(dest / "predictions.npz", times_ms=full.t_main, **saved) + write_json(dest / "prediction_index.json", [{k: v for k, v in a.items() if k not in ("mu", "sigma")} for a in pred]) + write_json(dest / "gate_gd.json", gate) + main = macro[(macro.reference == p["data"]["primary_reference"]) + & (macro.sigma_a_ms == p["registration"]["sigma_a_ms"])] + text = ["# P4 Volve — nested blind folds (" + ", ".join(p["split"]["schemes"]) + ")", "", + "Smoke only; no scientific result." if smoke else + "Registered protocol_volve; outer-test labels are scoring-only.", "", + "G-D (descriptive): " + json.dumps(gate, ensure_ascii=False, default=str), "", + f"## Macro over wells, {p['data']['primary_reference']} reference, " + f"σ_a = {p['registration']['sigma_a_ms']:g} ms (p.u.)", "", + main.to_markdown(index=False, floatfmt=".4f"), "", + "Per-well, per-seed and reference-sensitivity results: metrics.csv and macro.csv. Budgets: selection.csv. " + "Registration diagnostics (training wells only): registration.csv.", + f"band_* is a high-pass of reference runs of at least {p['metrics']['desc_band_min_samples']} samples, " + "shorter than one period at f_c: descriptive only. Best-shift is diagnostic only and never alters a score.", + "Six wells in three slots: per-well results are the replication unit; no p-values."] + (dest / "summary.md").write_text("\n".join(text) + "\n", encoding="utf-8") + plot_results(full, p, pred, gate.get("pipeline_check", gate), dest) + return gate + + +def plot_results(full: VolveData, p: dict, pred: list[dict], gate: dict, dest: Path) -> None: + import matplotlib + matplotlib.use("Agg") + import matplotlib.pyplot as plt + + sa, ref, wells = p["registration"]["sigma_a_ms"], p["data"]["primary_reference"], p["data"]["wells"] + files = [] + for scheme in p["split"]["schemes"]: + chosen = {r["well"]: r["competitor"] for r in gate.get("schemes", {}).get(scheme, {}).get("per_well", [])} + fig, axes = plt.subplots(1, len(wells), figsize=(2.5 * len(wells), 6), sharey=True, sharex=True, + layout="constrained") + for ax, w in zip(axes, wells): + ax.plot(100 * full.y(w, ref), full.t_main, "k", label="Reference") + competitor = chosen.get(w, "B3b") + for method, color, style, name in ((competitor, "#0072B2", "--", "Selected B3"), + ("B3d-Sa", "#8F5800", ":", "B3d-Sa"), ("M2-Sa", "#CC3311", "-", "M2-Sa")): + rows = [a for a in pred if a["scheme"] == scheme and a["test_well"] == w and a["method"] == method + and a["seed"] == "ensemble" and a["sigma_a_ms"] == sa] + if not rows: + continue + a = rows[0] + ax.plot(100 * a["mu"], full.t_main, color=color, linestyle=style, label=name) + if method == "M2-Sa": + ax.fill_betweenx(full.t_main, 100 * (a["mu"] - Z90 * a["sigma"]), + 100 * (a["mu"] + Z90 * a["sigma"]), color=color, alpha=0.18) + ax.set(title=f"{w}\n(B3: {competitor})", xlabel="PHIF (p.u.)") + ax.grid(alpha=0.2) + axes[0].set_ylabel("TWT (ms)") + axes[0].invert_yaxis() + axes[0].legend(fontsize=8) + for ext in ("png", "pdf"): + fig.savefig(dest / f"wells_{scheme}.{ext}", dpi=160) + files.append(f"wells_{scheme}.{ext}") + plt.close(fig) + write_json(dest / "figure_manifest.json", { + "files": files, "source": "predictions.npz and prediction_index.json", + "reference": "marker-calibrated vertical sonic (TVD-integrated DT) of the held-out well", + "uncertainty": "nominal 90% moment-matched Gaussian predictive interval of M2-Sa; calibration is evaluated " + "separately", + "replication_unit": "well (n=6, three slots); network seeds are computational repeats", + "transform": "porosity fraction multiplied by 100", "filters": "none for plotting", + "publisher_requirements": "not yet verified", + "description": "One panel per held-out well and blind scheme: reference over its support and blind " + "predictions over the main window against downward-increasing two-way time; the B3 line is the " + "point competitor selected by inner validation."}) diff --git a/ml_porosity/volve/folds.py b/ml_porosity/volve/folds.py new file mode 100644 index 0000000..04e4764 --- /dev/null +++ b/ml_porosity/volve/folds.py @@ -0,0 +1,74 @@ +"""Nested blind folds for P4 (plan §5.2). + +Outer fold: test well u, training wells T_out = blind_training_wells(u, scheme) (`lowo`: every other well; `slot`: +every well outside the slot group of u). Inner folds: leave one well of T_out out, under both schemes — under +`slot` an inner validation well may share a slot with inner training wells, so inner validation can be optimistic +there (recorded deviation in protocol_volve). + +Every model sees seismic only through blind keys: the input of a non-training well u under key K is placed in time +by the TD model of the wells K, with T_in ⊆ K ⊆ W∖{u} (never u's own picks or DT). Validation of v in T_out uses +K = T_in; the outer test of u uses K = T_out. Training wells use their calibrated reference path. +""" + +from __future__ import annotations + +import itertools + +from ml_porosity.data.volve_wells import blind_key, blind_training_wells + + +def outer_folds(wells: list[str], scheme: str, p4: dict) -> list[tuple[str, tuple[str, ...]]]: + """[(test well u, T_out)] in `wells` order; T_out sorted.""" + out = [] + for u in wells: + train = tuple(sorted(blind_training_wells(u, scheme, p4))) + if u in train or not train: + raise RuntimeError(f"invalid outer fold for {u}: {train}") + out.append((u, train)) + return out + + +def inner_folds(outer_train: tuple[str, ...]) -> list[tuple[str, tuple[str, ...]]]: + """[(validation well v, T_in = T_out ∖ {v})], leave-one-well-out within the outer training set.""" + train = tuple(sorted(outer_train)) + if len(train) < 2: + raise ValueError("inner LOWO needs at least two outer training wells") + return [(v, tuple(w for w in train if w != v)) for v in train] + + +def nested_folds(wells: list[str], schemes: list[str], p4: dict) -> list[dict]: + """Every (scheme, test well, validation well, T_out, T_in), with the blind key of each role.""" + rows = [] + for scheme in schemes: + for u, t_out in outer_folds(wells, scheme, p4): + for v, t_in in inner_folds(t_out): + if u in t_in or v in t_in: + raise RuntimeError("held-out well entered an inner training set") + rows.append(dict(scheme=scheme, test=u, validation=v, outer_train=t_out, inner_train=t_in, + validation_key=blind_key(t_in), test_key=blind_key(t_out))) + return rows + + +def training_sets(wells: list[str], schemes: list[str], p4: dict) -> list[tuple[str, ...]]: + """Distinct inner training sets over all schemes (one trajectory per set, method, seed and σ_a arm).""" + return sorted({f["inner_train"] for f in nested_folds(wells, schemes, p4)}, key=lambda s: (-len(s), s)) + + +def prediction_targets(wells: list[str], train: tuple[str, ...]) -> list[tuple[str, str]]: + """(well, key) inputs predicted by a model trained on `train`: training wells on their reference path + (key 'reference'), every other well u on every blind key K with train ⊆ K ⊆ W∖{u}. Covers the validation + (K = T_in) and outer-test (K = T_out ⊋ T_in) inputs of every fold that trains on `train`.""" + train = tuple(sorted(train)) + out = [(w, "reference") for w in train] + for u in wells: + if u in train: + continue + rest = [w for w in wells if w != u and w not in train] + for k in range(len(rest) + 1): + for extra in itertools.combinations(rest, k): + out.append((u, blind_key(train + extra))) + return out + + +def target_name(well: str, key: str) -> str: + return f"{well}|{key}" diff --git a/ml_porosity/volve/losses.py b/ml_porosity/volve/losses.py new file mode 100644 index 0000000..176c121 --- /dev/null +++ b/ml_porosity/volve/losses.py @@ -0,0 +1,93 @@ +"""Bank losses with label masks (P4: Volve labels cover 16–37 of the 126 main-window samples). + +Member s of the bank of training well b places the same label run at its own times, so it has its own support +mask M_bs (L); a (B, L) mask is shared by all members. For window j, n_bjs = Σ_{i ∈ j} M_bsi and n̄_bj = mean_s n_bjs: + + ℓ_bjs = (n̄_bj / n_bjs) Σ_{i ∈ j} M_bsi log N(y_bs,i; μ_i, σ_i²) (members compared at a common count) + RML: L_b = −Σ_j (1/λ) log Σ_s π_bs exp(λ ℓ_bjs) / Σ_j n̄_bj + hard-min: L_b = −Σ_j max_s ℓ_bjs / Σ_j n̄_bj + +and the loss is the mean of L_b over wells. A window where some member has no valid sample contributes nothing. +With a shared mask the count factor is 1; with every sample valid the loss equals losses.rml.bank_loss. +""" + +from __future__ import annotations + +import numpy as np +import torch +from scipy import signal + +from ml_porosity.losses.rml import LOG_2PI, gather_windows + + +def masked_window_loglik(mu, sigma, Y, mask, starts, win: int) -> tuple[torch.Tensor, torch.Tensor]: + """mu, sigma (B, L); Y (B, S, L), any value where the mask is False; mask (B, L) or (B, S, L) + → summed ℓ (B, J, S) and valid counts n (B, J, S).""" + if mask.dim() == 2: + mask = mask[:, None, :].expand(Y.shape) + if mask.shape != Y.shape: + raise ValueError("mask must be (B, L) or match the bank (B, S, L)") + y = torch.where(mask, Y, torch.zeros((), dtype=Y.dtype, device=Y.device)) + m = gather_windows(mu, starts, win)[:, :, None, :] + s = gather_windows(sigma, starts, win)[:, :, None, :] + w = gather_windows(mask.to(mu.dtype), starts, win) + term = -torch.log(s) - 0.5 * ((gather_windows(y, starts, win) - m) / s) ** 2 - 0.5 * LOG_2PI + return (term * w).sum(-1), w.sum(-1) + + +def masked_bank_loss(mu, sigma, Y, logpi, mask, starts, win: int, lam: float | None) -> torch.Tensor: + """lam = None → hard-min (max ℓ); otherwise RML with power λ. Every well needs a window in which every member + has a valid sample.""" + ll, n = masked_window_loglik(mu, sigma, Y, mask, starts, win) + use = (n > 0).all(-1) + nbar = n.mean(-1) + ll = torch.where(use[..., None], ll * nbar[..., None] / n.clamp(min=1), torch.zeros((), dtype=ll.dtype, + device=ll.device)) + total = (nbar * use).sum(1) + if not bool((total > 0).all()): + raise ValueError("a training well has no labelled sample in any window") + v = ll.max(-1).values if lam is None else torch.logsumexp(logpi[:, None, :] + lam * ll, dim=-1) / lam + v = torch.where(use, v, torch.zeros((), dtype=v.dtype, device=v.device)) + return -(v.sum(1) / total).mean() + + +def highpass_segment(y: np.ndarray, f_c_hz: float, dt_ms: float = 4.0, order: int = 4) -> np.ndarray: + """y minus its zero-phase Butterworth low band below f_c, as eval.metrics.split_bands (identical for ≥ 16 + samples at order 4); shorter segments use the longest even padding scipy accepts.""" + y = np.asarray(y, dtype=float) + sos = signal.butter(order, f_c_hz, fs=1000.0 / dt_ms, output="sos") + pad = min(3 * (2 * len(sos) + 1), y.size - 1) + return y - signal.sosfiltfilt(sos, y, padtype="even", padlen=pad) + + +def segment_lambda(segments: list[np.ndarray], f_c_hz: float = 6.0, dt_ms: float = 4.0, + max_lag: int = 32) -> tuple[float, float]: + """losses.rml.effective_lambda for label segments of any length ≥ 2: λ = 1/τ_c, τ_c = 1 + 2 Σ_k ρ(k)², with ρ + the ACF of the high-passed segments pooled as lagged products (a lag longer than a segment adds nothing). Σ runs + up to the first lag with ρ ≤ 0. Equals effective_lambda when every segment has more than max_lag samples.""" + acc = np.zeros(max_lag + 1) + for y in segments: + y = np.asarray(y, dtype=float) + if y.size < 2 or not np.isfinite(y).all(): + raise ValueError("segments must be finite with at least two samples") + hi = highpass_segment(y, f_c_hz, dt_ms) + hi = hi - hi.mean() + a = np.correlate(hi, hi, "full")[hi.size - 1: hi.size + max_lag] + acc[: a.size] += a + rho = acc / acc[0] + k = np.argmax(rho[1:] <= 0) + 1 if np.any(rho[1:] <= 0) else max_lag + 1 + tau_c = 1.0 + 2.0 * float(np.sum(rho[1:k] ** 2)) + return 1.0 / tau_c, tau_c + + +def finite_runs(y: np.ndarray) -> list[tuple[int, int]]: + """[start, stop) of the maximal runs of finite samples of a series (NaN separates runs).""" + ok = np.isfinite(np.asarray(y, dtype=float)) + edges = np.flatnonzero(np.diff(np.r_[0, ok.astype(int), 0])) + return [(int(a), int(b)) for a, b in zip(edges[::2], edges[1::2])] + + +def label_segments(y: np.ndarray) -> list[np.ndarray]: + """Maximal runs of finite samples of a series.""" + y = np.asarray(y, dtype=float) + return [y[a:b] for a, b in finite_runs(y)] diff --git a/ml_porosity/volve/protocol.py b/ml_porosity/volve/protocol.py new file mode 100644 index 0000000..5f7e996 --- /dev/null +++ b/ml_porosity/volve/protocol.py @@ -0,0 +1,123 @@ +"""Protocol locking and resume fingerprints for P4 (Volve), separate from the frozen P3 lock. + +Paths in the stamp are relative to their root (repo, outputs or Volve data directory), so a lock is portable between +checkouts; it is still bound to one environment, as in P3. Before the lock exists, `current_stamp` gives the same +stamp without writing it (smoke runs only). +""" + +from __future__ import annotations + +import json +from datetime import datetime, timezone +from pathlib import Path + +import yaml + +from ml_porosity.f3.protocol import digest, environment, fingerprint +from ml_porosity.paths import REPO_ROOT, outputs_dir, volve_root + +__all__ = ["CONFIG", "LOCK", "current_stamp", "fingerprint", "freeze", "load_protocol", "source_config"] + +CONFIG = REPO_ROOT / "configs/protocol_volve.yaml" +LOCK = REPO_ROOT / "configs/protocol_volve.lock.json" +SCRIPTS = ("scripts/23_build_volve_wells.py", "scripts/24_run_volve.py", "scripts/run_p4.ps1", "scripts/run_p4.sh") +PROTECTED = ("wavelets.npz", "p2/warp_prior_f3.json") +RESULTS = ("registration", "train", "summary") + + +def load_protocol() -> dict: + return yaml.safe_load(CONFIG.read_text(encoding="utf-8")) + + +def source_config(p: dict) -> dict: + """configs/d3_volve.yaml, which built the dataset; its p4 section holds the slot groups of the blind folds.""" + cfg = yaml.safe_load((REPO_ROOT / p["data"]["source_config"]).read_text(encoding="utf-8")) + if list(cfg["p4"]["wells"]) != list(p["data"]["wells"]) or cfg["p4"]["label"] != p["data"]["label"]: + raise RuntimeError("protocol_volve and its source configuration disagree on wells or label") + if not set(p["split"]["schemes"]) <= set(cfg["p4"]["blind_schemes"]): + raise RuntimeError("Unknown blind scheme in protocol_volve") + return cfg + + +def code_files() -> list[Path]: + paths = sorted((REPO_ROOT / "ml_porosity").rglob("*.py")) + paths += [REPO_ROOT / s for s in SCRIPTS if (REPO_ROOT / s).exists()] + return paths + [REPO_ROOT / "pyproject.toml"] + + +def source_hash() -> str: + import hashlib + + h = hashlib.sha256() + for f in code_files(): + h.update(f.relative_to(REPO_ROOT).as_posix().encode() + b"\0") + h.update(f.read_bytes().replace(b"\r\n", b"\n") + b"\0") + return h.hexdigest() + + +def input_files(p: dict) -> list[Path]: + """Derived dataset, its configuration and every raw file the build reads, except the cube (checked against the + data manifest at the first lock).""" + cfg = source_config(p) + root, p4 = volve_root(), cfg["p4"] + files = [outputs_dir() / "volve/volve_wells.npz", outputs_dir() / "volve/volve_wells_summary.json", + root / cfg["picks"], root / cfg["horizons_twt"] / cfg["grid_horizon"]] + for spec in p4["wells"].values(): + files.append(root / p4["survey_dir"] / spec["survey"]) + logs = root / cfg["well_logs_dir"] / spec["logs"] / p4["log_subdir"] + files += [logs / p4["las_input"], logs / p4["las_output"]] + files += [root / cfg["well_logs_dir"] / cfg["checkshots"][spec["picks"]][kind] + for kind in spec.get("checkshots", [])] + return files + + +def portable_name(path: Path) -> str: + """Portable name: 'repo:', 'outputs:' or 'volve:' plus the POSIX path relative to that root.""" + path = path.resolve() + for prefix, base in (("volve", volve_root()), ("outputs", outputs_dir()), ("repo", REPO_ROOT)): + try: + return f"{prefix}:{path.relative_to(base.resolve()).as_posix()}" + except ValueError: + continue + raise ValueError(f"Input outside the repository, outputs and Volve roots: {path}") + + +def current_stamp(p: dict | None = None) -> dict: + p = load_protocol() if p is None else p + missing = [f for f in input_files(p) + [outputs_dir() / a for a in PROTECTED] if not f.exists()] + if missing: + raise FileNotFoundError(f"P4 inputs missing (sync data/ and outputs/ first): {[str(f) for f in missing]}") + config = REPO_ROOT / p["data"]["source_config"] + return {"protocol_sha256": digest(CONFIG, True), "code_sha256": source_hash(), "environment": environment(), + "protected_artifacts": {portable_name(outputs_dir() / a): digest(outputs_dir() / a) for a in PROTECTED}, + "inputs": {portable_name(f): digest(f, f == config) for f in [config] + input_files(p)}} + + +def freeze(check: bool = False) -> dict: + """Return the lock; create it if absent and check is False. Any difference from an existing lock is an error.""" + p = load_protocol() + stamp = current_stamp(p) + if LOCK.exists(): + old = json.loads(LOCK.read_text(encoding="utf-8")) + for k, v in stamp.items(): + if old[k] != v: + raise RuntimeError(f"P4 lock mismatch: {k}. Preserve results and create a new protocol version.") + return old + if check: + raise RuntimeError("P4 is not locked. Run the lock stage before registration/training.") + if any((outputs_dir() / "p4" / d).exists() for d in RESULTS): + raise RuntimeError("Refusing a first lock after P4 results already exist.") + cfg = source_config(p) + manifest = json.loads((REPO_ROOT / "data_manifest/volve.json").read_text(encoding="utf-8")) + expected = manifest["files"][cfg["cube"]]["sha256"] + cube = volve_root() / cfg["cube"] + if not cube.exists() or digest(cube) != expected: + raise RuntimeError(f"Volve cube missing or different from the audited source: {cube}") + stamp |= {"locked_utc": datetime.now(timezone.utc).isoformat(), "segy_sha256": expected, + "canonical_text": "UTF-8, CRLF normalized to LF for code, protocol and source configuration; " + "binary inputs exact", + "wells": p["data"]["wells"]} + LOCK.write_text(json.dumps(stamp, indent=2), encoding="utf-8") + CONFIG.with_suffix(".sha256").write_text(stamp["protocol_sha256"] + " configs/protocol_volve.yaml\n", + encoding="utf-8") + return stamp diff --git a/ml_porosity/volve/registration.py b/ml_porosity/volve/registration.py new file mode 100644 index 0000000..e9672fe --- /dev/null +++ b/ml_porosity/volve/registration.py @@ -0,0 +1,171 @@ +"""Training-set-only P4 registration and label banks. No held-out well is passed to this module. + +Follows ml_porosity.f3.registration.register_set with three recorded deviations (protocol_volve): + +- Likelihood window: AI exists only over the logged interval (45–151 of the 301 ext samples), so the tie + likelihood of a well (phase grid, SMC, γ) is evaluated on `lik`, the ext samples from the first to the last + finite calibrated AI sample of that well; outside it the constant AI extension gives a zero synthetic that would + only fit noise. B3c/B3c-R keep the F3 full-window local shifts: windows without synthetic energy have r = NaN and + are dropped by r_min. +- Particle validity: labels cover 16–37 of the 126 main samples, so a particle only has to invert over the main + window (F3 also required full label support there). +- Member support: every member keeps the samples where its own warp places the label run (NaN elsewhere), so + no label is extrapolated and the run is not trimmed to the intersection of all members (which loses both ends + of a 16-sample run under the posterior spread). A member with fewer than `min_label_samples` is an error. The + intersection over members and methods is recorded as a diagnostic only. +""" + +from __future__ import annotations + +import gc +import time +from types import SimpleNamespace + +import numpy as np + +from ml_porosity.data.wavelet import rotate_phase, statistical_wavelet +from ml_porosity.registration.labels import antialias, invert_warps, labels_for_warps +from ml_porosity.registration.pipeline import PHASES, fit_cell_hyper +from ml_porosity.registration.sampler import sample_warps +from ml_porosity.registration.smc import TiePosterior, gamma_acf, phase_basis, phase_wavelet +from ml_porosity.registration.tie_likelihood import fine_wavelet, fit_phase, profile_loglik, synth_for_warps +from ml_porosity.registration.ties import tie_b3b, tie_b3c +from ml_porosity.volve.data import VolveData +from ml_porosity.volve.losses import label_segments, segment_lambda + +METHODS = ("B3b", "B3c", "B3c-R", "B3d-Sa", "M2-Sa") + + +def valid_warps(data: VolveData, warps: np.ndarray) -> np.ndarray: + """Warps whose inverse τ(t) exists over the whole main window.""" + return np.isfinite(invert_warps(warps, data.tau, data.t_main)).all(axis=1) + + +def window_phase_loglik(syn0: np.ndarray, seis: np.ndarray, lik: np.ndarray, phases=PHASES) -> np.ndarray: + """(P, S) as tie_likelihood.phase_loglik, with the phase rotated on the full ext synthetic and the profile + likelihood taken over the samples `lik` only.""" + syn0 = np.atleast_2d(syn0) + return np.stack([profile_loglik(rotate_phase(syn0, p)[:, lik], seis[lik]) for p in phases]) + + +def label_fn(data: VolveData, obs: dict, y_filtered: np.ndarray): + """t(τ) warps (S, n_tau) → labels (S, L) on the main window, NaN where the label is not supported.""" + valid = obs["label_valid"][data.label].astype(float) + + def lab(warps): + warps = np.atleast_2d(warps) + tau_at = invert_warps(warps, data.tau, data.t_main) + support = np.interp(np.nan_to_num(tau_at, nan=data.tau[0] - 1.0), data.tau, valid, left=0, right=0) + out = labels_for_warps(data.tau, y_filtered, warps, data.t_main) + return np.where(np.isfinite(tau_at) & (support >= 1 - 1e-9), out, np.nan) + return lab + + +def register_set(data: VolveData, names: tuple[str, ...], p: dict, device: str, + sigma_a: float = 7.0) -> tuple[dict, dict]: + import torch + from ml_porosity.registration.smc_torch import TiePosteriorTorch, smc_fit_phase, smc_tie_posterior + + started = time.perf_counter() + names = tuple(sorted(names)) + r = p["registration"] | {"sigma_a_ms": sigma_a} + label = data.label + obs = data.training_observations(names) + if tuple(o["name"] for o in obs) != names: + raise RuntimeError("Unexpected training-well payload") + h, hinfo = fit_cell_hyper(SimpleNamespace(grid=data.grid), obs, r, r["smc_seed"]) + f = r["fine_dt_ms"] + fac = int(round(data.dt / f)) + w0 = statistical_wavelet(np.stack([o["seis"] for o in obs]), data.dt, r["wavelet_ms"]) + B = phase_basis(w0, fac) + cover = (data.t_main[0], data.t_main[-1]) + samples, Ts, Zs, LL, anchor_valid = [], [], [], [], [] + for i, o in enumerate(obs): + smp = sample_warps(data.grid, h, o["tau_k"], o["t_k"], r["particles"], r["g_max"], + np.random.default_rng([r["smc_seed"], i, 13])) + samples.append(smp) + tg = data.grid.t_of_tau(smp["b"][:r["S"]], smp["g"][:r["S"]], data.tau) + valid = valid_warps(data, tg) + if not valid.any(): + raise ValueError(f"No anchor sample covers the main window: {o['name']}") + anchor_valid.append(valid) + syn = synth_for_warps(data.tau, o["ai_log"], tg, data.t_fine, data.t, fine_wavelet(w0, fac)) + LL.append(window_phase_loglik(syn, o["seis"], o["lik"])) + phase0 = float(PHASES[fit_phase(LL, anchor_valid, PHASES)]) + for o, smp in zip(obs, samples): + T = TiePosteriorTorch(TiePosterior(data.grid, h, o["tau_k"], o["t_k"], r["g_max"], data.tau, o["ai_log"], + data.t_fine, data.t[o["lik"]], phase_wavelet(B, phase0), + o["seis"][o["lik"]], cover), device) + Zs.append(T.z(smp["u"])) + Ts.append(T) + phase_r, ph = smc_fit_phase(Ts, Zs, B, phase0, [r["smc_seed"], 19], step=r["phase_step"], + half_width=r["phase_half_width"], max_extra=r["phase_max_extra"], + n_moves=r["smc_moves"]) + wf = phase_wavelet(B, phase_r) + post, diag = [], [] + for i, (o, T0, z0) in enumerate(zip(obs, Ts, Zs)): + T = T0.with_wavelet(wf) + gamma = gamma_acf(T, z0, T.parts(z0)[1]) + res = smc_tie_posterior(T, z0, [gamma], np.random.default_rng([r["smc_seed"], i, 17]), + n_moves=r["smc_moves"]) + u = T.u(res["Z"][gamma]) + tg = data.grid.t_of_tau(u[:, 0], u[:, 1:], data.tau) + valid = valid_warps(data, tg) + if valid.sum() < min(256, r["particles"]): + raise ValueError(f"Insufficient posterior particles covering the main window: {o['name']}, " + f"{valid.sum()} valid") + post.append(tg[valid]) + diag.append({"well": o["name"], "gamma": gamma, "n_stages": len(res["stages"]), + "valid_particles": int(valid.sum()), "particles": len(valid), + "n_anchors": len(o["tau_k"]), "lik_samples": int(o["lik"].sum()), + "lik_ms": [float(data.t[o["lik"]][0]), float(data.t[o["lik"]][-1])]}) + + bundle = {"wells": np.asarray(names), "phase0": np.asarray(phase0), "phase_R": np.asarray(phase_r)} + banks = {m: [] for m in METHODS} + logpi = [] + filtered = [antialias(o["labels"][label], f, data.dt) for o in obs] + normsel = (data.tau >= data.t_main[0]) & (data.tau <= data.t_main[-1]) + vals = np.concatenate([y[normsel & o["label_valid"][label]] for o, y in zip(obs, filtered)]) + bundle[f"{label}/norm"] = np.array([vals.mean(), max(vals.std(), 1e-8)]) + for i, (o, tg, y) in enumerate(zip(obs, post, filtered)): + lab = label_fn(data, o, y) + b3b = tie_b3b(o["tau_k"], o["t_k"], data.tau) + ties = {"B3b": b3b, "B3d-Sa": tg.mean(axis=0)} + for name, phase in (("B3c", phase0), ("B3c-R", phase_r)): + syn = synth_for_warps(data.tau, o["ai_log"], b3b, data.t_fine, data.t, + fine_wavelet(rotate_phase(w0, phase), fac))[0] + ties[name] = tie_b3c(b3b, data.tau, syn, o["seis"], data.t, data.dt) + per = {m: lab(t) for m, t in ties.items()} + sub = np.random.default_rng([r["smc_seed"], i, 29]).choice(len(tg), r["S"], replace=False) + per["M2-Sa"] = lab(tg[sub]) + counts = {m: np.isfinite(a).sum(axis=1) for m, a in per.items()} + short = {m: int(c.min()) for m, c in counts.items() if c.min() < p["data"]["min_label_samples"]} + if short: + raise ValueError(f"Label support too short: {o['name']}, fewest samples per member {short}") + for m in METHODS: + banks[m].append(per[m]) + common = np.logical_and.reduce([np.isfinite(a).all(axis=0) for a in per.values()]) + union = np.isfinite(per["M2-Sa"]).any(axis=0) + logpi.append(np.full(r["S"], -np.log(r["S"]))) + tau_at = invert_warps(tg, data.tau, data.t_main) + q = np.diff(np.quantile(tau_at, [0.05, 0.95], axis=0), axis=0)[0] / 3.29 + diag[i] |= {"sigma_post_ms": float(np.mean(q)), "sigma_post_label_ms": float(np.mean(q[union])), + "common_samples": int(common.sum()), + "label_samples": {m: int(c.min()) for m, c in counts.items()}, + "label_samples_max": {m: int(c.max()) for m, c in counts.items()}} + for m in METHODS: + bundle[f"{label}/{m}"] = np.stack(banks[m]).astype(np.float32) + bundle[f"{label}/M2-Sa/logpi"] = np.stack(logpi).astype(np.float32) + segments = [s for y in bundle[f"{label}/B3b"][:, 0] for s in label_segments(y) if s.size >= 2] + lam, tau_c = segment_lambda(segments, p["metrics"]["f_c_hz"], data.dt) + bundle[f"{label}/lambda"], bundle[f"{label}/tau_c"] = np.asarray(lam), np.asarray(tau_c) + for o, tg in zip(obs, post): + bundle[f"posterior/{o['name']}/tau_at_main"] = invert_warps(tg, data.tau, data.t_main) + meta = {"training_wells": list(names), "sigma_a_ms": sigma_a, "phase0": phase0, "phase_R": phase_r, + "phase_info": ph, "hyper": h.as_dict(), "hyper_info": hinfo, "diagnostics": diag, + "lambda": lam, "tau_c": tau_c, "wall_seconds": time.perf_counter() - started} + del Ts, Zs, T, T0 + gc.collect() + if torch.cuda.is_available(): + torch.cuda.empty_cache() + return bundle, meta diff --git a/ml_porosity/volve/runner.py b/ml_porosity/volve/runner.py new file mode 100644 index 0000000..de02e2c --- /dev/null +++ b/ml_porosity/volve/runner.py @@ -0,0 +1,283 @@ +"""Resumable P4 stages. A worker only ever loads the data view of its own training wells and selects nothing. + +Progress goes to outputs/p4//progress.json (retried when Windows locks the file, and never fatal), not to the +P3 dashboard. +""" + +from __future__ import annotations + +import copy +import itertools +import json +import time +from concurrent.futures import FIRST_COMPLETED, ProcessPoolExecutor, wait +from datetime import datetime +from multiprocessing import get_context +from pathlib import Path + +import numpy as np + +from ml_porosity.f3.progress import write_json +from ml_porosity.paths import outputs_dir +from ml_porosity.volve.data import VolveData +from ml_porosity.volve.folds import prediction_targets, target_name, training_sets +from ml_porosity.volve.protocol import current_stamp, digest, fingerprint, freeze, source_config +from ml_porosity.volve.registration import METHODS + + +def set_name(names) -> str: + """'F-1A__F-1B__F-11A__F-12': sorted well names without spaces.""" + return "__".join(sorted(n.replace(" ", "") for n in names)) + + +def reg_path(root: Path, names, sigma_a: float = 7) -> Path: + return root / "registration" / f"{set_name(names)}_sa{sigma_a:g}.npz" + + +def job_path(root: Path, names, method: str, label: str, seed: int, sigma_a: float = 7) -> Path: + return root / "train" / f"{set_name(names)}__{method}__{label}__s{seed}__sa{sigma_a:g}.npz" + + +def load_bundle(path: Path) -> dict: + with np.load(path) as z: + return {k: z[k] for k in z.files} + + +def nan_allowed(key: str) -> bool: + """Label banks are NaN outside each member's label support; every other numeric array must be finite.""" + parts = key.split("/") + return len(parts) == 2 and parts[1] in METHODS + + +def check_arrays(path: Path, arrays: dict) -> None: + if not arrays: + raise RuntimeError(f"Empty completed artifact: {path}") + for k, a in arrays.items(): + if not np.issubdtype(a.dtype, np.number): + continue + if np.isinf(a).any() or (np.isnan(a).any() and not nan_allowed(k)) or np.isnan(a).all(): + raise RuntimeError(f"Corrupt/non-finite artifact: {path}/{k}") + + +def reusable(path: Path, key: str) -> bool: + meta = path.with_suffix(".json") + if not path.exists() or not meta.exists(): + return False + stored = json.loads(meta.read_text(encoding="utf-8")) + if stored.get("fingerprint") != key: + raise RuntimeError(f"Resume fingerprint mismatch: {path}. Use a new output directory.") + if stored.get("artifact_sha256") is None or digest(path) != stored["artifact_sha256"]: + raise RuntimeError(f"Missing or mismatched completed-artifact checksum: {path}") + if path.parent.name == "train": + ckpt = path.with_suffix(".pt") + if not ckpt.exists() or digest(ckpt) != stored.get("checkpoint_sha256"): + raise RuntimeError(f"Missing or mismatched model checkpoint: {ckpt}") + check_arrays(path, load_bundle(path)) + return True + + +def save_npz(path: Path, arrays: dict) -> None: + path.parent.mkdir(parents=True, exist_ok=True) + tmp = path.with_suffix(".tmp.npz") + np.savez_compressed(tmp, **arrays) + tmp.replace(path) + + +def registration_worker(job: dict) -> dict: + import torch + from ml_porosity.volve.registration import register_set + + torch.set_num_threads(job["p"]["runtime"]["cpu_threads_per_worker"]) + path = reg_path(Path(job["root"]), job["names"], job["sa"]) + if reusable(path, job["key"]): + return {"cached": True, "path": str(path)} + data = VolveData(job["p"], training_wells=tuple(job["names"])) + bundle, meta = register_set(data, tuple(job["names"]), job["p"], job["device"], job["sa"]) + check_arrays(path, bundle) + save_npz(path, bundle) + write_json(path.with_suffix(".json"), meta | {"fingerprint": job["key"], "artifact_sha256": digest(path)}) + return {"cached": False, "path": str(path), **meta} + + +def training_worker(job: dict) -> dict: + from ml_porosity.volve.training import method_spec, train_trajectory + + root, p = Path(job["root"]), job["p"] + label, names = p["data"]["label"], tuple(sorted(job["names"])) + path = job_path(root, names, job["method"], label, job["seed"], job["sa"]) + if reusable(path, job["key"]): + return {"cached": True, "path": str(path)} + data = VolveData(p, training_wells=names) + bundle = load_bundle(reg_path(root, names, job["sa"])) + if tuple(bundle["wells"]) != names: + raise RuntimeError("Registration cache contains different wells") + targets = prediction_targets(data.wells, names) + X = np.stack([data.X(w, "reference") for w in names]) + X_targets = np.stack([data.X(w, k) for w, k in targets]) + spec = method_spec(bundle, label, job["method"]) + ckpt = path.with_suffix(".pt") + ckpt.parent.mkdir(parents=True, exist_ok=True) + pred, meta = train_trajectory(X, X_targets, spec, job["method"], p["training"], job["seed"], + p["training"]["budgets"], job["device"], ckpt, + p["runtime"]["cpu_threads_per_worker"]) + mean, sd = bundle[f"{label}/norm"] + pred = {k: v * sd + (mean if k.endswith("/mu") else 0) for k, v in pred.items()} + pred |= {"targets": np.asarray([target_name(w, k) for w, k in targets]), "wells": np.asarray(names), + "norm": bundle[f"{label}/norm"]} + check_arrays(path, pred) + save_npz(path, pred) + write_json(path.with_suffix(".json"), meta | { + "fingerprint": job["key"], "artifact_sha256": digest(path), "checkpoint_sha256": digest(ckpt), + "training_wells": list(names), "label": label, "method": job["method"], "seed": job["seed"], + "sigma_a_ms": job["sa"], "n_targets": len(targets)}) + return {"cached": False, "path": str(path), **meta} + + +def progress(root: Path, **values) -> None: + path = root / "progress.json" + for attempt in range(20): + try: + old = json.loads(path.read_text(encoding="utf-8")) if path.exists() else {} + write_json(path, old | values | {"updated": datetime.now().astimezone().isoformat(timespec="seconds")}) + return + except (PermissionError, json.JSONDecodeError): + time.sleep(0.25 * (attempt + 1)) + print(f"warning: progress file not updated: {path}", flush=True) + + +def run_jobs(jobs: list[dict], fn, workers: int, stage: str) -> list[dict]: + if not jobs: + return [] + root = Path(jobs[0]["root"]) + started, results = time.perf_counter(), [] + progress(root, stage=stage, status="running", completed=0, total=len(jobs), error=None) + with ProcessPoolExecutor(max_workers=workers, mp_context=get_context("spawn")) as pool: + futures = {pool.submit(fn, job): job for job in jobs} + pending = set(futures) + while pending: + done, pending = wait(pending, timeout=30, return_when=FIRST_COMPLETED) + for fut in done: + try: + result = fut.result() + except Exception as exc: + for other in pending: + other.cancel() + progress(root, status="failed; pending jobs cancelled", error=f"{futures[fut]['key'][:12]}: {exc}") + raise + results.append(result) + fresh = sum(not r.get("cached") for r in results) + elapsed = time.perf_counter() - started + eta = elapsed / fresh * (len(jobs) - len(results)) if fresh else None + progress(root, completed=len(results), cached=len(results) - fresh, elapsed_seconds=elapsed, + eta_seconds=eta) + print(f"{stage} {len(results)}/{len(jobs)} {'cached ' if result.get('cached') else ''}" + f"{result['path']}", flush=True) + progress(root, status="done", eta_seconds=0) + return results + + +def sigma_arms(p: dict, arms: str) -> list[float]: + """'primary' → [σ_a], 'sensitivity' → the misspecification arms, 'all' → both.""" + primary, extra = [p["registration"]["sigma_a_ms"]], list(p["registration"]["sigma_a_sensitivity_ms"]) + return {"primary": primary, "sensitivity": extra, "all": primary + extra}[arms] + + +def fold_sets(p: dict) -> list[tuple[str, ...]]: + return training_sets(p["data"]["wells"], p["split"]["schemes"], source_config(p)["p4"]) + + +def registration_jobs(p: dict, stamp: dict, root: Path, device: str, arms: str = "primary") -> list[dict]: + jobs = [] + for names, sa in itertools.product(fold_sets(p), sigma_arms(p, arms)): + settings = dict(names=list(names), sa=sa) + jobs.append(dict(p=p, root=str(root), device=device, **settings, + key=fingerprint(stamp, stage="registration", **settings))) + return jobs + + +def arm_methods(p: dict, sa: float) -> list[str]: + main = sa == p["registration"]["sigma_a_ms"] + return list(p["methods"]["main"] if main else p["registration"]["sensitivity_methods"]) + + +def training_jobs(p: dict, stamp: dict, root: Path, device: str, arms: str = "primary") -> list[dict]: + jobs = [] + for names, sa in itertools.product(fold_sets(p), sigma_arms(p, arms)): + for method, seed in itertools.product(arm_methods(p, sa), p["split"]["seeds"]): + settings = dict(names=list(names), method=method, label=p["data"]["label"], seed=seed, sa=sa) + jobs.append(dict(p=p, root=str(root), device=device, **settings, + key=fingerprint(stamp, stage="train", **settings))) + return jobs + + +def smoke_protocol(p: dict) -> dict: + """Reduced settings for a pipeline check; outputs go to outputs/p4/smoke and are never results.""" + p = copy.deepcopy(p) + p["split"]["seeds"] = [0] + p["registration"].update(particles=16, S=8, hyper_starts=1, smc_moves=1, phase_half_width=0, + phase_max_extra=0, sigma_a_sensitivity_ms=[]) + p["training"]["budgets"] = [2, 4] + return p + + +def benchmark(p: dict, device: str, steps: int = 100) -> dict: + """Runtime pilot outside the result tree: one registration of the first (largest) training set and `steps` + training steps of B3b and M2-Sa on it. Training wells only; no held-out label, nothing selected.""" + from ml_porosity.volve.training import method_spec, train_trajectory + + root, sa, label = outputs_dir() / "p4" / "benchmark", p["registration"]["sigma_a_ms"], p["data"]["label"] + sets = fold_sets(p) + names = sets[0] + stamp = current_stamp(p) | {"benchmark_only": True} + registration_worker(dict(p=p, root=str(root), device=device, names=list(names), sa=sa, + key=fingerprint(stamp, stage="registration", names=list(names), sa=sa))) + seconds = json.loads(reg_path(root, names, sa).with_suffix(".json").read_text(encoding="utf-8"))["wall_seconds"] + data = VolveData(p, training_wells=names) + bundle = load_bundle(reg_path(root, names, sa)) + X = np.stack([data.X(w, "reference") for w in names]) + X_targets = np.stack([data.X(w, k) for w, k in prediction_targets(data.wells, names)]) + per_step = {m: train_trajectory(X, X_targets, method_spec(bundle, label, m), m, p["training"], 0, [steps], device, + None, p["runtime"]["cpu_threads_per_worker"])[1]["seconds_per_step"] + for m in ("B3b", "M2-Sa")} + # Registration cost grows with the number of wells; the largest set gives the training-step upper bound. + reg_primary = seconds * sum(len(s) for s in sets) / len(names) + n_sens = len(p["registration"]["sigma_a_sensitivity_ms"]) + steps_per_job = max(p["training"]["budgets"]) * max(per_step.values()) + jobs = {"primary": len(sets) * len(p["methods"]["main"]) * len(p["split"]["seeds"]), + "sensitivity": len(sets) * len(p["registration"]["sensitivity_methods"]) * len(p["split"]["seeds"]) * n_sens} + out = {"device": device, "training_wells": list(names), "registration_seconds_largest_set": seconds, + "seconds_per_step": per_step, "registration_jobs": {"primary": len(sets), "sensitivity": len(sets) * n_sens}, + "training_jobs": jobs, + "sequential_seconds": {"registration_primary": reg_primary, "registration_sensitivity": reg_primary * n_sens, + "training_primary": jobs["primary"] * steps_per_job, + "training_sensitivity": jobs["sensitivity"] * steps_per_job}, + "note": "One-worker extrapolation from one real training set; parallel workers on one GPU speed this up " + "sublinearly. Not a confidence interval."} + write_json(outputs_dir() / "p4" / "benchmark.json", out) + return out + + +def run(stage: str, p: dict, device: str, workers: int, smoke: bool = False, arms: str = "primary") -> None: + root = outputs_dir() / "p4" + if smoke: + if arms != "primary": + raise ValueError("Smoke runs use the primary σ_a arm only") + p = smoke_protocol(p) + root = root / "smoke" + if stage == "summarize": + # Scores held-out PHIF: only once the design is frozen. + stamp = freeze(check=True) | {"smoke": p} + else: + stamp = current_stamp() | {"smoke": p, "unlocked_draft": True} + else: + stamp = freeze(check=True) + if stage == "register": + run_jobs(registration_jobs(p, stamp, root, device, arms), registration_worker, workers, stage) + elif stage == "train": + run_jobs(training_jobs(p, stamp, root, device, arms), training_worker, workers, stage) + elif stage == "summarize": + from ml_porosity.volve.evaluation import summarize + # The G-D report always needs the primary arm. + summarize(p, root, sigma_arms(p, "primary" if arms == "primary" else "all")) + else: + raise ValueError(stage) diff --git a/ml_porosity/volve/training.py b/ml_porosity/volve/training.py new file mode 100644 index 0000000..8872ac2 --- /dev/null +++ b/ml_porosity/volve/training.py @@ -0,0 +1,87 @@ +"""P4 trajectories: masked bank losses, a checkpoint at every registered budget, no held-out label. + +Mirrors ml_porosity.f3.training.train_trajectory for the bank methods (same model, optimiser, seeding and +checkpoints); the loss is volve.losses.masked_bank_loss on the label support of each bank member (finite samples). +""" + +from __future__ import annotations + +import time +from pathlib import Path + +import numpy as np +import torch +from torch import nn + +from ml_porosity.f3.training import ensemble, make_model +from ml_porosity.models.bank_train import window_starts_fixed +from ml_porosity.models.train import predict +from ml_porosity.volve.losses import masked_bank_loss + +__all__ = ["ensemble", "method_spec", "train_trajectory"] + + +def method_spec(bundle: dict, label: str, method: str) -> dict: + """Normalised bank (NaN outside each member's label support), log prior weights, the member support masks + (B, S, L) and λ. Single-member banks reduce to the masked Gaussian NLL for any λ.""" + m0, s0 = bundle[f"{label}/norm"] + Y = bundle[f"{label}/{method}"] + lp = bundle.get(f"{label}/{method}/logpi", np.full(Y.shape[:2], -np.log(Y.shape[1]))) + if lp.shape != Y.shape[:2]: + raise ValueError(f"Bank weights do not match the bank: {label}/{method}") + if np.isinf(Y).any(): + raise ValueError(f"Label bank is not finite on its support: {label}/{method}") + mask = np.isfinite(Y) + if not mask.any(axis=2).all(): + raise ValueError(f"A bank member has no label support: {label}/{method}") + return dict(Y=(Y - m0) / s0, logpi=lp, mask=mask, lam=float(bundle[f"{label}/lambda"])) + + +def train_trajectory(X, X_targets, spec: dict, method: str, cfg: dict, seed: int, budgets: list[int], + device: str, checkpoint: Path | None = None, threads: int = 2) -> tuple[dict, dict]: + torch.set_num_threads(threads) + torch.backends.cudnn.benchmark = False + torch.backends.cudnn.deterministic = True + torch.default_generator.manual_seed(seed) + if torch.device(device).type == "cuda": + torch.cuda.set_device(device) + torch.cuda.manual_seed(seed) + np.random.seed(seed) + tensor = lambda a: torch.as_tensor(np.asarray(a), dtype=torch.float32, device=device) + x, y, logpi = tensor(X), tensor(spec["Y"]), tensor(spec["logpi"]) + mask = torch.as_tensor(np.asarray(spec["mask"], bool), device=device) + N, _, L = X.shape + win = cfg["window_samples"] + starts = torch.as_tensor(np.tile(window_starts_fixed(L, win, cfg["window_step"]), (N, 1)), device=device) + model = make_model(method, X.shape[1], cfg).to(device) + opt = torch.optim.Adam(model.parameters(), lr=cfg["lr"]) + outputs, states = {}, {} + if torch.device(device).type == "cuda": + torch.cuda.synchronize() + torch.cuda.reset_peak_memory_stats() + begin = time.perf_counter() + for step in range(1, max(budgets) + 1): + model.train() + opt.zero_grad(set_to_none=True) + mu, sigma = model(x) + loss = masked_bank_loss(mu[:, 0], sigma[:, 0], y, logpi, mask, starts, win, spec["lam"]) + if not torch.isfinite(loss): + raise FloatingPointError(f"Non-finite loss in {method}, step {step}") + loss.backward() + nn.utils.clip_grad_norm_(model.parameters(), cfg["grad_clip"]) + opt.step() + if step in budgets: + m, s = predict(model, X_targets, device) + outputs[f"{step}/mu"], outputs[f"{step}/sigma"] = m, s + if checkpoint is not None: + states[step] = {k: v.detach().cpu().clone() for k, v in model.state_dict().items()} + if torch.device(device).type == "cuda": + torch.cuda.synchronize() + elapsed = time.perf_counter() - begin + if checkpoint is not None: + tmp = checkpoint.with_suffix(".pt.tmp") + torch.save({"states": states, "method": method, "channels": X.shape[1], "config": cfg}, tmp) + tmp.replace(checkpoint) + return outputs, {"wall_seconds": elapsed, "steps": max(budgets), "seconds_per_step": elapsed / max(budgets), + "parameters": sum(v.numel() for v in model.parameters()), + "peak_vram_bytes": torch.cuda.max_memory_allocated() if torch.device(device).type == "cuda" else 0} diff --git a/paper/README.md b/paper/README.md index e1fda1d..1edf500 100644 --- a/paper/README.md +++ b/paper/README.md @@ -16,23 +16,46 @@ with the `.venv`); it reads only the locked summaries listed below. | Paper element | Source | |---|---| +| Abstract, Sec. 1 (findings paragraph), Sec. 8, `highlights.txt` | Rows below: H2a and σ_a from `tab:h2a`/`tab:sigmaa`; bank gain and bounds (registered (a), post hoc (b)) from `tab:h2b` and `outputs/p2r/posthoc/{bound.csv,meta.json}`; wells needed from `outputs/t3/nstar.csv`; field results from App. B; Teapot counts from Sec. 6.6 sources | +| Sec. 1 (F3 drift 14–66 ms, 46 ms, 36 ms; dominant period 17–20 ms) | `outputs/td_qc.csv`, `outputs/tie_qc.csv`, `docs/plan.md` §1.2 | +| Sec. 2 (label noise and errors in variables; Table `tab:positioning`) | `refs.bib` `annote` fields: Mnih & Hinton (2012) read in full on 2026-10-29 (Secs. 5, 6.1, 6.3); Balakrishnan (1962) metadata from Crossref only, cited for the general statement; abstract-only entries flagged in the table | | Sec. 3, Table `tab:audit` (TD drift, label audit) | `outputs/td_qc.csv`, `outputs/tie_qc.csv`, `outputs/marker_vs_horizon.csv`, `docs/plan.md` | +| Sec. 3.3 (Volve data: licence, label check, deviated wells, cube, time–depth, anchors, labels) | `outputs/volve/volve_wells_summary.json`, `outputs/volve/{summary.json,anchors.csv,pick_vs_horizon.csv,pick_vs_checkshot.csv,horizon_lag.csv}`, `docs/research/volve-inventory.md`, `docs/plan.md` §12 items 7 and 18 | | Sec. 4, Table `tab:h1`, Fig. `fig:h1` | `outputs/p2/summary/main/h1.csv`, `docs/theory.md` | +| Sec. 4.3–4.5 (Propositions 3–6, Corollaries 3–4, Remark 1, ρ*) | Analytic; proofs in App. A; Vietnamese statements in `docs/theory.md` §6. The factors 1.10 and 1.77 are e^{4π²σ²f²} at σ = 2 ms, f = 25 and 60 Hz (`meta.json` `transfer_ratio_exp_4pi2s2f2`); 71–73% coherent power below 25 Hz, the 67–72 Hz f⁴-weighted median and the (b)/(a) integral ratios 1.5–1.7, 2.1–2.6 and 3.3–4.6 are from `outputs/p2r/posthoc/meta.json` `n16_spectra` (coherent part: `coherent_share_below_25hz`, `f4_weighted_median_hz.coherent`; integral ratios span the Oracle and coherent spectra over the five regimes); 30–90 Hz uses the ~60 Hz F3 peak of Sec. 3.1 | | Sec. 5 (prior fit on F3, LOAO, type-II σ_a) | `docs/plan.md` §12, `docs/theory.md` | | Sec. 6.1, Table `tab:p2`, Fig. `fig:p2phase` | `outputs/p2/summary/main/{summary.md,methods.csv}` | | Sec. 6.2 (diagnosis, deviation) | `docs/plan.md` §12 items 11–14 | -| Sec. 6.3, Tables `tab:h2a`, `tab:sigmaa`, `tab:h2b`; Figs. `fig:h2b`, `fig:p2rgrid` | `outputs/p2r/summary/{summary.md,verdict.json}` | -| Sec. 6.4, Table `tab:p1` | `outputs/p1/summary.md` | -| Sec. 6.4, Table `tab:f3gc` (G-C), macro band RMSE | `outputs/p3/summary/gate_gc.json`, `docs/plan.md` §12 item 16 | -| Sec. 6.4, Table `tab:f3gc` coverage, seed-by-seed spread | `outputs/p3/summary/{metrics.csv,selection.csv}` (rows with `seed` = ensemble and per seed) | -| Sec. 6.4, Tables `tab:f3all`, `tab:f3abl` | `outputs/p3/summary/macro.csv` (label `PHIE_DT`, σ_a = 7 ms); ablation descriptions from `configs/protocol_f3.yaml` and `ml_porosity/f3/{training,registration,runner}.py` | -| Sec. 6.4, `tab:f3all` last row ("No band content", post hoc) | RMS over each test well of the 6 Hz high-pass (`split_bands`) marker-calibrated `PHIE_DT` reference (via `F3Data`), macro over wells = 1.224 p.u.; computed after the run, scale only | -| Sec. 6.4, Table `tab:f3sens` | `metrics.csv` (`M2-Sa` vs `B3d-Sa`; σ_a arms vs `B3c-R` at the same σ_a; reference `wlt`; label `PHIE`), `band_sensitivity.csv` (f_c = 5, 8 Hz), `posterior_reference_sensitivity.csv` (5–95 % range over 64 reference warps) | -| Sec. 6.4 (posterior width, phase) | `outputs/p3/registration/*_sa{3.5,7,14}{,_noanchors}.json` (`diagnostics[].sigma_post_ms`, `phase_R`, `phase_info.logZ` summed over wells) | -| Sec. 6.4 (leave-one-anchor-out) | `outputs/p3/diagnostics/loao.csv` | -| Sec. 6.4 (volume statistics), Fig. `fig:f3vol` | `outputs/p3/volume/{metadata.json,mean.npy,sigma.npy}`; figure from `python scripts/22_paper_figures.py --only f3_volume` (inline 442 through F03-4) | -| Sec. 7 (F3 paragraph, σ_a, limitations) | same sources as Sec. 6.4 | -| Pass rules, thresholds | `configs/protocol_p2.yaml`, `configs/protocol_p2r.yaml`, `configs/protocol_f3.yaml` (locked; tag `protocol-f3`) | +| Sec. 6.3, Tables `tab:h2a`, `tab:sigmaa`, `tab:h2b`; Figs. `fig:h2b`, `fig:p2rgrid` | `outputs/p2r/summary/{summary.md,verdict.json}`; σ_post and warp RMSE from `outputs/p2r/summary/sigma_post.csv` | +| Sec. 6.3, column 1/B_b of `tab:h2b` (Berkson bound at σ_post; bounds at the warp error; 60 Hz and cross-spectral variants; exact (a) bound 0.481 at σ_post for R10tb c = 2; Oracle/B3d-Sa ratios; share of the gap closed; 6 ms grid edge; post hoc) | `outputs/p2r/posthoc/{bound.csv,blur_ab.csv,meta.json}` (counts in `meta.json` `n16_wide`), written by `python scripts/31_p2r_posthoc.py` (about 6 min) from the registered summaries and the Oracle test predictions in `outputs/p2r/train//cells/*.npz` | +| Sec. 6.3, Table `tab:t4` (dispersion ratio ξ, coverage, training length; post hoc) | `outputs/t4/{summary.csv,cells.csv,budget_dev.csv,meta.json}` (column `kappa` = ξ), written by `python scripts/30_t4_coverage.py` | +| Sec. 6.4 (mechanism) | Not run yet: T2, to be declared in `docs/research/t2-mechanism.md` | +| Sec. 6.5, Table `tab:t3` (detectability; exploratory) | `outputs/t3/{cells.csv,nstar.csv,power.csv,meta.json}`, written by `python scripts/27_t3_power.py`; declaration and Deviation 1 (σ_ref grid) in `docs/research/applicability-teapot.md` | +| Sec. 6.6 (gate results) | App. B sources below | +| Sec. 6.6 (conditions C1–C4) | `outputs/applicability/{verdict.json,c1_pairs.csv,c2_sigma_post.csv,d2_threshold_cells.csv}`, written by `python scripts/26_applicability.py`; `docs/research/applicability-results.md` | +| Sec. 6.6 (Teapot: 152 wells, time–depth tables, horizon–top reference, σ̂_knot 6.75 ms) | `outputs/teapot/inventory/` (`python -P scripts/28_teapot_inventory.py`), `outputs/teapot/pilot_pa/verdict.json` and `knots_dev.csv` (`python -P scripts/29_teapot_pilot.py`), `docs/research/applicability-results.md`, `docs/plan.md` §12 item 23 | +| Sec. 7 (F3 and Volve paragraphs, σ_a, limitations) | same sources as App. B | +| App. B.1, Table `tab:p1` | `outputs/p1/summary.md` | +| App. B.1, Table `tab:f3gc` (G-C), macro band RMSE | `outputs/p3/summary/gate_gc.json`, `docs/plan.md` §12 item 16 | +| App. B.1, Table `tab:f3gc` coverage, seed-by-seed spread | `outputs/p3/summary/{metrics.csv,selection.csv}` (rows with `seed` = ensemble and per seed) | +| App. B.1, Tables `tab:f3all`, `tab:f3abl` | `outputs/p3/summary/macro.csv` (label `PHIE_DT`, σ_a = 7 ms); ablation descriptions from `configs/protocol_f3.yaml` and `ml_porosity/f3/{training,registration,runner}.py` | +| App. B.1, `tab:f3all` last row ("No band content", post hoc) | RMS over each test well of the 6 Hz high-pass (`split_bands`) marker-calibrated `PHIE_DT` reference (via `F3Data`), macro over wells = 1.224 p.u.; computed after the run, scale only | +| App. B.1, Table `tab:f3sens` | `metrics.csv` (`M2-Sa` vs `B3d-Sa`; σ_a arms vs `B3c-R` at the same σ_a; reference `wlt`; label `PHIE`), `band_sensitivity.csv` (f_c = 5, 8 Hz), `posterior_reference_sensitivity.csv` (5–95 % range over 64 reference warps) | +| App. B.1 (posterior width, phase) | `outputs/p3/registration/*_sa{3.5,7,14}{,_noanchors}.json` (`diagnostics[].sigma_post_ms`, `phase_R`, `phase_info.logZ` summed over wells) | +| App. B.1 (leave-one-anchor-out) | `outputs/p3/diagnostics/loao.csv` | +| App. B.1 (volume statistics), Fig. `fig:f3vol` | `outputs/p3/volume/{metadata.json,mean.npy,sigma.npy}`; figure from `python scripts/22_paper_figures.py --only f3_volume` (inline 442 through F03-4) | +| App. B.2, Table `tab:volvegd` (G-D) | `outputs/p4/summary/gate_gd.json` (`schemes..per_well`: competitor, n, ratio, coverage; macro counts and coverage) | +| App. B.2, Table `tab:volveall` | `outputs/p4/summary/macro.csv` (reference calibrated, σ_a = 7 ms, ensemble); last row ("Constant", post hoc) from `outputs/p4/posthoc/macro.csv` (`const_rmse`), written by `python scripts/25_p4_posthoc.py` after G-D, scale only | +| App. B.2, Table `tab:volvesens` | `outputs/p4/summary/{metrics.csv,macro.csv}` (σ_a arms; `M2-Sa` vs `B3c-R` at the same σ_a) | +| App. B.2 (bias split, within-well SD, constant vs networks per well) | `outputs/p4/posthoc/wells.csv` (post hoc) | +| App. B.2 (best-shift diagnostic) | `outputs/p4/summary/best_shift_DIAGNOSTIC_ONLY.csv` (never alters a score; search limit `best_shift_max_samples` = 16 in the protocol) | +| App. B.2 (posterior width, phase) | `outputs/p4/summary/registration.csv` | +| App. B.2 (deviations), Sec. 7 (Volve paragraphs) | `configs/protocol_volve.yaml` (`deviations`), `configs/protocol_volve.lock.json`, `docs/plan.md` §12 items 19–21 | +| Pass rules, thresholds | `configs/protocol_p2.yaml`, `configs/protocol_p2r.yaml`, `configs/protocol_f3.yaml` (locked; tag `protocol-f3`), `configs/protocol_volve.yaml` (locked 2026-10-29 01:17:42 UTC; committed on 2026-10-29 after the run, tag `protocol-volve`) | -Do not copy numbers from `test 2/` (thesis archive) into the paper. +Do not copy numbers from `code_thesis/` (thesis archive) into the paper. P4x was dropped on 29/10/2026 (Pivot 1, `docs/plan.md` §12 item 22): nothing from `outputs/p4x/` or `docs/research/p4-exploratory.md` enters the paper. Wording must respect `docs/plan.md` §10 (forbidden claims). + +Length: Computers & Geosciences limits a Research Article to about 5,500 words excluding abstract, keywords, highlights, +references and captions (secondary source; the official Guide for Authors page could not be fetched on 2026-10-29). +The main text (Secs. 1–8) is about 14,750 words (crude count), and exceeds that limit. The length pass was dropped by the user on 2026-10-29 (`docs/plan.md` §12 item 25). diff --git a/paper/figures/p2r_h2b.pdf b/paper/figures/p2r_h2b.pdf index 9dff36a030dce726e241bcd5779ace1486f693d5..6b44cc9a708a924c4ddc626349e56d44a293fcbe 100644 GIT binary patch delta 11528 zcmZvBV|3?Dvu$kKww?TgiEV3QPi)UGp4i63wvCA~v29I~2`9#V-gC}c_nv2Nf9YC# z?dq!9T_3tvE#`x_=YrQQfkSJyj~l!A4}5aya;Rg=mfb4C5Nrn2ViQhsN+72C zR=dw#V^W^^@*>#cFj{N2xRm-HK^%1{qc+1BD3q}SqkXDj-JaLeFK_ck{B?W7VeLP< zqn084eO{S`^-flFtOhpDA0leH_uFOwywfeSYis=bi-oO04W$Ryk^!jEA(vNdLg`K5 zrCz|5dXO~ZToW#T@7cQL7}k|Tqv z1O?LhSP!K0N!g84SuanLX75*- zBkcA*{mi#j<6hOGA6A?rMS|dQflx{SAuYF0ukYRsM=}mtIeH;M5;~%F3GW6=M}a22 z&Wbp4ZRiG155qlYAH!6Zgw6uxx4j^oka8-NQyw5NC0n|ibS{B1ntnKtOe`n{7a7eH zcpVlX6`;ydm`IeODD%ndB)&^dVh6@CnyOv&_G;Cf1{NFH&N@1`K&K0E|Jg3yrz0!2 zpGbt(RM)tV6q^E%BkN)rQQ$GxlUKmFM3yRW{9$;DCPw%Ojyfp~O&Z-2OhL=Rg}M`R zT874q^;sTc$xlOt#PG-w29el+ED(P=(oPNT0s>i`O>)*x6dC2Gc-$@0N=ZKQU7D-z z1-ai(P9`@#-Ph}|R2F)G&pfj`THbCYPKbu15kix*waA~sCc6NAlMfq0|19J>h-H*l zWv~qwBbvgi@GuJOj@61|RZEWlRR9N~kEGLUSj#dY`oV=Dw@B5nAt+XtjkuIukvdh` zorUUz05WT5Zl*Y|G5ehl?`(zI2CslxwZLN>`uNVtymQ6``7sM{_H2UFaM;>6s!o#( zpC?$!(V?m^MmicNn}uI5xiW}1K_=;u9+`bI#*Hy_qb4p;pa^FfZLqA1;`_q+gOm-+ zy1_T7%jjP9&MD0$PKrEQI&4%RgFnxBDAT>H({<7%JHr-xKkm_pI}yAHf*#AGsX@xkhFn6lEy+SjHR&~>n=~hTo{BI zB~3i4t`!ps>x4fFP5f?PJ7NOCK@DAK9Ps{U3Q{ni?8oomGV3Ak}G$PUNbH2nzw zqrDK?aeE5<_5&G=>vTADxRqopm5?qxep2`JJ$_k7kW=t}s|9oH+iC|BYmGqlk&Sc7 z-$sKYl%^M8${pp1_!_VBCktjenwxjtn854%U4R=gP_K+VAF;8*oK{GK5oW0zA;FbXS}>%}#jg`BPL2 z`2M=BFUr^EtQJ_Y5+cl&xj=h{P&c>;H#s~U`Gs6T<0yZH#?rcZf-E>w5EJx`NjhH( z@4yvw-~&N!xW$KYc^buXE|Q=?0hE&0N(+u~gy&VEQ{f!94!j;lYK!$|X3Mb-E?L9C zF4R4+c#_C{RhHqX9!NMF$O!|EuaDvG8>UQFZMI>9-1bERc1dKre&l-`7ZSa^gi^bG zv=H2^jf5MtLAHxnVG{U{3uODe9khI>gMhj0dRVg;x0Ukoqc}&S)=dLf-(2Nx6g|%~ zSMWM#Ssl=hRnF2SszAVp{V`;Qo%(~v}bC##_j+2-lUQ4}I1b<&7Zf^!e! zo67%W7TUmlapf98d6HOILSggQ@Z}6Xl>A8z4_biQm#`WPJeX6mrCQ+!P42zU;4*>% zI$p4)jq{HohcP4slBjl)v{}fT;}J2d`x4al=zWJXmsI6lc3!FRUva8G{196Px6BJC z=_w^{;467L+N7JsC1Rln8_}mm53w6jq(n!xtxG`>Bhm0*(Y^%6kh9b|ZCP%p{Tg0z zLJH$xb4Xf7^(D+pHeIp3=pyo2IGx16vkgtPlh0U8aMIQ?P{jqRC7T=R2Qi@sH2u~&&xhGU4&mVlhDqe{=>yM z?r1TFD}~pa*SBSOx41v>T;GGo0o64Y4esbX-c!zzq(?dnLpB6Qt?8JoBHcrve`z?!I?B4cw6e_F$G2Y zX?Fr1Y`ov^N=ltqjJ0i8kG3CSQ-Mg(5c)lpjX^u#I-2HLP$~)84&iNHw7p`B=<-(X zEWTso2oF|&4|CQrOrUoLR^EwoDe2{iTKv|nVg>|y@8{VNCW7iQLNAOU_!A2xOeU5C zm*`%d9)hBe5n?}j$rtXB^98O*TFbe*If?~8MR)pFpDGH&Y_omj$SFHk-_%si3y33E zD9YL}LNBL(^N3Qh*Sw${LO{vVyP7@6%3teno0UwX(`%QjR}bz0NLHy8GBJ)WTdB(` z6Pi88tVuurYK1OqVTuqW{5f6jN>Q&+N9-Z5YG7be?8cEEn|If(rqNn~t2hM}iK4Tq zRnU<##a=7%N9V2?nz!IgpnksD-y_#jOexhEh=hJcy$CIcmHv z=L7Y%N+kmU*f3jT`ml9IC4(0_FOKqT$X~6^<%GD05kggnb?fwsn{9GY_K=U`m0k3T z&GM@ot5wC#76TZ4toywVtupQxF=X8-XWcC4*yS~^M1G$H0g?DJ5B( zHAdBH{Rs=2n}$x2o^Arohf*VuR0ZTmVqz-AdXDMhnm9C5(}R}7pNvh@#ftV&Rz;T! zS%AOB^C3s66Ch8uUD)r2aJ5JbNB1S!@xz ze-Y$sLQ5Yc3@R`3Az({}Zjv1#7I_sw7XBt%4y2`K#TIzX%;==v=+bJmPuURf z5k$46xH5N6aY8}oo*eu>SBQ+feVpzHO}&|>4qr?AfzfhjUa33e2-RMeBoKEVh(}D@ zPS^oQPTS?3s=JhNQ7>)WwmmXSq%&v}Chd20+G3x&eC_GO7`IXdSx_RpXpf-Sz~ zIK`<#Ch(^oiHqJoqfX`b;BprX;$>HAycM{sLzX&cA2%DyhATBuVMNM8fR-*4MmJlv5eWBNI$u03%`*ECT zNqM|**AT9rJjq+aac>ZA#PsAjk`Mx|)(X-r>U4c4nu;@N-%}5Digsd}uR8IEOQ+#b3l{*Dw8so zp%J-k8~ltd(W_d{?ISLbb`!4ys2pbO1=~Crak?F{CbgpzLvV04uAq}4qw;~+_{dll zEF7%dtjTz|lWO^?fD~`|&sobUm)#HRcd}wHVNg1ViD0sJVi;s-VsP=eY?ho+ylm-0 z!^7;uUbf-lb|X^@O6v=X91eROu_KBRrSq0^v9wvV?)*;{YQKtXENNl5W6^$m*>Z=O@G%D4a%Rr zP!}~3J>p3#K=fCz+lhSp?pjAvHpb8Q2x31m>$U^Oy47LZHm(`0^-cUdTt0RVY6Yer z1|9&!3qdb4zBDH>P{Ayr$`Kj%9bG*3VIhJ>jA7j)Q>tlg@j%_ zHKwd_D$(@Ym?il$b@|+Q#_( zaC@Vb_x8OY1ZHcEM^KHYAB>kR9DhMRu#!oidnuJV>lgQ_nrnO~n(Iy2ii8JDL3< zflYgZSc;KLCdt^&y4K^k+AZEIX)BH?oypDZ7njM)L6+uWo!#3Wq!AduMO|oeTjcBP16kH-72<$9V!Oa zbxc$pow#_?NU43XE29w3gE$A!G`Y)qfH2X6w-FQ_#{}z;NI2ma82IAFXTf}>5hBDk z)+I26s1{FV2~T&#m!~c^jnW!OXZiSP{gd0R8*f`2H|S5ZEIV&!q;Hd3IpY-{BFPe5 z-zcYOjr8c#YN-+=1}M;Xq5SW;gIG+kN&2Suda21>;y0*B)gc#HPr#pT-4bQl0N0-! z0;BKB4zRDp2M+Qa)Xj;Ei2{D%A2c6krvZ1Q7R3$ptGyEf2g;)#LWTU91MT#kb~zHV zovn-Km^%9uQrC(9%c6OADUl4f^8&0eqCrNG(9~Y*Om^gW1DO#1%64!P4wdaIT2Mo)VyI z9UG&t;Z2Ia(R8W1BXv1(8qoGZZ7VO+uiWOi@Nug>@%V1@Rq;x)ISwqJWH{I*;9*lm`O zS$Lghs3pvMJcuQdZ_W3$HH%cK;(J>uww7sqp7H@_Q1pI%LB1xMxn4^hiy*8GGzbaB z0e?LaQo;iE)*L=}4!cw|U@KEHJB$d#%x)bnD~ZJ47^{g!!A@p4q&AzKzs5Fr7 zj6+jM(40+8LVZXt`aQ^0_>dRRwQgIB00~yG z5s;{;sI;V{Bs4DBGCfz}vMjtp5Z3MAv-{Hmixo!+xa)QDldsYTngWx^IZ7;TV6r6f zZ3Tzc8dRXP&6Z3&p~r*X)$+_zG4+Jw?W~(qu!c+}&nUa?F{CQwKaI;17!i#(4Mj#4 z-d4YC+ZA)8A>>UR0+PQN=25&VBzDV4P4IW+bM!!oGIhkAHx~Sgbke z4jwfFcJeY2Iu#7XEXvNKJFt?HP9lNC_hLkJQO1A`%Iw*wRgvqCT6}tPJCO%85&;rv zYOc+9PalQY_Sn-)6ovQ6dP<{97ox|jjEqWb=qKzHZ=JbMfYyeq--NMqSbi@j&sx); zrKgtJX=bJAEf7C&tPT5J?(6a8gEF>;2G)V*9__t>y{kOSyZ-){MnroR0mtP^cL$BHwcMo$fU z@Z$`(9Kd1|5>V_G*w?R01L6>YanrQNnDUP9+3AkoK?Fi;E}}Cl?vH$kk4cp38jAGA zb=)PGM1%GLlGiO!;{EPN#=D;`YR;UEwAg61PNFUuqYt4P{jT{|EFgcP25iOTJ&{#J zr>2-L0W1la5g45tNNJV5F7-qWfqF^$cl)GGGER`8;#A71z zC1b`~L$X1SBh(MT44^}3LeP}=J%kJ#-s`YmQ;yiaQt*Kz!dld)cB2AK>&G2!Eay~Vg8*1Cqh$w0?9SJh-QC1leYOQJlQYUs>4^;F( zp?DX8TVkBIkWr9)6k_>gyWq5rQ($BPhL1vhkwQS4jKRBzE}S$Sx{ODvz6paU&<`hT zkQzi+FMI)aKf{-Ja(W|e+3JxykxGYPYl|3V%Sfxlz4a0+GYuw34HN#FcZ*1;ThGii_JJNrZOp}!I{ySz^+`U+! ze{5Uu@z3>TbPs5LN)D?^!G4aPqP;WMhHr&!Hnh0@C9B)_{if%!U7R`xU}9Z1-v=~g zSJyvgd>YtYfYO4c>#f(5sC_G?hAyhp1?%zH^J!vh!OzQo%IdWiJ+}Q!FRR5t35nh~ zO{&Ob{IWR^zP8a?^cE7#wB$R;IU3+gT7$<|K|>b%?rqBlGwh*lcson_DkWC7by%4A zzmYk8QY#eocL@YS7*Y6uKLr>Pu%UknG}pAM7N*`4Vt<8^=ojG}9|P{kthcwhYxQql zO|73!ZBEM1L0DDQWZPM0zZhFJ z7!HdDDte@NFN1%djk5X*&_>D9o)yhSxyiEkWRp%WVYv2ob+G>6axrlp7M4`{53gwosLfTS| z9v4C4y`TdNlxQ*lC(2vLxw1?w8Yg+bwY$?oi@Gq?<=^z==PVxgCUJZ6IYU`{TXo@C z=F^*yYOwr>0XB$`#H;0aRA3~q!_jfW`*A4W@$O(~Q-2weU%y9wv!DkK-KVDS8xAh3 zB!;^~BgPp7@muoFZ8iKV!A9F(0@6?pnQ|0! zD7p#I_yuy%i5LZ|#b&CJutK4seZeBUGS&SM;QiJ3$d)U*k)eGTMPb7NiP}^gN)vOq zhG)$9on5(rWs=Omd|OgBxs?+m<+1r);6ZC5YVZBi!M8CZU`4z(Vy_F$S-S90%5Lg# zQpwN>btNpg=5x8yo+}x9H0NIGtJ+U4D{FN9P+Q}!_QWys@<%y3*e?*;6}tPS60*=9 z8Z*x+ZAvP+CoayB0?|8JlF%f*EkX|~z-RmPa$HlOVO%i7yHuEC&ag)*@x@sG5_g1g z*f3+WYl4>Z4z(pF1ufe3;qhqu?eOP(+ip(Z%yUrW_-mJ3DP^1eWjm$7+6d22gA2jC zt%$Y3I|bZ9wEfq2cuU(uhBZ8` zIpVn7e8;+$P!3Er6-W7Wko-fFp9lwi^*h8K z>Mf)cu4$83+?;YF))wZG#(5uqo+5w4FUTf~AMw82IJg5eQ|TzV=PcSXv?Pp&gjnf| z1oN}WUc*zRagJY32%Z~zwybEsJV;({H~2m`N6hLs`gTsYD)ct6m@B_up6DE$I|^I^ zw)}H=pruIhMnF?t?eXybz0`*%drKE^`etvo^E}nPO>*LAX*VIBHKov=^~H_%d;m56 zRlfMRTtEzyD+fBG;Ee&W^~sfM3ZkjQVHq60ytpOC|}8 zJ7JsIY-r2o!$0AI2Pt~Tbzfi51br4PYGHA_aa@@rrqOJYi`DGVG$wSu82i|>S(x? zEEs^~=@?zX0son#q!0_H!B{JZMusPb3U-=A`1?)d9gT=D$(3slk^ZJ!00_njl3&8& z&zA;w1;aJyqaZ{oXhxQ+MiLcfh_{c6Uy(w%t+~E;y=^>exfDm%BQpbW8@IL(g7`A< zJnis)t&k~Fw=MyO2Q_wWdpV*ka?md{0W_+c9-s{h|WVUaV-m z7!a=(q^nowTU^YkR|lq7Kje~(7SV2@Lw8ku@Ub{(d!2$G?P$~C6 zg>$+D3}$H1{H|^-g0Y|h+Rx@`F}_AxqKYulX5r$|3CAVVq_okg&CBd(b z)SP!WVqd?9N;7AK)bBI%%OJ`oq~p}cPBh1gLHK}AsYN-58C`(Qc#$#wGl-Xl3pwYG zinkY`$mQwMAG+TR!z~Gv}6H~IHosq zufF=b8tqHMr)M*HfRti(n~CFc06+2v&a!l&Bq;rc;3@JBU1P=I*HG1L4kN$bAY!>a zJIdpuDkGFULzgH?-YUk%5$4T$=7MEhOmR<+X-QvA{DfTM=<*>CPOzEQcIs-|ktHTLzRMe#r&{^-~|Al+rzSE=5wMW~^ zzvy_qk#in7`={EcC8ynu)`x7P=Q%*4+{^0AwKuJ4YChla}=8&9mRXtqw~tw{?~@bu!YSRJU=0qvSCGGDrf@ru%As zt%-}fDPSr35$e#a?F3g{darl)r{MmlOPSxe3G%*Pwh&JqBUq=hL`xv}&(7AiN-HVz z@CYr;`Ildg5+-#Tevf&v&v!?rR^}cAuG+^TAvN`4fJo90Iq{ErC+uO>Twa1d9zrU| zRiw3-g2G?4Pz7fjF9pQUrZ2BYmQ(cQLpOS`O;-U(Qk_VO_*)6{^iuCF3oHn|aJ>yT zoe`hqguF@_KevqOIR1-p_~6MqJ-kRwW8tOUY7Qvp&s=YADt-z{XUg7gzqd|aVzU{EcA`~@i{HtcE1sBzK?gkjxVFM7!Wreui0x3=|@(yaMX;fW%Y7- zS#Y5f#yJ3g1}_GTYHUz1?W<5aZy6bHN2Ccz&*h$Pf9?HlZ|`qOyqGQ7>fg-5e5-%s z_N*WkVSGmtlq5lr5aP(bv38j)j8N8i7a&pm06unSLk=z;1lPLFFHi-z;&0uQMvXI$Y)}wosGQTDgly zXaN5o^dO;r_%;mJ-DEnH5mdK-aGx$!Z<|^j*F@1=gkDurBOOg zzWY0E65$CKmktwWBU>xKD*Nr+%gm=vU?6zG`vUo5TVgk76#z0|jg`zgzq%kE>j9Xr9_k)O1@4cG?I(>3FP?eZs zB^ns^Jr(D(#(U^}hBghE=3Bpt<6H3tW)=Z04_`lLj=j}Ql6p)D#ILuTs*qi;B9Grw zTtyX}V^Pp0Qgc0Dk4rGE%&GyQ<@!%=A;+aZ+4A7JDj{YZ2KkXoVLvhl&JLK0ZCdiM z6~Nna;>*ICP#8yCP^yh&&g}d50p*_<&1HaK{4$s7%O)WEiKa2V-(8cGv|pNC>D{kQ zp>DD7J$J*q5q4f}9rF>iWCMpLmI%v2L#p%@4y4QP=>XkRA30k@OB+S!-ZeoD-appJ zh+a9NXc2|)r5|h1zv9%Hsa37BZFNH(C`R0J7hIwOg@_VmQO{f~mM!=U+}{mWe)Gsa zrC(t6zg^J&GR(sm9zB23Xe2kaBRSod3ON$vdP(}}Za;}TDegfJY55ZaY1xkX5u_1W zY)Prq7UmTxn6R66G(BP=3;xnX1hpbIglf7Xf!w}K!k`CZp;eu_#vW-&I2Ur*AeZ!2 zNg$R0pZ&L1txJS91JTwlz<%)MnZV&>D+^9QTvU71>ts0fAP8-mOzSm)>kq`lITg8E zj#OEatu*|2(1uu6dl*4pRp2`gPe@7LhWMqp`Z>1-@*jjU*bs~(M6;ZkSVZbWDQ6et zDL-WV{8~LfO0J=<*ld+8>pm4{4HQO@M=Q_5j&q_RGRPfA3x}Rugt3VsSSW6eaJu0I?E<2-NiqowoF`Smp zl2E)RQ<=T*DA$~7W5x3z``%T(etykelZL2H+6K{r^CZ>tQy3P)nn8zUjQ}Pp-16U?F-=F2(?Z->`FO`;tk9O%LjDwHmhMfS*3JE$_$(&GkXUo~*h^ zUf@FZWDYktT`DJw%s3xBPkF)d=Y+|puSvBj>Cw1AI{+c}MuR4OOgeEvpHJzHqeDsc z5`QnmTzs9v76TUjiGXri?nZGHECn^&wQlZx-+4?#gX^B;;macn$MKfvOA9I-0peXb z(|E3!7_!YWLg=R-g3uHCw^-oxPt$Q~$p-7vU+r!K3A);@;CHP^zsj`rkD0rZo57>a zP{6(=!G#Ax$pljN1tRfPOSfTS-nEp8;wsHf7r>xPNdr*?5_pPg+f;uPW362j(6)+P zK@L-I=vg6A+B@$>iv2_KPQs=CY%3hXKCB>?F?PwV8c+?@z$OQN-Q6tV$_c>b ziCBpOf`>OrREY-Q`YQr2A1}whJlXl!dHMdrIQjm|gz{r_YP;`;9@fd5AV zK5h`#zn%XXr~Y*yh@Jf}jF+98{olU4Tz|{L%fs`(3I_h8KJP!`|I3+;mxBxR7skc? z?~2)Y`2M;}wtr}UY0t~Y@o!bxctGsH|H|f{T-dq)>5_j1{--vczcJ3guZfGB``^vM u#>)r#chcxFdKrUX6zd8`a$;*=zsv?EJ%>hE7rj}HeLij%pG=Nk9 delta 11796 zcmZvBb8x2Jw`Iq+)3I%%W7}_R+w8ot{dU-~ZQD-APRF*5`Q3Y`YG%G~p1*djv-UY_ z?X#<%U3J=Wz!vksYL~#E+Vl>pUmMoJg1{)UVdhfC7qufU2F~EY@WZs~$0?RHrEqJ% z_eQUYqvH)@%9rth0wM6B$ooUa=|Q;=*uZHXSu|OcvE_B2Jby@|cG-}WonM(Q029a6 zRxeQSrD$pZT^M3z<1&+E^Esrs5q;u(3?+diL3mPecuu1yf2oyu94kYw)6F}uE?^?%Om*_Y!aM_8!bBmci`2? z0!N2YKzP-t{Fk{nuwsT}}>urnE}GP^KQoJiNEvl}W7G zYnn%+X>Curd61D$QREhN90M=agj4rZF~JMJ@)7qF^8K}K@m>1|npJmOjvbU zU%Jzjus*Cc_1`|K;r&jhg~50dpC&322J9#t)TZO9*23=MF36F zJ`S&+-rkIeSgXg354xhSm<+0DrnRPjex4_QTUPj8?T&q1s&jg|-7J<*9BComJo>ko z>^^PelYDeib#^~bWGq-J0#l5M_0yu~ZOS=qx9ro}He&9K7W*CC>a)x#XFfjHFXcTo zH6Qn{C3wxAi_w2Mto^`7k(3wlZ+nx#1L-IVI;(EVlP*N9wCF7QaZ=V zxdhDj|A}Mg(WC-Ej-^vZt;xIvMO6cW0oj>fzEfhb_C_!Q9K=|5ENjS7nWHlT0T{&< zqK(Qdj52^b6%lW*^d3A0H@84Y3qAUJnZ70j4*5Pzi90Ax9u^eAKkVCSVO%qYm*!33 z*R0dEGsb2&Bj0t}frZQfs@kCBDWQIc+Z>accI7{dtdBwNC0 zd)m?~n0?6WD!iG^%g5Q&I=Ynf<`nm zW_Q@ZG9usf6NYs9<`k9~=~78pQ23$C@4eNS%vN(CF@#o$3i6@DS!-ltc(Pq(Cq$8* z6cH&p$oKC2ff?ahjWX4D4P$2KO5{GYW2otF`HA*q*J7GdvxSr6Gv=GjP=YiVt4hOz zyDBiZzcfsZ!StYAM8bbAuQ{g$$jcb3)eaju>1Uc=-6GQ;uNX_3#eqJY$GvcdCUtM> z7%2WgTjlYuRsxW1tf7n)uyk?JQjwHzm!9pi5cnn=fWvji@DSpBC@{^*BfK~RRsmFe zdl5)FwjH=6$OfH4v!zV}fVQB?q!mm?1$e9+H1ZNsih69^Q9mrV_~5NQ0^-!E-eW*( z(+uZ%{&UGLh@=(g4?WJ2C|*T`7Y#r4pK`jgf9u-G5hop@I#~qj4}!;;6Q6TX*`HzFtkR&1f9<|p;+Yb33ZVfwwSb*&bk-pMib|Tw34SFHBb=OWql3bFLk$Az zDsaaI{K&>_3?HyC*;3Yvbk&Oo5gx-B*)BLhm9WHm*$A!2*$H8rd$qDRDTN!BKuK1- z!8MErdBxG+5yYg(n>#xeu>BaurR)@;%wr;K{f8&m*^e(%-TZE(WqSRx+PibQ#Q>(N zqlw+=!g)llu<~n`Iqd9oa=X=jABDPDD>B-b1b{dT>N9R7)ATFhgnFL( z6S6-DtiR?*eWeK5G%mT3sq_qB?S~GW|JlDo@1Ke&>^oJ(bFfmZqDNpyiEXU!qK@pJ zA~#pOWcyf5S~|5!z(0tgqRZcVuVO!in1b^o6>?u0gNvGP0EHseLx;R~Y0MgX4;bDJ z0PF4N$IZ$bre<)wpP}*Drr}%doUPheNfT65pTkDh^Y~CiAD;-cgxj&4eVuMGioR0d zS|eZ+rO2tZDTwq{|1Lf#y<*DMkK5L1vSh4=x{I}Dt!Tn(8blbPQ#-Pa1Hg4;C!%#X zCE$S;!?SY$Eu&a|&;4bxVtdi42lSu>A4O%&3i5-H~HDkmjV@Y9ANjuLzv4yW6*#tGL@koUG+ z^H-Tp#Dv29&2*)0d;=6)c;Sc{sJAK}G=9?%l2ZM}W7qa+89Ttw3~7TKY7Va*+5b2Z z6jw;2vf>grgC9yH*LG^S$o^bo@bNRSh!u=uOH}LE!E7{dF z-ofU2g{WP|MOjo;Xk<#XrXbg(@flyp%tK()C)EH-u{kr7!~yE(TNSmMP}92$*2|@F zP)=?+f>gE0ZLgAMf3z+*s;SziQ+RWw<)|Hr*R%I|tSBhDyZ=d^8#CeyntMu8`%4$h z!HYq|XXO6-_o*h|NayaN=|xL=nY%6tgbf5}tnKfD`f}@1K~m*ff|{d;tNKsMns)<5 z^r8}xvonIla!#N~B6fl9ZX+mPCthAgBCEC-HvPjP$>#6ofsbsC=rxRXx&OGTVDy^q zL@}sHZsmG7QOTOw(A}N@w>Xee(1BUs-M+wRj3O1ebjzZ`LH-x@VCQscpWT7R%=Yf)M@DzXU_o9@>y?X5 zP(vaIi06>=26Hxlb;f^>PMmWNF+n}t z?ZZRZ(|-*dC%H}9)wJxO>C0hd;I6wQS>}Y%cjOisMZLmhAl3awj)XQ%NBr0%PE~Qf zti)B-%-gVa)Rz~UzyZY&i}+AOu&+L-weB%J(R=U{WUKXd-_>B}T3N1u2n}nhqL=0F z`(aXi(7s@5EF@%=mnFCc>V0EAsx>0)) ztwON!DXKEI!;*4$dZ%bFrQcS9OkphB)te`$w%_nxW&^!zA;rLhvFtf*llo1md+Y@3 zs8@jyO^EE~iEdO=uK?(bU(NCW8qZx@gWyn41G&+L0NxRwCN$^@x2Y+TmKTTtm!c*R z3|>hMmqi=#t8VvQA9>u`x73k8Imgj*g-XMc*x1B@WMD4xO!m zIW?3ZeScx&V2?I$ojk%qtTpYcJi-OewR9UUs~j1qHOsZ2NAp^|i-}6CHR?zBMrP4T z7K0GRZN(pU*G!FA+jqvD7 zfs0ckk8gxfyxX6>$DS~N9*e-20QbrEzV^f%1<(g76PC>t=Tc~Me>>^gKzo7~0B24z z>EaM1j7FsDt&+gnHzMBaL!No|GxI3ozyfe|51IX3#ly}6LPIA5CVM0JftJ0Wc#pcIYbbP|qA3mC>L}Ke{6LheDU1`% zb_l_-j<~wR0kM6aENMpHO>>q;MWC@p=wAbqNjF2vF<xASR1*naIbzFO^A!oe1ZRPyx^(b+Av#Li9r42S^#$2nmA?B7+#7+_@S+B;uHK{ zePAZGpOBI^6CQPQwX)pm<=PW#fSna%*%X3AqFrB6P5Yu-Xb2yEQZjrquz?oU^#2^H z6XbvG?z~{-kLmgLu;R4^yocnJRUXcE`|0plRq5sfYdclbAjPN)K!0m<3M>$f$lNZJ$ieff$(&JW5L;R2FcL; zG59OnE4mM2mN){*6hVdv$O>h20p<3(9#RAuLDV=)vp^F_i*>tznXcX+DZwD721)+p z-fLC$BK`%ZJ5{Y1|K>v^+C(@XJ-S%Le1>g+)o-hkwA>Y8i`BEd@7%HdMK*TViUD-` zBCB5%2&eUpZQB%B;I5Tk-LW?)w6*_v7t?GSDEbH~aS@QU}S$%{4JeD3dP;-Am>DGHloGDa4nGm>4 zHChj-(P3xak8GDHZ+7(ZHS>)f(YG`xwBuZ6HMT)nShG=D$u&)EUc|*NdN(lU68n2? z(mKsB+6Ax=Vl&jM)cMB=ZLT~?IAgog6BV-Ku%ygUdv9G7b>1+_|y?)`acb@blQh|Um*H^RA2 zU;7ZB=JFl_lFBlq4UoQpn5(V6V@{dV|%2YNm57Zn| zz(n9qn&ctg;npg_W4<(*4yxMqG{q)kH>rP)?lj@PKj}%rqzvy#=ehI~{l!1H`3^SQ|916Z&wBh_~Q)c#pyi8x;_6 zgX(kymRE(Z^NeQyWbqr*hJU9EV~OV*5XQ)ibW)#TvW;lz$dawVhvq`jKR7ii$C`Q# zjB!8|g?R|txF~C8FVOKw?22bn2lDR577^SxzEAJ%a%z#H6DG82VmXE>=n5O`=tk8m z0O_f>lE}EG>1kNmNirgiUCpVOY6d7}+B$4a=@En>1`j>D z4vXKV2tQ?Iju-M3ea}J+%mUS++0wX~l0=F@BT+fEf+hDZC|`6XHOhX;@0=da*wLA4 z)@IbQuwlm}A?-iI^pg7V!pRRB!PQP9PdvN3-^JbBEH^FTD1z(e>tDb=cJ|bXTbGG( z*VYfIRLhHLK_6u@DKt@IvdyCW2@>@<6@CoOQ>TZ1e)@A%=`N_b+ zGiv(Fav(6A`?7~;WZf5YQWg5Swm^8roK=R_ovP$$pREqjnGfn%!<<{1vTvS z;7(3%LMwIGglTGYNG&y=y|IL^{L3uNU`DD!=tak!Lr1~z^Z932cA}q)F%>)yQ}jsb zQz^o>@iGMSL&!RV$y|HjyiozVfOmx$(`?jTt*KaCP?3{}4knNV&Er>8LPYVMlPgro zh&G;?l#KWo;8!7k2VMiA1FM7_puPZ{R=fQ7R+5wID>^VhDEC{YY=l?z!@CTeJuyKjdHQ9=(*maNS!yxLJt2*?N1uL()9B#b{fJ0)^1L zF!|$AclYk6A5}N1zW>kp+0euEwrjl!Z6aS(p*=ODF*Y+;dfGO~lwmh@$V3)ElM#0) z*d~h?)E#iG2mhwd zSwbK$M-eeU5g9bFfDKn*>|_yiRt|adLDDmD*l-t~KV+++r9oT~V{GZ_{;oHewKE-( zO9Mn-Y?JOAJ}-5^Yjab1t)@;onRW_RgtGx#>VU4Kh5?!*lzh)51L*IFgY$5WaYU^C zQUpT-fJO!Zk@eyShUOfWb%qD@qyqPO*^%y$KW|ePne}yB@f*~)o|n4e3ef7a;R+g^ z7J_pI@s^!m_))rUe!mPo+d95}B9$2O!~;)?a)wiNtVDDT(8cYWW}zkJT*YHGt8qi(+q>|RWfQxn;qJfEh_Dp07aE9;+G z>)X73jYNII6uI`HJA*E5d^6#i(2dxd=on8YBkJW4f zP(qnD>-xCdeW*aP%FrB9fa7fSqPnDb{}mQ}-A+#2uM4s1xSyW;P3g#*nZR+`WauWw zUtN3YuMiJ=`T*5C;RfGj!;84gY^GB)-gG*MuVB&s&Cj=HQ=~i?KD7#aN9LGL7LQxp ziO4;VN>rFN>-t zxCF0ht=*)04WF~6tWDeyQts?l+{9d%9cw3h+MfeF6N;=Xh8IWEu4Y zl3A-i*(?u6XOUwybU7md*c$hqU{JQwBIB!;pt}<)0~wRSiXFj& z^!3@h-LlV&QXbk6tIy)kDYzDdjz5Is{#X1_!<0+_FG57gPLNvfo| zx4o@6A(uP38??no2S;-bzm7lGL8*QQW z+M%-iMh0qYnXgog@LDKFxn`Ptt41TY^C*OivEEi^+oUu%#k*7~I!RY>Ai@o;*zO8P z`cb-21D+oLy(uQ%{30Fvjo!NumZy*SPiMR3;fU)QF;l%dc*c&>yHq#(4X{~Ix#gsB zsC@YAntQn7DU8_aFRQz& z-#&2ZJo}QJQH|LWs`3Vi5+A1cQSItEpBFZ>!$pwxaaNxHUgL2ugk>vGS9RH|IpMRl zXz$z2KJzkZbvE!_QIYR=ImdF97)sIx!ca-a8P!1OdjGoj??5$*t3bl=*)S&sW07Wo z>7HC_?joZG6hU{vaR+F1foaHu*!%$cA}B7pVudCH>Z1QUTF6&*5m`c z@00djFL`Io6hKJB*sSv>^yzohiw2UW^ z@sjX?$Q6Wn=G6+DQsnI=fM^9H46650$HS+hJ^^p&gG%buzkCwS4KzmVgelbAfnv_)dp>WCq?fN`U9&l%{y(hMq`4XzL7p zIZN9ZlQ1yDP`8D{R=f1LH2RxE0<0A{EqAnBrfaXHo{C#$tzF5ShXkG40;+REU!sQ>GxA zW*Af`DkM6SX(u8fW2bH)$dbslTvwj%fm~VSFg&W4ID9Y;Md%j*XhTvainND@&zkRF zWn_!bbBMz&)oGXy#_!LF-WNb9pDY+hIConiOgv2J*|Qosw_6UE<$_qrF3bt0p3p5@ zR63K{+bz^cvLOw~6TcIe1_P!1iRrVKEIkgB#}Vwc<`NTLWdFzn6T}`CI&_ZEpgk?RaQu`Ok zd+^L6%w5EqIp|zx<02;{R5H|hEk?#!lvF79?=|`zNN`(PVbEDvSbzHRYB1lnetcB@ z$oa97E)Bj{eZ-_LT#W-vUG+d@{_?ZxZGJD-J;U>Vyg5Kg*mg`w^E5&UHHtp#-wBeJ zZ+pfLob<3)pp~;JbsH; z@Oizc$g^6{u#?Z5dEUOqCD%1i%G96ZF>5uw%qMX{olgh&c<a!DT#NW_Y zoBMl!1+DoP4+Ta!g*&13ey5;gdIP&EjHR=9%%**>BPXp#_1W!eA)wjIb&;G7OS#8) zV(D<+n?vp>T=XUTdbEKs4+8^90j0&w@R~ z(e`k+<`$3#5a_(JhaCP_A7yFnZ1|LKItDix!Z7~g<8r&5y`wX+Qq`3;XT3#);Vowy zB3cF3B|8Drm1BhW-cJ}oB^rcm1MtMY;fD{A+tza!bdZoowJRPORJNmgG(p;AkU$*? z1wB>vb1DFvxp!tIo;?+1KEB4xX+9-nIj7ltx3M zCJS9gtk5bbtlxMedxTSltKQZWI_%h&KM#&Cf(@%qVK1#q5&2vvCR|6tz7w5B`MTPW z|9N?Nf6U)>Qd9bji=F+<_^IJZM=W0Pi6|g}d>abXSIxY(V(Tk_AkI#L~| z!(?P5iiWpOyVgRp`#GY>jN}=J5uJt`Y|ZgfN@qR~oank2Im2TmDhY+(lBb?~5Bo_d)I zt&nsZ0`b8@GBF21D<+?-C4P_>s0@Yp91SfVfl`Un=^3o=$=a@8zx>vJ-)mYjNw~fG zuKgm7-;2pkHfoAt*VNK7o6|8^pn$dhvD zsQ5-^4MKYC+Z7soYJ_ukD9DKRPeTc~5#q}33>+;TML@m+9c&DHfDo@dMJsjem^2SC z)-1QC8%SEB-@#uJfGI1jId-a_Q1fGHE(k$3=Qz#Vn?QAu8rt`i$&C2#49lh!!XLNh zoXJ=vF5KHvPucl`cJjQ_7k;&b@;`&qM|k+sBklIzdh`U zp#4m-^JTOw_!4b-!o?6nK&Hv$nxL#vY_;nY`HHly+Y z4msMqjxtY_Ajj9#<~{kOirVyL?ZA=nOK0(TSe*>3tPziS*z!8bHrM?N?c<#vreupx zlhe6+q_E@G_(V8e+GgVmvW`=b^PMXmNc^1FAu69v>>*vJDJd^gz8%?brL01y8${tV z6_e8EArhIRgjOMh2WyRdrSKC7=TWPR>`=XN>B{%6sQp&^24mZr=c~kFh4M@Y_HqBP z^h`F$UU^;Mx(n8EP66hYELp0y5SV|>R3JY(*21c#EZA9*TNR3wE8}&Q|CBHD2w%QG zBC?uFF#Y5%D%jscOC6O!UwcL`jbfkN50fWz2s4U&bv9|BKJ<=0OmS#+8KU%E2>S3v z#0ANJQ|1(N(jM%?c&BCmA_7~SN*Y>sM&yL*G@NVli5+L}0X7nXK2=jOTEmvh>nhdi z6yjZCus1Ms#1}1U1l{q~x-t4%XhJ4^`U8&tB?Qb?tya?Rf%^Fi#qfs&$cYydw84W3 z#tpjRq0r|=4i-lIRP7UX(c4k1V3irr1UFv^4(YL4mz? z_;bkJAF$Nr;H&OelLWAH43`Tnr?vicWSPE(hA*3CMJ)tlw0 zOa{~43q<0}$}YUQgPE(Fi@CA=e?=f5FBC|SpBGwMR9aq9739Z10RKNBy_mfV$cT^u zsBXJ;s|L=g6 zi;b82Ul=>bzj>Ujy#L~H{{MJfte_KlK5%X>5TybYkdyPDSv;(qT>rv2xY+)MadH0( z<=@J<+1UO^E%5)c%EQCW^Uq{nR-S)t$ji?AFN~Xm{a;47x&LjSo0s$d zDIM^?s?5#B`u~9cjj?h5Qw$3?2iHIEf`yBR?Vks;aB%Yevw|$#JnXFhFvr5h%Le>s zGAk$dzuj?iaQw?LCl}|x%Fn^W&i>CsxOrLrDVmk*KRx$9JhK1OY5(cSe{IOi#l-@$ SR+5D0VP%J>q?Gti^uGZAnIdZd diff --git a/paper/highlights.txt b/paper/highlights.txt new file mode 100644 index 0000000..fd3307f --- /dev/null +++ b/paper/highlights.txt @@ -0,0 +1,5 @@ +Well-tie error in training labels is an error in the time index of the label +Misregistered labels blur the learned predictor; Berkson-type tie error sharpens it +A calibrated posterior bank recovers the oracle optimum; its gain is fourth order +Tie-posterior label gains on the benchmark fail if anchor error is misset twofold +Blind-well tests need references accurate to ~1 ms; tested public datasets lack them diff --git a/paper/main.tex b/paper/main.tex index 7d1434a..3ae0fce 100644 --- a/paper/main.tex +++ b/paper/main.tex @@ -56,7 +56,8 @@ \theoremstyle{remark} \newtheorem{remark}{Remark} -\title{Registration-marginalized learning for sparse-well seismic porosity prediction} +\title{Label registration error in sparse-well seismic property learning: theory, a registration-aware benchmark, and the limits of field validation\\[4pt] +\normalsize\todo{If S2 of \texttt{protocol\_bench} is not locked and run before submission, replace ``a registration-aware benchmark'' with ``a controlled synthetic study'' in the title, abstract and text.}} \author{\todo{author list, affiliations, ORCID, corresponding author}} \date{Draft, \today} @@ -78,5 +79,6 @@ \appendix \input{sections/A_proofs} +\input{sections/B_field} \end{document} diff --git a/paper/refs.bib b/paper/refs.bib index a507cbc..7cc9daa 100644 --- a/paper/refs.bib +++ b/paper/refs.bib @@ -535,3 +535,95 @@ url = {https://doi.org/10.1190/tle39100734.1}, annote = {Abstract only (OpenAlex). Precision/recall/IoU with a tolerance distance between prediction and ground truth for thin faults and horizons} } + +@article{berkson1950two, + author = {Berkson, Joseph}, + title = {{Are there Two Regressions?}}, + journal = {Journal of the American Statistical Association}, + year = {1950}, + volume = {45}, + number = {250}, + pages = {164--180}, + doi = {10.1080/01621459.1950.10483349}, + url = {https://doi.org/10.1080/01621459.1950.10483349}, + annote = {Origin of the Berkson error model (error independent of the assigned value); metadata verified via Crossref 2026-10-29} +} + +@book{carroll2006measurement, + author = {Carroll, Raymond J. and Ruppert, David and Stefanski, Leonard A. and Crainiceanu, Ciprian M.}, + title = {{Measurement Error in Nonlinear Models: A Modern Perspective}}, + edition = {2nd}, + publisher = {Chapman and Hall/CRC}, + year = {2006}, + doi = {10.1201/9781420010138}, + url = {https://doi.org/10.1201/9781420010138}, + annote = {Classical versus Berkson measurement error; metadata verified via Crossref 2026-10-29} +} + +@book{fuller1987measurement, + author = {Fuller, Wayne A.}, + title = {{Measurement Error Models}}, + publisher = {Wiley}, + year = {1987}, + doi = {10.1002/9780470316665}, + url = {https://doi.org/10.1002/9780470316665}, + annote = {Errors-in-variables models; metadata verified via Crossref 2026-10-29} +} + +@article{frenay2014label, + author = {Fr{\'e}nay, Beno{\^i}t and Verleysen, Michel}, + title = {{Classification in the Presence of Label Noise: A Survey}}, + journal = {IEEE Transactions on Neural Networks and Learning Systems}, + year = {2014}, + volume = {25}, + number = {5}, + pages = {845--869}, + doi = {10.1109/TNNLS.2013.2292894}, + url = {https://doi.org/10.1109/TNNLS.2013.2292894}, + annote = {Label-noise survey (classification); metadata verified via Crossref 2026-10-29} +} + +@article{song2023noisy, + author = {Song, Hwanjun and Kim, Minseok and Park, Dongmin and Shin, Yooju and Lee, Jae-Gil}, + title = {{Learning From Noisy Labels With Deep Neural Networks: A Survey}}, + journal = {IEEE Transactions on Neural Networks and Learning Systems}, + year = {2023}, + volume = {34}, + number = {11}, + pages = {8135--8153}, + doi = {10.1109/TNNLS.2022.3152527}, + url = {https://doi.org/10.1109/TNNLS.2022.3152527}, + annote = {Deep learning with noisy labels survey; metadata verified via Crossref 2026-10-29} +} + +@misc{bader2017teapot, + author = {Bader, Sean}, + title = {{Teapot Dome Well Tie}}, + howpublished = {Texas Data Repository, dataset}, + year = {2017}, + doi = {10.18738/T8/21WDU8}, + url = {https://doi.org/10.18738/T8/21WDU8} +} + +@inproceedings{mnih2012aerial, + author = {Mnih, Volodymyr and Hinton, Geoffrey E.}, + title = {{Learning to Label Aerial Images from Noisy Data}}, + booktitle = {Proceedings of the 29th International Conference on Machine Learning (ICML 2012)}, + address = {Edinburgh, Scotland, UK}, + year = {2012}, + url = {https://mlanthology.org/icml/2012/mnih2012icml-learning/}, + annote = {Full text read 2026-10-29 (Ghostscript text of http://icml.cc/2012/papers/318.pdf). Sec. 5: registration noise modelled as a translated crop of the true map, t in {0, 8 translations by t_max}, p(t=0)=theta_t; likelihood marginalized over t (Eq. 8) and fitted by EM; p(t) set on a validation set. Sec. 6.1: precision/recall with a 3-pixel buffer because the ground truth is misregistered. Sec. 6.3: lower precision of ABN/ABN-P at low recall on URBAN2, "likely because the test set is poorly registered". No page numbers found.} +} + +@article{balakrishnan1962jitter, + author = {Balakrishnan, A. V.}, + title = {{On the Problem of Time Jitter in Sampling}}, + journal = {IRE Transactions on Information Theory}, + year = {1962}, + volume = {8}, + number = {3}, + pages = {226--236}, + doi = {10.1109/TIT.1962.1057717}, + url = {https://doi.org/10.1109/TIT.1962.1057717}, + annote = {Metadata verified via Crossref 2026-10-29 (Crossref lists the successor name IEEE Transactions on Information Theory). Abstract and full text not obtained. Cited only for the general statement that the spectral effect of random timing errors has been studied for sampling jitter; Schwarzmann and Kaeser (arXiv:2509.04199, Sec. II) cite it for "spectral distortion under random timing perturbations".} +} diff --git a/paper/sections/00_abstract.tex b/paper/sections/00_abstract.tex index b3d90a3..ce84d45 100644 --- a/paper/sections/00_abstract.tex +++ b/paper/sections/00_abstract.tex @@ -1,11 +1,5 @@ \begin{abstract} -Supervised prediction of reservoir properties from post-stack seismic data needs well logs in two-way time. Such labels exist only after a well tie, and the tie is uncertain. In the F3 block (Netherlands North Sea), sonic-integrated times at the four public wells differ from the time--depth markers by up to 14--66\,ms, and the difference changes by 10--46\,ms within a 500\,ms target window. These errors exceed the 17--20\,ms dominant period of the data. Standard workflows nevertheless collapse the tie to a single time--depth curve before training. - -We analyse what this does to a learned predictor. Under an independence assumption, the MSE-optimal predictor trained on misregistered labels is the correctly registered predictor convolved with the distribution of the timing error (Proposition~1). The seismic-band content is therefore attenuated by the characteristic function of that error. A controlled experiment with known Gaussian shifts matches this transfer function to within 1\% for $\sigma \le 16$\,ms. Without time anchors, the absolute timing of a shared network and its label alignment is not identified (Proposition~2). This explains why alignment losses such as soft-DTW and DILATE cannot recover the timing on their own. We then propose registration-marginalized learning (RML): labels are drawn from an anchor- and seismic-conditioned posterior over time--depth warps, and the network is trained with a tempered log-sum-exp loss over this bank. Point-tie training, shift-tolerant losses and soft-DTW are special cases of this loss. - -We test the approach on a synthetic benchmark built from F3 geometry, rock physics and time--depth statistics, under pre-registered pass rules. The first pre-registered comparison failed: an anchor-only posterior with 64 samples did not contract to the true warp, and its labels did not beat the best point tie. We report this failure as it stands. A second pre-registration replaced the registration step with a sequential Monte Carlo tie posterior. Labels at the posterior-mean warp then reduced seismic-band RMSE by 8--22\% relative to the best point tie at F3-like drift, in all three signal-to-noise regimes tested. RML on the particle bank improved further when the posterior was wide: 8 of 8 wide cells passed, and the gain grew with posterior width (Spearman $\rho=-0.85$). These gains require a correctly specified anchor-pick uncertainty: with the anchor uncertainty set at half or twice its true value, no cell passed. Predictive uncertainty from seed ensembles under-covered for every method. We therefore make no calibration claim. -On the four F3 wells, a third pre-registered test with nested leave-one-well-out validation failed. RML on the particle bank had lower seismic-band RMSE than the best point tie at one well of four, where three were required, and its 80\% and 90\% predictive intervals covered 52\% and 61\% of the samples. Varying the anchor uncertainty, the scoring reference or the label did not make the test pass. On these wells the differences between methods were smaller than the variation between training seeds. -\todo{Volve results (gate G-D) and the final one-sentence conclusion.} +Seismic reservoir-property predictors are trained on well logs that a well tie places in two-way time, and the tie is uncertain. We analyse its error as an error in the time index of the label. Under an independence assumption, misregistered labels convolve the optimal predictor with the error distribution and blur the seismic band, as a controlled experiment confirmed to within 1\%. Without time anchors, absolute timing is not identified. A tie computed as a posterior mean has the opposite, Berkson, error structure and sharpens the predictor instead. A calibrated bank of posterior labels attains the oracle's population optimum, but its population gain over a point label is of fourth order in the tie error. On a registration-aware synthetic benchmark calibrated to F3, we compared point ties, posterior-mean labels and a tempered likelihood over a posterior bank under pre-registered rules. The first comparison failed, and the second was designed after that failure. There, posterior-mean labels had 8--22\% lower seismic-band RMSE than the best point tie, but failed when the anchor uncertainty was set at half or twice its true value. The bank gained further in all eight cells with a wide posterior. This gain exceeded the registered population bound for classical tie error in seven cells, but a post hoc bound for Berkson error in only three. Detecting such gains at blind wells requires an accurate reference: with exact ties, 5--18 wells gave a power of 0.8 in most cells; with reference errors of 3\,ms or more, 40 wells did not. The F3 and Volve field tests (four and six wells) failed, and neither could have detected such gains. Teapot Dome has independent time--depth references at no more than two of its 152 wells. We make no field or calibration claim. \end{abstract} -\noindent\textbf{Keywords:} well tie; time--depth uncertainty; porosity prediction; deep learning; label noise; uncertainty quantification; F3 Netherlands +\noindent\textbf{Keywords:} well tie; registration error; errors-in-variables; seismic porosity prediction; synthetic benchmark; blind-well validation; statistical power diff --git a/paper/sections/01_introduction.tex b/paper/sections/01_introduction.tex index 5deb252..e1b7854 100644 --- a/paper/sections/01_introduction.tex +++ b/paper/sections/01_introduction.tex @@ -5,15 +5,14 @@ Deep networks are widely used to map seismic amplitudes to reservoir properties The tie is not exact. It is an inverse problem with a posterior distribution, and Bayesian treatments of it have existed for two decades and are still being developed \citep{buland2003bayesianwavelet,gunning2006waveletextractor,lim2025awsm}. In those treatments the posterior is the end product: no learning step uses it. The size of the problem is easy to underestimate. At the four public wells of the F3 block, sonic-integrated TWT differs from the interpreted time--depth markers by up to 14--66\,ms, and the difference changes by up to 46\,ms inside a 500\,ms target window (Section~\ref{sec:data}). Two time--depth models distributed with the data disagree with the markers by up to 36\,ms. The dominant period of the seismic is 17--20\,ms. Label timing errors of one to several periods are therefore realistic, and they vary with depth, so a bulk lag cannot absorb them. -This paper asks what such errors do to a learned predictor and how to train with the tie posterior rather than a point estimate. We make four contributions. +This is a label error of a particular kind. The label values are measured, but they are placed at the wrong times. Work on noisy labels and on errors in variables mostly concerns errors in the values (Section~\ref{sec:related}). A registration error acts on the time index instead: it is correlated along the well, its effect depends on frequency, and it affects the reference against which blind wells are scored as well as the training labels. We ask what such an error does to a learned predictor, whether training on a tie posterior rather than a point tie removes its effect, and whether a field test can detect the difference. We make four contributions. \begin{enumerate} - \item[C1] \textbf{Theory.} Under an independence assumption, the MSE-optimal predictor trained on misregistered labels equals the correctly registered predictor convolved with the distribution of the timing error (Proposition~\ref{prop:blur}). The seismic-band amplitude is multiplied by the characteristic function of the error, and a variance-matching loss rescales amplitude without restoring the lost coherence. Without time anchors, a shared network and its label alignment can drift together without changing the loss (Proposition~\ref{prop:ident}). Losses that learn the alignment from the network's own predictions, such as soft-DTW \citep{cuturi2017softdtw} and DILATE \citep{leguen2019dilate}, therefore cannot fix absolute timing. We verify Proposition~\ref{prop:blur} quantitatively in a controlled experiment. - \item[C2] \textbf{Method.} Registration-marginalized learning (RML) draws a bank of labels from an anchor- and seismic-conditioned posterior over monotone time--depth warps. It trains the network with a tempered log-sum-exp likelihood over the bank. Point-tie training, hard-min and soft-min shift losses and soft-DTW are special cases (Lemmas~\ref{lem:s1}--\ref{lem:sdtw}). - \item[C3] \textbf{Registration-aware evaluation.} We build a synthetic benchmark from F3 geometry, rock physics and time--depth statistics. On it we vary drift, seismic signal-to-noise ratio and anchor density, and we evaluate under pre-registered pass rules. We report both pre-registered comparisons: the first failed and the second passed, with the dependence on correctly specified anchor uncertainty made explicit. - \item[C4] \textbf{F3 audit.} We document properties of the public F3 well data that matter for any learning study on it. The porosity labels at three of the four wells are an exact linear function of the sonic log. The density logs at two wells are predicted rather than measured. The time--depth markers are horizon-tie picks, not independent check shots. + \item[C1] \textbf{Theory.} Under an independence assumption, the MSE-optimal predictor trained on misregistered labels is the correctly registered predictor convolved with the distribution of the timing error, so the seismic band is attenuated by the characteristic function of the error (Proposition~\ref{prop:blur}). A controlled experiment matches this transfer to within 1\%. Without time anchors, a shared network and its label alignment can drift together without changing the loss (Proposition~\ref{prop:ident}), so losses that learn the alignment from the network's own predictions, such as soft-DTW \citep{cuturi2017softdtw} and DILATE \citep{leguen2019dilate}, cannot fix absolute timing. The error of an estimated tie can have the classical structure, which blurs the learned predictor, or the Berkson structure, which sharpens it (Proposition~\ref{prop:tie}). A calibrated bank of posterior labels has the population minimizer of training on the true labels, but its population gain over a point label is of fourth order in the tie error (Proposition~\ref{prop:bank}). We also relate the coverage of predictive intervals to the error structure (Proposition~\ref{prop:coverage}) and give the bias of scoring against a misregistered reference (Proposition~\ref{prop:reference}). + \item[C2] \textbf{A registration-aware benchmark.} We build synthetic data with known true warps from F3 geometry, rock physics and time--depth statistics. We vary drift, seismic signal-to-noise ratio and anchor density, and evaluate under locked, pre-registered pass rules. We report both comparisons that we registered: the first failed, and the second, designed after that failure, passed, with an explicit dependence on correctly specified anchor uncertainty. \todo{S1, S2, S3, S4 and S8 of \texttt{protocol\_bench}: grid fill, misspecification axes, B4 under the SMC posterior, second backbone, controlled cycle skipping.} + \item[C3] \textbf{A family of baselines.} Registration-marginalized learning (RML$_\lambda$), a tempered log-likelihood over a bank of labels, contains point-tie training, hard-min and soft-min shift losses and soft-DTW as special cases (Lemmas~\ref{lem:s1}--\ref{lem:sdtw}). We use this family to define the methods compared on the benchmark, not as a proposed method that wins. + \item[C4] \textbf{Detectability and the scope of field tests.} We derive how accurately the reference at blind wells must be tied, and how many blind wells are needed, for a comparison of tie methods to detect the effects of C1 (Corollary~\ref{cor:tolerance}, Section~\ref{sec:exp:detect}). We audit the public F3 well data: the porosity labels at three of the four wells are a linear function of the sonic log, and the time--depth markers are horizon-tie picks, not check shots. Pre-registered field tests on F3 and Volve failed, and an inventory of Teapot Dome found an independent time--depth reference at no more than two of its wells. These cases bound the scope of the paper. \end{enumerate} -We also tested RML on the four F3 wells under a third pre-registered protocol with nested leave-one-well-out validation. This test failed. RML on the SMC bank had lower seismic-band RMSE than the selected point tie at one well of four, where three were required, and its predictive intervals were much too narrow. Varying the anchor uncertainty, the scoring reference or the label did not make the test pass. The synthetic gains are therefore not confirmed on F3. On these wells the networks predicted little of the seismic band, and the differences between methods were smaller than the variation between seeds, so the test could not separate them. -\todo{One or two sentences on the second field dataset (Volve, gate G-D), whichever direction it takes.} +On the benchmark, labels at the posterior-mean warp of a sequential Monte Carlo tie beat the best point tie by 8--22\% in seismic-band RMSE at F3-like drift in all three full-anchor regimes. With the anchor uncertainty set at half or twice its true value, this advantage no longer passed the registered rule. A bank of posterior samples gained further when the posterior was wide. In seven of eight cells this gain exceeded the population bound that we registered, which assumes classical tie error, but in only three did it exceed the bound for the Berkson error of a posterior-mean tie, which we computed post hoc. With an exact reference, a sign test at blind wells needed 5--18 wells to detect these gains in most cells, and with reference errors of 3\,ms or more, 40 wells did not suffice. Neither public field dataset that we tested meets these conditions. -Section~\ref{sec:related} positions the work. Section~\ref{sec:data} describes the data and the audit. Section~\ref{sec:theory} gives the theory, and Section~\ref{sec:method} the method. Section~\ref{sec:experiments} reports the synthetic and field experiments. Section~\ref{sec:discussion} discusses scope and limitations. Proofs are in Appendix~\ref{app:proofs}. +Section~\ref{sec:related} positions the work. Section~\ref{sec:data} describes the data and the audit, Section~\ref{sec:theory} the theory, and Section~\ref{sec:method} the tie posterior and the methods. Section~\ref{sec:experiments} reports the benchmark, the detectability analysis and the field cases. Section~\ref{sec:discussion} discusses what the results imply for field studies, and the limitations. Proofs are in Appendix~\ref{app:proofs}, and the field tests in Appendix~\ref{app:field}. diff --git a/paper/sections/02_related.tex b/paper/sections/02_related.tex index 7161e79..599dd2b 100644 --- a/paper/sections/02_related.tex +++ b/paper/sections/02_related.tex @@ -1,7 +1,7 @@ \section{Related work} \label{sec:related} -Three bodies of work meet in this problem. They have so far been developed separately. A fourth studies label uncertainty of a different kind. +Three bodies of work meet in this problem, and they have so far been developed separately. Two others study uncertain labels: in statistics and machine learning in general, and in learned seismic interpretation. \paragraph{Well ties and their uncertainty.} \citet{buland2003bayesianwavelet} model the mistie between seismic time and log time as latent marker shifts with a triangular prior. They estimate these shifts jointly with the wavelet by MCMC and report their posterior. \citet{gunning2006waveletextractor} estimate the wavelet jointly with check-shot and marker times (Gaussian priors, monotonicity enforced), a registration shift and a lateral positioning error per well. They obtain uncertainty from a Laplace approximation and choose the wavelet length by marginal likelihood. \citet{lim2025awsm} infer time--depth transform parameters and wavelets jointly with parallel-tempering MCMC and report uncertainty estimates for a Midland Basin case study. Neither prior over time shifts nor a posterior over the time--depth relation is therefore new. In these works, however, the posterior is the end product. \citet{lim2025awsm} pass the estimated wavelets on to AVO/AVA inversion; their abstract does not describe passing the time--depth uncertainty on to a later step. \citet{wu2017multiwelltie} tie several wells at once with smooth depth-variable shifts and give no tie uncertainty. \citet{herrera2012automatedtie} use dynamic time warping for the tie. Among learning-based methods, \citet{tschannen2022partialtie} estimate the wavelet with a variational network: their uncertainty is mainly in wavelet phase, and the bulk shift is found by Bayesian optimization within user-set bounds. \citet{di2023welltie} and \citet{li2025cascadedtie} automate the tie with self-supervised learning and cascaded matching. All these methods output a tie, sometimes with wavelet or shift uncertainty, and stop there. @@ -12,15 +12,18 @@ Recent studies predict porosity or impedance with convolutional, recurrent or tr \paragraph{Losses that tolerate temporal misalignment.} Soft-DTW \citep{cuturi2017softdtw} and DILATE \citep{leguen2019dilate} replace the pointwise loss with a smoothed minimum over monotone alignments. Shift-tolerant losses that take the minimum over a set of bulk lags are a simpler variant. These losses use no time anchors, no physical tie model and no prior over warps. Proposition~\ref{prop:ident} shows that, without anchors, the absolute timing they learn is not identified. Learned alignment has also been applied to seismic inputs. \citet{huff2024anglestack} train a CNN on synthetic angle stacks moveout-corrected with true and perturbed velocities and use it to align field angle stacks. There the misaligned quantities are the inputs, and the synthetic targets are aligned by construction. +\paragraph{Label noise and errors in variables.} +Measurement-error models distinguish classical error, which is independent of the true value, from Berkson error, which is independent of the assigned value \citep{berkson1950two,fuller1987measurement,carroll2006measurement}. In linear regression, classical error in a covariate attenuates the fitted slope, while Berkson error leaves it unbiased and adds variance. Work on noisy labels in machine learning mostly treats corrupted class labels, with robust losses, sample selection or models of the corruption process \citep{frenay2014label,song2023noisy}. Closest to our setting, \citet{mnih2012aerial} train a network to label roads in aerial images from maps whose objects are misplaced. They model the observed map as a translated crop of the true map, marginalize the likelihood over a small set of translations whose prior is set on validation data, and fit it by expectation--maximization. Without its omission term, this is a bank of shifted labels with $\lambda = 1$ and no anchors (Section~\ref{sec:method:rml}). They also score predictions with a tolerance of three pixels, because the ground truth is itself misregistered, and suggest that their noise-robust models lost precision at low recall on one test set because that set was poorly registered. Proposition~\ref{prop:reference} states the analogous effect for band MSE. The spectral effect of random timing errors has long been studied for sampling jitter \citep{balakrishnan1962jitter}. A misregistered well label differs from these cases in where the error enters. Its values are correct, but they are placed at the wrong times. The error acts on the time index, it is correlated along the well, and its effect depends on frequency: it leaves the low frequencies nearly unchanged and blurs the seismic band (Proposition~\ref{prop:blur}). The classical and Berkson structures carry over to the time index, where they bias the learned predictor in opposite directions (Proposition~\ref{prop:tie}). + \paragraph{Label uncertainty in learned seismic interpretation.} \citet{quesada2024faultlabels} collected fault labels on 400 F3 images from 38 annotators with different expertise and confidence. \citet{mirza2025labelquality} assess the variability of manual salt interpretations together with seismic image quality. \citet{guillon2020gtmetrics} add a tolerance distance to fault and horizon metrics, because thin boundaries cannot be placed exactly. In these works the label is an interpretation of the seismic image itself, the task is classification or segmentation, and the uncertainty is described by annotator disagreement or a spatial tolerance. In our problem the label values come from well logs, and their position on the seismic time axis is what is uncertain. A physical tie model conditioned on anchors gives a posterior for that position. \paragraph{Position of this work.} -Table~\ref{tab:positioning} summarizes the comparison. To our knowledge, in the reviewed literature no work feeds a tie posterior into the training of a seismic property predictor and evaluates the result under known registration error. The tie posterior itself builds directly on \citet{buland2003bayesianwavelet} and \citet{gunning2006waveletextractor}. +Table~\ref{tab:positioning} summarizes the comparison. The ingredients are not new: tie posteriors \citep{buland2003bayesianwavelet,gunning2006waveletextractor}, the spectral effect of random timing errors \citep{balakrishnan1962jitter}, the classical and Berkson error structures \citep{carroll2006measurement}, and a likelihood marginalized over label translations \citep{mnih2012aerial}. To our knowledge, in the reviewed literature no work combines them for seismic property prediction. None analyses how tie error in the training labels changes the learned predictor, feeds a tie posterior into training and evaluates the result under known registration error, or derives how accurate the reference at blind wells must be for a comparison of tie methods to detect a difference. The tie posterior itself builds directly on \citet{buland2003bayesianwavelet} and \citet{gunning2006waveletextractor}. \begin{table}[t] \centering -\caption{Positioning. DL: learned property prediction; Tie: automated tie; Tie UQ: posterior or uncertainty of the tie; UQ$\to$train: tie uncertainty used in training; Reg.\ eval.: evaluation that accounts for registration error; seg.: segmentation of seismic images; tol.: spatial tolerance between prediction and label in the metric. \textsuperscript{a}Assessed from the abstract only.} +\caption{Positioning. DL: learned property prediction; Tie: automated tie; Tie UQ: posterior or uncertainty of the tie; UQ$\to$train: tie uncertainty used in training; Reg.\ eval.: evaluation that accounts for registration error; seg.: segmentation of seismic or aerial images; transl.: likelihood marginalized over a few label translations; tol.: spatial tolerance between prediction and label in the metric. \textsuperscript{a}Assessed from the abstract only.} \label{tab:positioning} \small \begin{tabular}{>{\raggedright\arraybackslash}p{0.42\textwidth}ccccc} @@ -38,6 +41,7 @@ Work & DL & Tie & Tie UQ & UQ$\to$train & Reg.\ eval. \\ \citet{buland2003bayesianwavelet,gunning2006waveletextractor} & -- & \checkmark & \checkmark & -- & -- \\ \citet{lim2025awsm}\textsuperscript{a} & -- & \checkmark & \checkmark & -- & -- \\ Soft-DTW, DILATE & generic & soft & -- & -- & -- \\ +\citet{mnih2012aerial} & seg. & -- & -- & transl. & tol. \\ \citet{quesada2024faultlabels}\textsuperscript{a}, \citet{mirza2025labelquality}\textsuperscript{a} & seg. & -- & -- & -- & -- \\ \citet{guillon2020gtmetrics}\textsuperscript{a} & seg. & -- & -- & -- & tol. \\ This work & \checkmark & \checkmark & \checkmark & \checkmark & \checkmark \\ diff --git a/paper/sections/03_data.tex b/paper/sections/03_data.tex index 20cb2df..9b5bd72 100644 --- a/paper/sections/03_data.tex +++ b/paper/sections/03_data.tex @@ -57,7 +57,16 @@ The true time--depth warp of each well is drawn from the warp prior of Section~\ \end{itemize} Under the F3 warp prior, Rm5 gives the posterior width closest to F3 (Section~\ref{sec:exp:p2r}). -\subsection{Second field dataset} +\subsection{Volve field} \label{sec:data:volve} -\todoblock{Volve (Equinor; licence CC BY-NC-SA 4.0): wells, logs, target window, time--depth data, and the porosity definition (independent of sonic where possible). Gate G-D; pipeline 28/10, runs 29/10. If Volve is cut (plan \S6 cut order), remove this subsection and the corresponding claims.} +The second field dataset is Volve (Norwegian North Sea), released by Equinor under a CC BY-NC-SA 4.0 licence \todo{dataset citation (Equinor Volve data village)}. Its role is to break the label structure of F3. The computed effective porosity PHIF of the operator's petrophysical interpretation is driven by density, not by sonic: within each well its correlation with RHOB is $-0.92$ to $-0.99$, RHOB and NPHI explain 84--98\% of its variance, and adding DT raises this by at most 0.9 percentage points. Six wells have DT, RHOB, NPHI and PHIF: F-1, F-1 A, F-1 B, F-11 A, F-11 T2 and F-12. All six are deviated (maximum inclination 30--82$^\circ$; 4--54$^\circ$ over the labelled interval), and they share one platform. F-1 A and F-1 B leave the F-1 borehole at 2587\,m MD, and F-11 A leaves F-11 T2 at about 2580\,m MD, so the wells form three slot groups, \{F-1, F-1 A, F-1 B\}, \{F-11 A, F-11 T2\} and \{F-12\}, whose members share the hole above the kick-off. + +\paragraph{Seismic and geometry.} +We use the post-stack ST10010 full-angle stack (3--41$^\circ$), a 2011 depth migration converted to time, at 4\,ms sampling. Its trace headers carry an invalid time scalar that standard readers apply to the start time, which shifts every sample 8\,ms late. We use the start time of the text header (4\,ms) and checked it against five interpreted horizons: the amplitude extremum along each falls at a lag of 0 to $+2$\,ms. Trajectories come from the operator's definitive surveys; recomputing them by minimum curvature reproduces the listed TVD within 0.01\,m. The seismic input of a well is a $3\times3$ patch of traces interpolated bilinearly along the deviated path at the time given by its time--depth relation, because a vertical trace at one bin differs from the path composite by a relative RMS of 0.19--0.61 over the labelled interval. Learning uses the window 2400--2900\,ms (126 samples) and tie likelihoods the extended window 2000--3200\,ms. + +\paragraph{Time--depth and anchors.} +Only F-11 T2 has a zero-offset VSP. As anchors we use the operator's well picks with a TWT from the Ty Formation downwards, excluding picks flagged as not logged, not reached or faulted; each well has 4--9 such anchors within its logged sonic interval. Shallower picks are unreliable (picks at the same depth in a shared borehole differ by about 110\,ms). At reservoir level every unflagged pick lies within $\pm 10$\,ms of the corresponding interpreted horizon, and at F-11 T2 the picks lie within $-6.1$ to $+2.3$\,ms of the VSP. The pick times come from the operator's time--depth models, so they are interpretations, not measurements, as on F3. Time is vertical time: DT is integrated over TVD and calibrated to the anchors by stretching between them. At F-11 T2 this marker-calibrated sonic lies within $-2.4$ to $-0.8$\,ms of the VSP over the labelled interval. We keep $\sigma_a = 7$\,ms from F3; it is not estimated on Volve. + +\paragraph{Labels.} +PHIF is used only where DT is valid, which leaves 16--37 labelled 4\,ms samples per well (150 in total) at 2509--2819\,ms. The labelled runs lie 25--179\,m below the deepest anchor, so their timing depends on the drift of the sonic below it. They are shorter than one period at 6\,Hz, so the band split used on F3 is undefined here. The well means of PHIF range from 8.5\,p.u.\ at F-1 to 17.0\,p.u.\ at F-12, against standard deviations of 3.3--6.0\,p.u.\ within wells. diff --git a/paper/sections/04_theory.tex b/paper/sections/04_theory.tex index 16e519f..6b33b24 100644 --- a/paper/sections/04_theory.tex +++ b/paper/sections/04_theory.tex @@ -1,4 +1,4 @@ -\section{Theory: blur and identifiability} +\section{Theory} \label{sec:theory} \paragraph{Notation.} @@ -19,7 +19,7 @@ P(f) = \E\big[e^{i2\pi f\delta}\big], \qquad \delta \sim \N(\mu_\delta, \sigma^2 \end{equation} \end{proposition} -Only the marginal distribution of $\delta(t)$ at each $t$ enters $\hat y^\star$. Whether the error is a smooth drift or independent jitter does not change the population optimum, although it changes finite-sample learning. A non-zero mean $\mu_\delta$ adds a linear phase, that is, a common shift. This common shift is the direction that Proposition~\ref{prop:ident} shows to be unidentified. Assumption (A1) is a modelling assumption. On F3 the same sonic log produces both the label and the time axis, so $\delta$ and $y$ are not strictly independent. +Only the marginal distribution of $\delta(t)$ at each $t$ enters $\hat y^\star$. Whether the error is a smooth drift or independent jitter does not change the population optimum, although it changes finite-sample learning. A non-zero mean $\mu_\delta$ adds a linear phase, that is, a common shift. This common shift is the direction that Proposition~\ref{prop:ident} shows to be unidentified. Assumption (A1) says that the error is independent of the truth: the observed label at $t$ is the true label at $t + \delta(t)$, with $\delta$ independent of everything else. This is the classical structure of errors-in-variables models \citep{fuller1987measurement,carroll2006measurement}, applied to the time index rather than to the value of the label. It is a modelling assumption. On F3 the same sonic log produces both the label and the time axis, so $\delta$ and $y$ are not strictly independent. Section~\ref{sec:theory:post} shows that a tie estimated from the well data can have the opposite structure, with the opposite effect. \begin{corollary}[Seismic-band bounds] \label{cor:band} @@ -73,10 +73,6 @@ $\sigma$ (ms) & $r(\sigma)$ & 95\% CI & frequencies & band RMSE & band PCC & ban \label{fig:h1} \end{figure} -\paragraph{Implication for posterior labels.} -\label{sec:theory:post} -A tie posterior can be used in two ways: labels at the posterior-mean warp $\bar\tau(t)$, or a bank of labels drawn from posterior samples. Let $\delta = \bar\tau - \tau$ be the error of the mean warp. If the posterior is calibrated, $\Var\delta(t) \approx \sigpost(t)^2$. Treating (A1) as an approximation, Proposition~\ref{prop:blur} says that training on mean-warp labels blurs the optimum by $P(f) \approx e^{-2\pi^2\sigpost^2 f^2}$. No method can beat labels at the true warp, so the largest possible gain of a bank over the mean warp is the loss caused by this blur. We measure that loss directly as $B(\sigma) = \text{band RMSE}(\text{blur}_\sigma(\mu))/\text{band RMSE}(\mu)$, where $\mu$ is the prediction of the oracle-label model on a development realization. On the H1 predictions this quantity reproduces the measured penalty (1.33 against 1.38 at 4\,ms; 1.85 against 1.91 at 8\,ms). If a bank removed the blur completely, the bank-to-mean ratio would be about $1/B(\sigpost)$. This is a directional expectation, not a strict bound. The mean-warp error is not independent of $y$, because $\bar\tau$ is estimated from the same seismic that the network reads. A multimodal posterior (cycle skips) gives heavier-tailed errors than a Gaussian with the same width. A gain larger than $1/B$ therefore cannot be attributed to deblurring (Section~\ref{sec:exp:p2r}). - \subsection{Without anchors, absolute timing is not identified} Consider $N$ training wells with seismic $X_w$, depth logs $\phi_w$ and warps $u_w = (b_w, g_w)$ (Section~\ref{sec:method:prior}). Let $y^{u}(t) = (\aaf\phi)(z_u(t))$ be the label under warp $u$, where $z_u$ inverts $t_u$ and $\aaf$ is an anti-alias filter. Let $e_b$ be the direction that adds the same $\beta$ to every $b_w$. The joint MAP objective over network parameters $\theta$ and warps $\mathbf{u}$ is @@ -105,3 +101,133 @@ Seismic is observed on a fixed time axis, so a tie likelihood that compares the \paragraph{Consequences.} Shift-tolerant losses and soft-DTW choose the alignment that best fits the network's current prediction and use no anchors. Within the range of their shift bank or band they fall under case (a): network and alignment can drift together without penalty. A tie posterior conditioned on anchors does not have this ridge. Its absolute timing is set before training, with per-well common-shift uncertainty of about $\sigma_a/\sqrt{K_w}$. + +\subsection{Labels from a tie: blur or sharpening} +\label{sec:theory:post} + +Proposition~\ref{prop:blur} treats the registration error as independent of everything else. A tie estimated from the data at a training well need not have this property. Let $D$ denote all data at the well (seismic, logs and anchors), and let the network input $X$ be a function of $D$. Let $u^\star$ be the true warp, so that $y = y^{u^\star}$, and let $\hat u = \hat u(D)$ be a point tie with label $\tilde y = y^{\hat u}$. The misregistration can be written in either direction, +\begin{equation} +\tilde y(t) = y\big(t + \delta(t)\big),\ \ \delta(t) = t_{u^\star}\big(z_{\hat u}(t)\big) - t; +\qquad +y(t) = \tilde y\big(t + \varepsilon(t)\big),\ \ \varepsilon(t) = t_{\hat u}\big(z_{u^\star}(t)\big) - t . +\label{eq:twoerrors} +\end{equation} +Let $\tilde m(t) = \E[\tilde y(t)\mid X]$ be the optimal predictor of the point label ($\hat y^\star$ in Proposition~\ref{prop:blur}), and let $Q(f) = \E[e^{i2\pi f\varepsilon}]$. + +\begin{proposition}[Two error structures] +\label{prop:tie} +Assume (A2) for $y$ and $\tilde y$. +\begin{enumerate} + \item[(a)] \emph{Classical error.} If $\delta(t)$ is independent of $y(\cdot)$ given $X$, with conditional distribution $p_t(\cdot\mid X)$, then + \begin{gather*} + \tilde m(t) = \int p_t(d\mid X)\, m(t+d)\dd d, \\ + \Var\big(\tilde y(t)\mid X\big) = \int p_t(d\mid X)\Var\big(y(t+d)\mid X\big)\dd d + \Var_{p_t}\!\big[m(t+d)\big]. + \end{gather*} + \item[(b)] \emph{Berkson error.} If $\varepsilon(t)$ is independent of $D$ given $X$, with conditional distribution $q_t(\cdot\mid X)$, then + \begin{gather*} + m(t) = \int q_t(e\mid X)\, \tilde m(t+e)\dd e, \\ + \Var\big(y(t)\mid X\big) = \int q_t(e\mid X)\Var\big(\tilde y(t+e)\mid X\big)\dd e + \Var_{q_t}\!\big[\tilde m(t+e)\big]. + \end{gather*} +\end{enumerate} +If $p_t$ and $q_t$ do not depend on $t$, then, averaged over the window and up to edge terms, the point label has the larger conditional variance under (a) and the smaller under (b). If they depend on neither $t$ nor $X$, then $\tilde m$ is $m$ filtered by $P$ under (a), and $m$ is $\tilde m$ filtered by $Q$ under (b). For zero-mean Gaussian errors with variance $\sigma^2$, the transfer from $m$ to $\tilde m$ is $e^{-2\pi^2\sigma^2 f^2}$ under (a) and $e^{+2\pi^2\sigma^2 f^2}$ under (b). +\end{proposition} + +Structure (a) is the classical structure of measurement-error models, in which the error is independent of the true value. Structure (b) is the Berkson structure, in which the error is independent of the assigned value \citep{berkson1950two,carroll2006measurement}. Here the error lies in the time index of the label, and the two structures bias the learned predictor in opposite directions. Under (a) the point label blurs the optimal predictor and widens the learned variance. Under (b) it sharpens the predictor and narrows the variance. Structure (b) is the natural idealization for a tie computed as a posterior mean, $\hat u = \E[u^\star\mid D]$. Then $\E[u^\star - \hat u\mid D] = 0$ by construction, and in a linear-Gaussian model $u^\star - \hat u$ is independent of $D$. For the bulk offset $b$ in \eqref{eq:warp}, the time error equals the posterior error of $b$ and inherits this property; for the drift it does so approximately, when the posterior is narrow. A tie fitted in another way, for example by maximizing a synthetic--seismic correlation, can have either structure or neither. On synthetic data the two can be told apart: for the bulk offset, classical error means $\Cov(\hat b - b^\star, b^\star) = 0$, and Berkson error means $\Cov(b^\star - \hat b, \hat b) = 0$. + +A bank of labels removes the dependence on a single tie when it represents the posterior correctly. + +\begin{proposition}[Calibrated bank] +\label{prop:bank} +Call a bank $\{(u_s, \pi_s)\}$ calibrated if, for every integrable $G$, $\sum_s \pi_s G(u_s, D) = \E[G(u^\star, D)\mid D]$. For a calibrated bank: +\begin{enumerate} + \item[(a)] the mean label $\bar y = \sum_s \pi_s y^{u_s}$ satisfies $\bar y(t) = \E[y(t)\mid D]$ and $\E[\bar y(t)\mid X] = m(t)$; + \item[(b)] for every network $(\mu_\theta, \sigma_\theta)$ that depends on the data only through $X$, $\E\big[\sum_s \pi_s \ell_s\big] = \E[\ell^\star]$, where $\ell^\star$ is the window log-likelihood \eqref{eq:rml} of the label at the true warp. +\end{enumerate} +Hence the $\lambda \to 0$ limit of RML (Lemma~\ref{lem:sandwich}) has the population minimizer of training on the true labels, $\mu = m$ and $\sigma^2 = \Var(y\mid X)$, and MSE on the mean label has the population minimizer $\mu = m$. +\end{proposition} + +Calibration is an idealization; it holds for an exact posterior sample as $S \to \infty$. Under it, marginalizing over the posterior removes the population bias of both structures. The mean warp does not share this property. \mPM{} trains on the label at the mean warp $\bar u$, not on the mean label. Expanding $y^{u}$ around $\bar u = \sum_s\pi_s u_s$, +\begin{equation*} +\bar y - y^{\bar u} = \tfrac12 \sum_s \pi_s\, (u_s - \bar u)^\top \nabla_u^2 y^{\bar u}\, (u_s - \bar u) + O\big(\|u_s - \bar u\|^3\big), +\end{equation*} +so the two labels agree to first order in the posterior spread. If the time error of the mean warp has structure (b), the population optimum of \mPM{} is sharpened by $1/Q$, while that of the mean label is exact. + +\begin{corollary}[Two modes] +\label{cor:twomode} +Let the error ($\delta$ under (a), $\varepsilon$ under (b)) be constant over the window and equal to $\pm\Delta/2$ with probability $\frac12$ each, independently of $X$. Then $P(f) = Q(f) = \cos(\pi f\Delta)$, and under either structure the transfer from $m$ to $\tilde m$ is negative for $1/(2\Delta) < |f| < 3/(2\Delta)$: there the point label trains the network towards the wrong sign. A Gaussian error with the same variance $\Delta^2/4$ has $P(f) = e^{-\pi^2\Delta^2f^2/2} > 0$ at every frequency. The mean label of a calibrated bank has transfer 1. Under (a), a bank of the point label shifted by $\pm\Delta/2$ with equal weights has transfer $\cos^2(\pi f\Delta) \ge 0$. +\end{corollary} + +The phase reversal is a property of multimodal errors that a Gaussian summary hides. If the two modes are one dominant period apart, $\Delta = 1/f_0$, the reversed band is $f_0/2 < |f| < 3f_0/2$. The F3 seismic, from which the D2 wavelet is estimated, peaks near 60\,Hz (Section~\ref{sec:data:f3}), which gives 30--90\,Hz. Cycle skipping produces errors of this kind, and at $c = 2$ the SMC posterior is multimodal (Section~\ref{sec:method:posterior}). In this example, a bank centred on the point label removes the reversal only by attenuating the band further. + +\begin{remark}[$\lambda > 0$] +\label{rem:lambda} +Proposition~\ref{prop:bank} concerns the limit $\lambda \to 0$. Expanding the cumulant generating function in \eqref{eq:rml}, +\begin{equation*} +\RML_\lambda = -\frac1n\Big[\sum_s \pi_s\ell_s + \frac\lambda2 \Var_\pi(\ell) + O(\lambda^2)\Big]. +\end{equation*} +The second term rewards predictors that fit some bank members much better than others. For $\lambda > 0$ the responsibilities of Lemma~\ref{lem:grad} shift weight towards the members that agree with the current network, which amounts to an implicit re-registration, and the population minimizer is in general no longer $(m, \Var(y\mid X))$. +\end{remark} + +\paragraph{How much can a bank gain?} +Because $\E[y - m\mid X] = 0$, every predictor $h$ that depends on the data only through $X$ satisfies +\begin{equation*} +\E|B(h - y)|^2 = \E|B(m - y)|^2 + \E|B(h - m)|^2 , +\end{equation*} +so in population no method beats the oracle in band MSE. If a point-label method converges to $\tilde m$ and a bank method to $m$, the ratio of their band RMSEs is +\begin{equation} +\rho^\star = \Big(1 + \frac{\E|B(\tilde m - m)|^2}{\E|B(m - y)|^2}\Big)^{-1/2}, +\label{eq:rhostar} +\end{equation} +and no method can improve on the point label by more than this factor. With errors that do not depend on $t$ or $X$, $\E|B(\tilde m - m)|^2 = \int_{|f|\ge f_c}|1 - P|^2 S_m\dd f$ under (a) and $\int_{|f|\ge f_c}|1 - Q|^2|Q|^{-2}S_m\dd f$ under (b). For Gaussian errors both integrands equal $(2\pi^2\sigma^2f^2)^2 S_m$ to leading order, so the population distortion is of fourth order in $\sigma$. Beyond leading order the integrand under (b) is larger by the factor $e^{4\pi^2\sigma^2f^2}$, so a Berkson error leaves room for a larger gain than a classical error of the same width. The factor grows quickly with frequency: for $\sigma = 2$\,ms it is 1.10 at 25\,Hz and 1.77 at 60\,Hz. The weight $f^4$ also moves the distortion to high frequencies. For the Oracle predictions of Section~\ref{sec:exp:p2r}, 71--73\% of the band power that is coherent with the label lies below 25\,Hz, but the median frequency of the leading-order distortion is 67--72\,Hz. There the integral under (b) is 1.5--1.7 times that under (a) at $\sigma = 1.5$\,ms, 2.1--2.6 times at 2\,ms and 3.3--4.6 times at 2.5\,ms. A bound computed for one structure therefore does not hold for the other. The bound $1/B_a(\sigpost)$ registered for Section~\ref{sec:exp:p2r} is $\rho^\star$ under (a) for Gaussian errors, with the Oracle network's predictions in place of $m$. Section~\ref{sec:exp:p2r} also evaluates $1/B_b$, the same estimate under (b). + +\paragraph{Finite samples.} +The label error itself is of first order. For zero-mean errors with variance $\sigma^2$, $\tilde y - y \approx \delta\, y'$ under (a) and $\tilde y - y \approx -\varepsilon\,\tilde y'$ under (b). To this order its conditional mean given $X$ vanishes, and for an error that is constant over the window its in-band variance is $\sigma^2\int_{|f|\ge f_c}(2\pi f)^2 S_y\dd f$. Most of this variance moves label noise that is unpredictable from $X$ anyway. To second order in $\sigma$ and averaged over the window, the conditional variance that a network trained on $\tilde y$ has to absorb grows by the mean of $\sigma^2 m'^2$ under (a) and shrinks by about as much under (b) (Proposition~\ref{prop:tie}). This is a second-order effect, against the fourth-order distortion of $\tilde m$, so with few wells finite-sample effects can outweigh the population bias. The argument is heuristic. It suggests that a tie error with exactly structure (b) would not, to second order, make a network worse than the Oracle, because its labels carry less conditional noise than the true labels. A bank can also change finite-sample learning in ways that \eqref{eq:rhostar} does not capture. A learned variance absorbs the spread of the bank and down-weights samples where the members disagree, and for $\lambda > 0$ the responsibilities re-register the labels during training (Remark~\ref{rem:lambda}). Section~\ref{sec:exp:p2r} compares the measured gains with $\rho^\star$. + +\subsection{Coverage of the predictive intervals} +\label{sec:theory:cov} + +Let a method predict a mean $\mu$ and a variance $s^2$ at every test sample. For method $j$ let $v_j = \E s^2$, $w_j = \E(y - \mu)^2$ and $\xi_j = v_j/w_j$, with expectations over test samples; $\xi = 1$ means that the predicted variance matches the squared error on average. + +\begin{proposition}[Coverage] +\label{prop:coverage} +\begin{enumerate} + \item[(a)] For any methods $j$ and $O$, $\xi_j - \xi_O = (\Delta v - \xi_O\,\Delta w)/w_j$, with $\Delta v = v_j - v_O$ and $\Delta w = w_j - w_O$. + \item[(b)] Let $y$ be stationary, and let (A1) hold with real $0 \le P \le 1$. Compare the point label at its population optimum ($\mu = \tilde m$, $s^2 = \Var(\tilde y\mid X)$) with the oracle at its optimum ($\mu = m$, $s^2 = \Var(y\mid X)$). Then $\xi_O = 1$ and + \begin{equation*} + \xi_j - \xi_O = \frac{2}{w_j}\int P(1 - P)\, S_m\dd f \ \ge 0 . + \end{equation*} + \item[(c)] Under structure (b) of Proposition~\ref{prop:tie}, with $q_t$ independent of $t$ and $y$ stationary, the point label at its population optimum has $\xi_j \le 1$. A calibrated bank has $\xi_j = 1$. +\end{enumerate} +If $y - \mu = sZ/\sqrt{\xi}$ with $Z$ standard normal and independent of $s$, the interval $\mu \pm z s$ covers with probability $2\Phi(z\sqrt{\xi}) - 1$, which increases with $\xi$. +\end{proposition} + +Part (a) is an identity and holds for any finite ensemble. A method covers more than the Oracle when its predicted variance exceeds the Oracle's by more than $\xi_O$ times its excess squared error. Parts (b) and (c) describe the population limit. There, classical tie error widens the intervals of a point-label method, Berkson error narrows them, and a calibrated bank matches the oracle. A finite ensemble can be far from this limit, and in our experiments every ensemble is (Section~\ref{sec:exp:p2r}). + +\subsection{Scoring against a misregistered reference} +\label{sec:theory:ref} + +Field evaluation compares predictions with labels at blind wells, and those labels need a tie as well. Let the reference be $y_{\mathrm{ref}}(t) = y(t + \varepsilon_r)$, where $\varepsilon_r$ is constant over the window, independent of the prediction $\hat y$ and of the true label $y$, and has characteristic function $Q_r$. Let $\hat y$ and $y$ be jointly stationary with cross-spectrum $S_{\hat y y}$, defined by $\E[\hat y(t)\,y(t+\tau)] = \int S_{\hat y y}(f)\,e^{i2\pi f\tau}\dd f$. + +\begin{proposition}[Misregistered reference] +\label{prop:reference} +Under these assumptions, +\begin{equation} +\E|B(\hat y - y_{\mathrm{ref}})|^2 = \E|B(\hat y - y)|^2 + 2\int_{|f|\ge f_c}\operatorname{Re}\big[(1 - Q_r(f))\,S_{\hat y y}(f)\big]\dd f . +\label{eq:refbias} +\end{equation} +\end{proposition} + +For a symmetric error, $0 \le 1 - Q_r \le 2$, so the reference penalizes in-band agreement with the true label. The extra term depends on the method, so it can change the ranking of two methods, and it does not average out over wells: more blind wells reduce the variance of a comparison but not its bias. + +\begin{corollary}[Tolerance] +\label{cor:tolerance} +For two methods $A$ and $B$, let $G$ be the true band-MSE advantage of $A$ and $G_r$ the advantage measured against $y_{\mathrm{ref}}$. Then $G_r - G = 2\int_{|f|\ge f_c}\operatorname{Re}\big[(1 - Q_r)(S_{\hat y_B y} - S_{\hat y_A y})\big]\dd f$. Let $\hat y_A = Hm$ and $\hat y_B = HPm$, with real filters $0 \le H, P \le 1$: $A$ learns the oracle and $B$ the blurred optimum of (a), both shrunk by the same finite-sample factor $H$. Then +\begin{equation*} +G = \int_{|f|\ge f_c} H(1 - P)\big[2 - H(1 + P)\big] S_m\dd f \ \ge 0, +\qquad +G_r = \int_{|f|\ge f_c} H(1 - P)\big[2Q_r - H(1 + P)\big] S_m\dd f . +\end{equation*} +For $H = 1$ and zero-mean Gaussian errors with standard deviations $\sigma$ and $\sigma_r$, $2Q_r - 1 - P = 2\pi^2f^2(\sigma^2 - 2\sigma_r^2) + O(f^4)$, so to leading order the measured advantage has the sign of the true one only if $\sigma_r < \sigma/\sqrt2$. +\end{corollary} + +Shrinkage relaxes this condition, because $2Q_r - H(1 + P)$ grows as $H$ decreases. If $B$ is over-sharp instead, as under (b), with $\hat y_B = HKm$ and $K \ge 1$, then $G_r - G = 2\int_{|f|\ge f_c} H(K - 1)(1 - Q_r)S_m\dd f \ge 0$, and the reference exaggerates the advantage of $A$. Independence between $\varepsilon_r$ and the prediction is plausible for a reference from check shots or a vertical seismic profile. A reference tied by synthetic--seismic matching depends on the same seismic as the prediction, and its error adds a covariance term to \eqref{eq:refbias}. Section~\ref{sec:exp:detect} estimates how many blind wells a comparison needs at a given reference error. diff --git a/paper/sections/05_method.tex b/paper/sections/05_method.tex index 225baa6..909ca75 100644 --- a/paper/sections/05_method.tex +++ b/paper/sections/05_method.tex @@ -74,7 +74,7 @@ Let $M(\lambda) = \lambda^{-1}\log \E_\pi e^{\lambda\ell}$. Then $\RML_\lambda = and it tends to the right-hand side as $\lambda \to 0$ and to $\RML_\infty$ as $\lambda \to \infty$. For uniform $\pi$, $0 \le \RML_\lambda - \RML_\infty \le \log S/(\lambda n)$. \end{lemma} -As $\lambda \to 0$, the optimal mean is the $\pi$-weighted mean label, which is the blurred label of Proposition~\ref{prop:blur} with $p = \pi$. If $\sigma$ is learned as well, the optimal variance absorbs the spread of the bank. +As $\lambda \to 0$, the optimal mean is the regression of the $\pi$-weighted mean label on $X$, and the optimal variance adds the spread of the bank. Whether this blurs the predictor depends on how the bank relates to the true warp. If the members scatter around a point tie whose error satisfies (A1), the mean label is blurred further. If the bank is the calibrated posterior, the population optimum is that of the true warp (Proposition~\ref{prop:bank}). \begin{lemma}[Gradient] \label{lem:grad} @@ -101,7 +101,7 @@ The last term does not depend on $\theta$. On the diagonal path, $\ell_A$ equals \subsection{Network and training} \label{sec:method:train} -All learned methods share one backbone and differ only in their labels and loss. The input is a $3\times3$ trace patch around the well (nine channels), z-scored per channel within each well. Three dilated 1-D convolutions (kernel 5, dilations 1, 2 and 4, 64 channels) feed a two-layer bidirectional GRU. A $1\times1$ head with a $1\times1$ skip connection outputs $\mu$ and $\sigma$ (softplus, $\sigma \ge 10^{-3}$). Dropout is 0.05. We train with Adam (learning rate $5\times10^{-3}$, gradient clipping at 5) on full batches of all training wells. Losses are computed on 64-sample windows starting at samples $0, 2, \dots, 62$ of the 126-sample main window. Labels are standardized by the mean and standard deviation of the anti-aliased log over the training wells. These statistics do not depend on the tie. The number of iterations is selected separately for each method from $\{125, 250, 500, 1000, 2000\}$ by total RMSE on the development realizations; on F3 it is selected by inner validation (Section~\ref{sec:exp:f3}). Every method has the same candidate set, and band metrics are not used for selection. Ensembles average five seeds (on F3, three inner models $\times$ five seeds), with $\mu = \overline{\mu_s}$ and $\sigma^2 = \overline{\sigma_s^2} + \Var_s \mu_s$. +All learned methods share one backbone and differ only in their labels and loss. The input is a $3\times3$ trace patch around the well (nine channels), z-scored per channel within each well. Three dilated 1-D convolutions (kernel 5, dilations 1, 2 and 4, 64 channels) feed a two-layer bidirectional GRU. A $1\times1$ head with a $1\times1$ skip connection outputs $\mu$ and $\sigma$ (softplus, $\sigma \ge 10^{-3}$). Dropout is 0.05. We train with Adam (learning rate $5\times10^{-3}$, gradient clipping at 5) on full batches of all training wells. Losses are computed on 64-sample windows starting at samples $0, 2, \dots, 62$ of the 126-sample main window. Labels are standardized by the mean and standard deviation of the anti-aliased log over the training wells. These statistics do not depend on the tie. The number of iterations is selected separately for each method from $\{125, 250, 500, 1000, 2000\}$ by total RMSE on the development realizations; on F3 it is selected by inner validation (Appendix~\ref{sec:exp:f3}). Every method has the same candidate set, and band metrics are not used for selection. Ensembles average five seeds (on F3, three inner models $\times$ five seeds), with $\mu = \overline{\mu_s}$ and $\sigma^2 = \overline{\sigma_s^2} + \Var_s \mu_s$. \subsection{Compared methods} \label{sec:method:baselines} diff --git a/paper/sections/06_experiments.tex b/paper/sections/06_experiments.tex index 8d82503..91dd87e 100644 --- a/paper/sections/06_experiments.tex +++ b/paper/sections/06_experiments.tex @@ -1,7 +1,7 @@ \section{Experiments} \label{sec:experiments} -We ran two pre-registered synthetic experiments, in order, and then a pre-registered field test on F3 (Section~\ref{sec:exp:f3}). Before each main run, the protocol (grid, methods, iteration budgets, pass rules) was locked by a SHA-256 hash, and the scripts refuse to run if the hash does not match. The two synthetic protocols were also committed and tagged in version control before their main runs; the F3 protocol was committed and tagged only after its run (Section~\ref{sec:exp:f3}). In the synthetic experiments, every design choice was made on two development realizations (900 and 901), which are never used for results. Test labels were never used to choose a shift, checkpoint or hyperparameter. In the synthetic experiments, a comparison \emph{improves} if the candidate's seismic-band RMSE is at most 0.90 times that of the best competitor, \emph{or} its band PCC is at least 0.05 higher. Here ``best'' means the competitor with the smallest mean band RMSE in that cell. A cell \emph{passes} if the comparison improves in at least 4 of 5 seeds (each averaged over realizations) and in more than half of the realizations (each averaged over seeds). All cells use eight test wells. +We ran two pre-registered synthetic experiments, in order, and then pre-registered field tests on F3 and Volve (Section~\ref{sec:exp:scope}; details in Appendix~\ref{app:field}). Before each main run, the protocol (grid, methods, iteration budgets, pass rules) was locked by a SHA-256 hash, and the scripts refuse to run if the hash does not match. The two synthetic protocols were also committed and tagged in version control before their main runs. The field protocols were committed only after their runs, so for them the record of timing is the time stamp inside the lock file (Appendix~\ref{app:field}). In the synthetic experiments, every design choice was made on two development realizations (900 and 901), which are never used for results. Test labels were never used to choose a shift, checkpoint or hyperparameter. In the synthetic experiments, a comparison \emph{improves} if the candidate's seismic-band RMSE is at most 0.90 times that of the best competitor, \emph{or} its band PCC is at least 0.05 higher. Here ``best'' means the competitor with the smallest mean band RMSE in that cell. A cell \emph{passes} if the comparison improves in at least 4 of 5 seeds (each averaged over realizations) and in more than half of the realizations (each averaged over seeds). All cells use eight test wells. \subsection{Experiment 1: anchor-posterior banks (gate G-B)} \label{sec:exp:p2} @@ -121,25 +121,34 @@ $\sigma_a^{\mathrm{reg}}$ (ms) & ratio $N = 4$ & ratio $N = 16$ & cells pass & $ \paragraph{H2b: RML helps when the posterior is wide.} At $N = 16$ all three tests passed (Table~\ref{tab:h2b}, Fig.~\ref{fig:h2b}a). All 8 wide cells passed, the ratio decreased with $\sigpost$ (Spearman $\rho = -0.85$, one-sided permutation $p < 0.001$), and the mean ratio over narrow cells was 0.996. The gains in wide cells ranged from 2\% (Rm5, $c = 1$) to 11\% (R10tb, $c = 1$). At $c = 2$ they reached 33\% (R10tb), but those cells are flagged unstable. At $N = 4$, which was reported but not used for the verdict, 6 of 8 wide cells passed ($\rho = -0.77$, narrow mean 1.001). -The mechanism is not settled. In 7 of the 8 wide cells, the measured ratio is below $1/B(\sigpost)$ (Fig.~\ref{fig:h2b}b), the ratio that complete removal of Gaussian blur would give (Section~\ref{sec:theory:post}). At Rm5, $c = 1$, for example, the bound allows no gain (1.000), yet RML gained 2\%. Only in R10tb at $c = 2$ does the ratio (0.667) lie within the bound (0.634). Most of the gain therefore does not come from deblurring in the sense of Proposition~\ref{prop:blur}. We see two candidate explanations, which our experiments do not separate. One is label augmentation: the bank prevents the network from memorizing a single misregistered label. The other is that the posterior mean is biased when the posterior is multimodal. +\paragraph{Comparison with the population bound.} +The column $1/B_a$ of Table~\ref{tab:h2b} is the registered bound: $\rho^\star$ of \eqref{eq:rhostar} for Gaussian classical error at $\sigpost$, computed by blurring the Oracle's predictions. It is the largest gain over the point label that removing a population blur could give (Section~\ref{sec:theory:post}). The measured ratio is below it in 7 of the 8 wide cells (Fig.~\ref{fig:h2b}b). At Rm5, $c = 1$, for example, the bound allows no gain (1.000), yet RML gained 2\%. The exception is R10tb at $c = 2$, where $\sigpost$ lies beyond the 6\,ms edge of the grid on which $B$ was computed. The tabulated value is therefore $1/B_a(6\,\mathrm{ms})$, and at $\sigpost$ itself the bound is 0.481. + +The registered structure is not the one expected for \mPM{}, whose labels sit at the posterior-mean warp. The natural idealization for the error of a posterior mean is the Berkson structure (b), and under (b) the bound is lower (Section~\ref{sec:theory:post}). The column $1/B_b$ gives this bound, computed post hoc in the same way but by sharpening the Oracle's predictions, at $\sigpost$ itself. The measured ratio is below it in 3 of the 8 wide cells, all at $c = 1$ (R0, R0h and R10tb). In R0h and R10tb the margin is less than 0.004, well inside the 95\% interval of the ratio. Sharpening also amplifies the Oracle's own estimation error, which lowers $1/B_b$, most of all at $c = 2$. Two variants limit this amplification. One holds the gain at its 60\,Hz value above 60\,Hz. The other replaces the spectrum of the Oracle's predictions by their cross-spectrum with the true labels. Both select the same three cells, and with the cross-spectrum the (a) bound is exceeded in only 5 of the 8 cells. + +Both bounds are evaluated at the posterior width, which understates the error of an overconfident posterior. Evaluated instead at the measured warp error of \mPM{} on the training wells, the ratio is still below the (a) bound in 6 of the 8 cells but below the (b) bound in at most one (R0, $c = 1$, under the two variants). An excess over the population bound is therefore not established. It appears under the classical structure, and under the Berkson structure it is confined to $c = 1$ and mostly disappears at the measured warp error. Whether the error of the mean warp has the Berkson structure was not tested (Section~\ref{sec:exp:mech}). + +The Oracle's advantage over \mPM{} can be compared with the same bounds. These ratios are post hoc and computed from the registered band RMSE of every method. At $c = 1$, $N = 16$, the Oracle's band RMSE was 0.93, 0.92 and 0.93 times that of \mPM{} at R0, R0h and Rm5, and 0.76 times at R10tb. These ratios are below the (a) bound in all four cells, below the (b) bound at $\sigpost$ in three or four of them, depending on the estimator, and below the (b) bound at the measured warp error in one or two. Part of the gap is not caused by registration at all. At $c = 0$, where the SMC warp RMSE on the training wells was 0.2--0.7\,ms and every bound is within 0.4\% of 1, the Oracle was still 1--3\% better than \mPM{} at $N = 16$. The two also differ in training length, which was selected on development data (500 and 250 iterations; Section~\ref{sec:method:train}). + +In the wide cells at $N = 16$, \mRML{} closed 27--46\% of the gap between \mPM{} and the Oracle at $c = 1$, and 39--65\% at $c = 2$. It never reached the Oracle. Its band RMSE stayed 4--6\% above the Oracle's at R0, R0h and Rm5, and 17\% ($c = 1$) and 63\% ($c = 2$) above it at R10tb. The confirmatory experiments do not show where the gain comes from. If the error of the mean warp has the Berkson structure, most of the gain is within what removing the population sharpening of \mPM{} could give. A bank can also gain in finite samples. It acts as label augmentation: the network cannot memorize a single misregistered label, and the learned variance absorbs the spread of the bank and down-weights samples where the members disagree. For $\lambda > 0$ the responsibilities re-register the labels during training (Remark~\ref{rem:lambda}). When the posterior is multimodal, the error of the mean warp is not Gaussian, and the gain available to a bank can exceed the Gaussian bound (Corollary~\ref{cor:twomode}). Section~\ref{sec:exp:mech} examines these sources in an exploratory analysis. \begin{table}[t] \centering -\caption{H2b at $N = 16$, wide cells ($\sigpost \ge 1.5$\,ms): band RMSE of \mRML{} divided by that of \mPM{} (95\% CI), the deblurring bound $1/B(\sigpost)$, and the SMC warp error on the training wells. $\dagger$: unstable posterior ($c = 2$).} +\caption{H2b at $N = 16$, wide cells ($\sigpost \ge 1.5$\,ms): band RMSE of \mRML{} divided by that of \mPM{} (95\% CI); the population bounds at $\sigpost$ for Gaussian classical error, $1/B_a$ (registered), and for Gaussian Berkson error, $1/B_b$ (post hoc), computed by blurring and by sharpening the Oracle's predictions (Section~\ref{sec:theory:post}); and the SMC warp error on the training wells. A ratio below a bound is a larger gain than removing that population distortion could give. $\dagger$: unstable posterior ($c = 2$). $\ddagger$: $\sigpost$ exceeds the 6\,ms grid of $B$; the entry is $1/B_a(6\,\mathrm{ms})$, and the bound at $\sigpost$ is 0.481.} \label{tab:h2b} \small -\begin{tabular}{lccccccc} +\begin{tabular}{lcccccccc} \toprule -Regime & $c$ & $\sigpost$ (ms) & ratio & 95\% CI & $1/B$ & warp RMSE (ms) & cov$_{90}$ \\ +Regime & $c$ & $\sigpost$ (ms) & ratio & 95\% CI & $1/B_a$ & $1/B_b$ & warp RMSE (ms) & cov$_{90}$ \\ \midrule -R0 & 1 & 1.53 & 0.967 & [0.956, 0.979] & 0.999 & 1.86 & 0.86 \\ -R0h & 1 & 1.72 & 0.970 & [0.953, 0.989] & 0.996 & 2.36 & 0.83 \\ -R10tb & 1 & 1.92 & 0.890 & [0.866, 0.915] & 0.964 & 4.78 & 0.53 \\ -Rm5 & 1 & 2.56 & 0.982 & [0.966, 0.995] & 1.000 & 2.91 & 0.86 \\ -R0 & 2$^\dagger$ & 2.79 & 0.952 & [0.940, 0.962] & 0.968 & 2.72 & 0.94 \\ -Rm5 & 2$^\dagger$ & 3.96 & 0.964 & [0.953, 0.977] & 0.980 & 3.92 & 0.91 \\ -R0h & 2$^\dagger$ & 4.18 & 0.904 & [0.889, 0.925] & 0.910 & 4.10 & 0.94 \\ -R10tb & 2$^\dagger$ & 11.49 & 0.667 & [0.615, 0.713] & 0.634 & 19.08 & 0.62 \\ +R0 & 1 & 1.53 & 0.967 & [0.956, 0.979] & 0.999 & 0.982 & 1.86 & 0.86 \\ +R0h & 1 & 1.72 & 0.970 & [0.953, 0.989] & 0.996 & 0.972 & 2.36 & 0.83 \\ +R10tb & 1 & 1.92 & 0.890 & [0.866, 0.915] & 0.964 & 0.893 & 4.78 & 0.53 \\ +Rm5 & 1 & 2.56 & 0.982 & [0.966, 0.995] & 1.000 & 0.904 & 2.91 & 0.86 \\ +R0 & 2$^\dagger$ & 2.79 & 0.952 & [0.940, 0.962] & 0.968 & 0.768 & 2.72 & 0.94 \\ +Rm5 & 2$^\dagger$ & 3.96 & 0.964 & [0.953, 0.977] & 0.980 & 0.285 & 3.92 & 0.91 \\ +R0h & 2$^\dagger$ & 4.18 & 0.904 & [0.889, 0.925] & 0.910 & 0.132 & 4.10 & 0.94 \\ +R10tb & 2$^\dagger$ & 11.49 & 0.667 & [0.615, 0.713] & 0.634$^\ddagger$ & $<$0.001 & 19.08 & 0.62 \\ \bottomrule \end{tabular} \end{table} @@ -147,7 +156,7 @@ R10tb & 2$^\dagger$ & 11.49 & 0.667 & [0.615, 0.713] & 0.634 & 19.08 & 0.62 \\ \begin{figure}[t] \centering \includegraphics[width=\linewidth]{p2r_h2b.pdf} -\caption{H2b. (a) Band RMSE of \mRML{} divided by that of \mPM{} against the posterior width $\sigpost$, for every regime $\times$ $c$ $\times$ $N$ cell (filled: $N = 16$; open: $N = 4$; marker shape: drift factor $c$). Bars are 95\% bootstrap intervals over realizations. The dashed line is the pre-registered 1.5\,ms threshold for wide cells. (b) The same ratio against the deblurring bound $1/B(\sigpost)$ computed from Oracle predictions (Section~\ref{sec:theory:post}). Cells below the diagonal gained more than removing a Gaussian blur could give. Cells at $c = 2$ have an unstable posterior and are not primary evidence.} +\caption{H2b. (a) Band RMSE of \mRML{} divided by that of \mPM{} against the posterior width $\sigpost$, for every regime $\times$ $c$ $\times$ $N$ cell (filled: $N = 16$; open: $N = 4$; marker shape: drift factor $c$). Bars are 95\% bootstrap intervals over realizations. The dashed line is the pre-registered 1.5\,ms threshold for wide cells. (b) The same ratio against the registered population bound $1/B_a(\sigpost)$ for classical error, computed from Oracle predictions (Section~\ref{sec:theory:post}). Cells below the diagonal gained more than removing a classical population blur could give. The bound $1/B_b$ for Berkson error, the natural idealization for labels at the posterior-mean warp, is lower, and at $N = 16$ only three wide cells, all at $c = 1$, lie below it (Table~\ref{tab:h2b}). For R10tb at $c = 2$ the bound is evaluated at the 6\,ms edge of its grid. Cells at $c = 2$ have an unstable posterior and are not primary evidence.} \label{fig:h2b} \end{figure} @@ -162,185 +171,81 @@ The SMC posterior was close to calibrated when the anchors were dense and $\sigm \end{figure} \paragraph{Predictive uncertainty (descriptive).} -Every five-seed ensemble under-covered. At R10, $c = 1$, $N = 16$, the 90\% coverage was 0.79 for B5, 0.58 for \mPM-ens, 0.58 for \mRML-ens and 0.48 for Oracle-ens, with calibration errors 0.114, 0.300, 0.291 and 0.379. Ensembles trained on better labels predicted smaller $\sigma$ and covered less. A seed ensemble of a heteroscedastic network does not carry the tie posterior to the test wells. We make no calibration claim. +Every five-seed ensemble under-covered. At R10, $c = 1$, $N = 16$, the 90\% coverage was 0.79 for B5, 0.58 for \mPM-ens, 0.58 for \mRML-ens and 0.48 for Oracle-ens, with calibration errors 0.114, 0.300, 0.291 and 0.379. Ensembles trained on better labels predicted smaller $\sigma$ and covered less. -\subsection{F3 field data (gate G-C)} -\label{sec:exp:f3} - -\paragraph{Baselines.} -Table~\ref{tab:p1} gives leave-one-well-out results for the baselines on F3. The label is $\mathrm{PHIE}_{\mathrm{DT}}$, and the reference is the marker-calibrated sonic of the test well. The test well contributes nothing to training, tie, hyperparameters or checkpoint selection. A depth--time trend fitted on the training wells (B0a) has the lowest RMSE. No learned model beats it in total RMSE, and its seismic-band PCC is negative. Seismic-attribute ridge regression (B0b) has the highest band PCC (0.24). Among networks, labels from the marker-calibrated tie (B3b) beat single-anchor sonic integration (B3a). With four wells these numbers are descriptive. +Table~\ref{tab:t4} examines this pattern post hoc, with the dispersion ratio $\xi$ of Section~\ref{sec:theory:cov} computed from the saved test-well predictions. Every ensemble was too narrow: $\xi$ was 0.19 for the Oracle and at most 0.66 (B5), against 1 for a matched second moment. Because $\xi_O$ is small, Proposition~\ref{prop:coverage}(a) requires only a small excess of predicted variance for a method to cover more than the Oracle. Each method had a larger $\xi$ and a higher coverage than the Oracle in 80--99\% of the 240 realization cells. The ordering follows training length as much as label quality. At R10, B3c-R had a median warp error of 3.5\,ms on the training wells, against 0.55\,ms for the SMC mean warp. It was trained for the Oracle's 500 iterations and reached the same $\xi$ as \mPM{} at 250. Over all regimes its excess over the Oracle was the smallest of any method (0.02--0.03). Most of the excess of \mPM{} and \mRML{} was already present at $c = 0$, where the median warp error of their labels was 0.34\,ms. Within the 250-iteration group, the methods with worse labels (B3d, B3c) had the larger excess, as Proposition~\ref{prop:coverage}(b) predicts. Training length acts on its own. On the development realizations of Experiment~1 (SNR 10, $c = 1$, $N = 16$), the 90\% coverage of single Oracle models fell from 0.47 after 125 iterations to 0.23 after 500 and 0.10 after 2000. Their mean $\sigma$ fell by a factor of five, while their RMSE varied by less than 10\%. In Experiment~2 training length and label source are confounded, so parts (b) and (c) of Proposition~\ref{prop:coverage} are not tested. A seed ensemble of a heteroscedastic network does not carry the tie posterior to the test wells. We make no calibration claim. \begin{table}[t] \centering -\caption{F3 leave-one-well-out baselines (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, 600--1100\,ms). Macro over four wells; $\pm$: standard deviation over five seeds.} -\label{tab:p1} +\caption{Dispersion of the five-seed ensembles (post hoc, descriptive). Left: R10, $c = 1$, $N = 16$. Iterations: training length selected on development data. rms $s$: root mean predicted variance $\overline{\sigma_s^2} + \Var_s\mu_s$; RMSE of the ensemble mean (p.u.); $\xi$: dispersion ratio of Section~\ref{sec:theory:cov}, averaged over realizations; cov$_{90}$: coverage of the central 90\% Gaussian interval. Right: mean excess $\xi_j - \xi_O$ over the Oracle in the same realization, averaged over the five regimes, both $N$ and eight realizations, by drift factor $c$.} +\label{tab:t4} \small -\begin{tabular}{lcccc} +\begin{tabular}{lcccccccc} \toprule -Method & RMSE (p.u.) & PCC & band PCC & skill vs B0a \\ +& & \multicolumn{4}{c}{R10, $c = 1$, $N = 16$} & \multicolumn{3}{c}{$\xi_j - \xi_O$} \\ +\cmidrule(lr){3-6}\cmidrule(lr){7-9} +Ensemble & iterations & rms $s$ & RMSE & $\xi$ & cov$_{90}$ & $c = 0$ & $c = 1$ & $c = 2$ \\ \midrule -B0a (trend) & \textbf{2.48} & 0.81 & $-0.13$ & 0.00 \\ -B0b ridge & 2.58 & \textbf{0.83} & \textbf{0.24} & $-0.09$ \\ -B0b random forest & $2.67 \pm 0.01$ & 0.79 & $-0.03$ & $-0.22$ \\ -B0b gradient boosting & 2.68 & 0.78 & 0.01 & $-0.20$ \\ -B1 (impedance inversion) & 3.60 & 0.44 & $-0.02$ & $-1.29$ \\ -B2 (composite loss) & $3.07 \pm 0.16$ & 0.52 & 0.15 & $-0.65$ \\ -B3a & $2.93 \pm 0.24$ & 0.62 & $-0.02$ & $-0.47$ \\ -B3b & $2.82 \pm 0.21$ & 0.68 & 0.15 & $-0.36$ \\ +Oracle & 500 & 0.48 & 1.13 & 0.189 & 0.48 & -- & -- & -- \\ +B3c-R & 500 & 0.61 & 1.20 & 0.262 & 0.55 & 0.018 & 0.027 & 0.026 \\ +\mPM{} & 250 & 0.58 & 1.15 & 0.265 & 0.58 & 0.032 & 0.051 & 0.058 \\ +\mRML{} & 250 & 0.60 & 1.16 & 0.275 & 0.58 & 0.031 & 0.046 & 0.054 \\ +B3d & 250 & 0.76 & 1.24 & 0.379 & 0.65 & 0.041 & 0.072 & 0.064 \\ +B3c & 250 & 0.74 & 1.23 & 0.372 & 0.64 & 0.058 & 0.072 & 0.064 \\ +B5 & 125 & 1.10 & 1.36 & 0.662 & 0.79 & 0.199 & 0.199 & 0.179 \\ \bottomrule \end{tabular} \end{table} -\paragraph{Protocol and deviations.} -The field test was pre-registered in a third protocol. Its SHA-256 lock also covers the code, the input data and the software environment, and the scripts refuse to run if any of them changes. The lock file records that it was written one minute before the main run started (28 October 2026, 00:14 and 00:15 local time). The protocol was committed to version control and tagged only after the run, together with the results. The record that the lock preceded the run is therefore the time stamp inside the lock file, which is self-reported, not the version history. Before the lock we ran a timing pilot of the registration and a preflight of the classical baselines on F3. Neither computed a metric on a test well. No result on an F3 test well was used to design it. Two facts limit what the test can show. First, F3 is not an untouched field dataset. The same four wells gave the baselines of Table~\ref{tab:p1}, computed before the protocol was written, and they calibrated the synthetic benchmark (Section~\ref{sec:data:d2}). The field test is therefore a descriptive follow-up on wells we had already seen, not an independent replication. Second, the method under test comes from Experiment~2, whose protocol was itself designed after Experiment~1 had failed (Section~\ref{sec:exp:diag}). The field result therefore bears on the SMC variant only, and it leaves the verdict of Experiment~1 unchanged. +\subsection{Mechanism of the bank gain (exploratory)} +\label{sec:exp:mech} + +\todoblock{T2, exploratory, on the Experiment~2 bank (realizations 8--15), declared in \texttt{docs/research/t2-mechanism.md} before it is run (scheduled 1/11/2026). Planned tests: (i) warp error of the responsibility-weighted bank against that of the mean warp, at the end of training (re-registration, Remark~\ref{rem:lambda}); (ii) a control bank of random Gaussian-process time shifts with the same spread (label augmentation); (iii) split of the wide cells by posterior multimodality (Corollary~\ref{cor:twomode}); (iv) the Berkson-versus-classical covariance test of Section~\ref{sec:theory:post} for the bulk offset of \mPM{} and B3c-R, which decides which bound of Table~\ref{tab:h2b} applies; (v) \mPM{} retrained at the Oracle's budget, to separate training length from label error. The question is whether any gain remains beyond the population correction of the Berkson structure, not why a gain exceeds the registered bound. Disclose that the post hoc ratios and both bounds of Section~\ref{sec:exp:p2r}, at $\sigpost$ and at the warp error and with the 60\,Hz and cross-spectral variants, were inspected on 29/10/2026, before the declaration.} + +\subsection{Detectability of a gain at blind wells (exploratory)} +\label{sec:exp:detect} + +A field test scores predictions at blind wells against labels that need a tie of their own. By Proposition~\ref{prop:reference}, an error in that reference biases the comparison, and more wells reduce its variance but not its bias. To estimate how many blind wells a field test needs, we rescored the saved test predictions of Experiment~2 against perturbed references. The analysis was declared before it was run, but after both field gates had failed (Section~\ref{sec:exp:scope}). After the first run we added points to the grid of reference errors, from $\{0, 2, 4, 8\}$ to $\{0, 0.5, 1, 1.5, 2, 3, 4, 8\}$\,ms, because the outcome changed between 0 and 2\,ms, where the grid had no points. No rule, threshold or input changed. The analysis is exploratory. \paragraph{Design.} -We used nested leave-one-well-out validation. Each well is held out once as the outer test well. Within the three remaining wells, each is held out once as an inner validation well, and models are trained on the other two. Registration uses only the two training wells of each model: the warp-prior hyperparameters, the wavelet phase and the SMC posterior ($\sigma_a = 7$\,ms, $P = 1024$, $S = 64$) are all estimated from them. For each outer fold, method and seed, the iteration budget is chosen from $\{125, 250, 500, 1000, 2000\}$ by total validation MSE averaged over the three inner wells, with ties going to the smaller budget. This replaces the selection on development realizations used in the synthetic experiments (Section~\ref{sec:method:train}). The prediction at the outer well is a Gaussian with the mean and variance of the equally weighted mixture of 15 members (three inner models $\times$ five seeds). Nothing is refitted on the outer well, and its labels enter no choice. The primary label is $\mathrm{PHIE}_{\mathrm{DT}}$, and the reference is the marker-calibrated sonic of the test well, as in Table~\ref{tab:p1}. +We used the cells at R10, R0 and Rm5 with $c = 1$ and $N \in \{4, 16\}$, and compared \mRML{} with the best point tie of each cell, the competitor of H2a: B3c-R in four cells, B3c at R10 with $N = 4$ and B3b at Rm5 with $N = 4$. For each test well, the reference is the true label read at $t + s(t)$, with $s = a + bx$, where $x$ runs linearly from $-1$ to 1 across the window, $a \sim \N(0, \sigma_{\mathrm{ref}}^2)$ and $b \sim \N(0, \sigma_{\mathrm{ref}}^2/4)$. The RMS of $s$ is then $1.04\,\sigma_{\mathrm{ref}}$. Each well receives 64 draws. A well counts as a win if the seed-averaged \mRML{} has the lower band RMSE against this reference. Wells of one realization share their training wells, so their outcomes are correlated. The probability that a rule passes with $n$ blind wells is therefore computed from a beta-binomial distribution whose mean is the win rate and whose intra-class correlation is that of the outcome within realizations. We compare two rules: $k$ of $n$ wells with $k = \lceil 0.75n\rceil$, the form of both field gates (three of four on F3, five of six on Volve), and a one-sided sign test at $\alpha = 0.05$. $N^\star$ is the smallest $n \le 40$ at which a rule passes with probability at least 0.8. -Gate G-C required two conditions for \mRML{} in this configuration. (i) \emph{Direction}: lower band RMSE than the point tie chosen for that outer fold among B3b, B3c and B3c-R, by inner-validation MSE averaged over seeds, at no fewer than three of the four outer wells. Any reduction counts, so this rule is weaker than the 0.90 ratio of the synthetic experiments. (ii) \emph{Coverage}: macro coverage of the central 80\% and 90\% intervals within $\pm 0.05$ of nominal, that is, in $[0.75, 0.85]$ and $[0.85, 0.95]$. Coverage is the fraction of time samples in the window that fall inside the interval. These samples are strongly correlated, so coverage is a description, not a test. The protocol also states that better accuracy cannot compensate for failed coverage. Before the run we had recorded that the coverage condition would probably fail, because every ensemble had under-covered in the synthetic experiments. We kept the threshold. +\paragraph{A reference error of a few milliseconds reverses the ranking.} +With an exact reference, \mRML{} won at 81--97\% of the test wells, and its median band RMSE was 0.80--0.92 times that of the competitor (Table~\ref{tab:t3}). Both numbers worsened as the reference error grew. At $\sigma_{\mathrm{ref}} = 4$\,ms, the win rate was 0.46--0.64 and the median ratio 0.96--1.01. At 8\,ms, the win rate was 0.22--0.44 and the median ratio exceeded 1 in every cell: against this reference the point tie scored better, although against the true labels it was worse. In the three cells with $N = 16$, the median ratio crossed 1 between 3.6 and 4.3\,ms. Corollary~\ref{cor:tolerance} places the crossing, to leading order and without shrinkage, at $\sigma/\sqrt2$, where $\sigma$ is the tie error of the point label. The RMS warp error of B3c-R on the training wells of these cells was 4.2, 5.8 and 7.3\,ms at R10, R0 and Rm5, so $\sigma/\sqrt2$ is 3.0, 4.1 and 5.1\,ms. The simulated crossings follow the same order and lie within 1\,ms of these values. The agreement can only be approximate: \mRML{} is not the oracle that the corollary assumes, the tie errors are not constant Gaussian shifts, and the reference error here includes a stretch. -\paragraph{Result: the gate failed.} -Both conditions failed (Table~\ref{tab:f3gc}). Inner validation chose B3c-R as the competitor at all four outer wells. \mRML{} had lower band RMSE only at F03-4, by 1.9\%. At F02-1 and F03-2 it was 0.8\% and 0.02\% worse, and at F06-1 it was 7.0\% worse. Its macro band RMSE was 1.272\,p.u., against 1.256\,p.u.\ for B3c-R. Macro coverage was 0.524 for the 80\% intervals and 0.609 for the 90\% intervals, far below the lower limits of 0.75 and 0.85. At F03-2 and F03-4 the 80\% and 90\% intervals covered 0.75 and 0.80 of the samples, just below and well below nominal. At F02-1 and F06-1 they covered 0.22--0.38 and 0.33--0.50. At these two wells most of the error lay below 6\,Hz: the low-band RMSE was 4.31 and 3.64\,p.u., out of a total RMSE of 4.56 and 3.82\,p.u., while the mean predicted standard deviation was 1.05 and 1.27\,p.u. Seed by seed (three-member ensembles), \mRML{} beat B3c-R at one to three of the four wells. The macro band RMSE of each method varied between seeds by up to 0.13\,p.u.\ (\mRML: 1.28--1.41\,p.u.; B3c-R: 1.29--1.41\,p.u.), eight times the gap between the combined ensembles. The competitor was not changed after the test wells were scored, and the intervals were not widened. Under this protocol, training on the SMC bank gave no band-RMSE gain over the best point tie on F3, and its predictive intervals were much too narrow. We make no claim of improvement on field data and no claim of calibrated uncertainty. +\paragraph{Wells needed.} +With an exact reference, the sign test needs five blind wells at R0 (both $N$) and at R10 with $N = 16$, and 18 and 11 wells at Rm5 with $N = 4$ and 16. At R10 with $N = 4$, the outcomes are strongly correlated within realizations (intra-class correlation 0.45), and no $n \le 40$ reaches a pass probability of 0.8. The number of wells rises quickly with the reference error. At 1\,ms, four of the six cells need 11--30 wells; at 2\,ms, only R0 stays within 40 (23 and 37 wells); at 3\,ms or more, no cell does. The $k$-of-$n$ rule appears to need fewer wells, but it is not a test. With independent wells and no true difference, it passes with probability $5/16 = 0.31$ at $n = 4$ and $7/64 = 0.11$ at $n = 6$. A one-sided sign test at $\alpha = 0.05$ cannot reject at all with four wells, because its smallest attainable $p$-value is $1/16$. \begin{table}[t] \centering -\caption{Gate G-C on F3 (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, 600--1100\,ms, $\sigma_a = 7$\,ms, 15-member ensemble). Competitor: the point tie chosen by inner validation. Ratio: band RMSE of \mRML{} divided by that of the competitor; at F03-2 it is 1.0002. Coverage: fraction of the 126 time samples inside the central interval of \mRML; at F03-2 and F03-4 the same counts (94 and 101 samples) occur by coincidence.} -\label{tab:f3gc} +\caption{Detectability at blind wells (exploratory; saved test predictions of Experiment~2, $c = 1$). Competitor: the best point tie of the cell. Win: fraction of the 64 test wells at which \mRML{} has the lower band RMSE against the perturbed reference; ratio: median ratio of band RMSE, \mRML{} to competitor; ICC: intra-class correlation of the win within realizations. $N^\star$: smallest number of blind wells at which a one-sided sign test ($\alpha = 0.05$) rejects with probability at least 0.8; --: not reached with 40 wells.} +\label{tab:t3} \small -\begin{tabular}{lccccc} +\setlength{\tabcolsep}{4pt} +\begin{tabular}{llccccccccccc} \toprule -Outer well & competitor & ratio & improved & cov$_{80}$ & cov$_{90}$ \\ +& & \multicolumn{3}{c}{$\sigma_{\mathrm{ref}} = 0$} & \multicolumn{2}{c}{win} & \multicolumn{6}{c}{$N^\star$ at $\sigma_{\mathrm{ref}}$ (ms)} \\ +\cmidrule(lr){3-5}\cmidrule(lr){6-7}\cmidrule(lr){8-13} +Cell & Competitor & win & ratio & ICC & 4\,ms & 8\,ms & 0 & 0.5 & 1 & 1.5 & 2 & $\ge 3$ \\ \midrule -F02-1 & B3c-R & 1.008 & no & 0.222 & 0.333 \\ -F03-2 & B3c-R & 1.000 & no & 0.746 & 0.802 \\ -F03-4 & B3c-R & 0.981 & yes & 0.746 & 0.802 \\ -F06-1 & B3c-R & 1.070 & no & 0.381 & 0.500 \\ -\midrule -Macro & & & 1/4 & 0.524 & 0.609 \\ -Required & & & $\ge 3/4$ & $[0.75, 0.85]$ & $[0.85, 0.95]$ \\ +R10, $N = 4$ & B3c & 0.81 & 0.85 & 0.45 & 0.53 & 0.39 & -- & -- & -- & -- & -- & -- \\ +R10, $N = 16$ & B3c-R & 0.97 & 0.80 & 0.00 & 0.46 & 0.22 & 5 & 5 & 11 & 23 & -- & -- \\ +R0, $N = 4$ & B3c-R & 0.95 & 0.87 & 0.07 & 0.64 & 0.39 & 5 & 8 & 11 & 13 & 23 & -- \\ +R0, $N = 16$ & B3c-R & 0.97 & 0.87 & 0.00 & 0.48 & 0.27 & 5 & 8 & 13 & 18 & 37 & -- \\ +Rm5, $N = 4$ & B3b & 0.84 & 0.92 & 0.39 & 0.60 & 0.44 & 18 & 30 & -- & -- & -- & -- \\ +Rm5, $N = 16$ & B3c-R & 0.89 & 0.92 & 0.08 & 0.51 & 0.31 & 11 & 16 & 30 & -- & -- & -- \\ \bottomrule \end{tabular} \end{table} -\paragraph{Relation to Experiment~2.} -In the synthetic benchmark, \mRML{} beat the best point tie in all three full-anchor regimes, under a stricter rule (Section~\ref{sec:exp:p2r}). On F3 this direction held at one well of four. The field test does not show why, and we tested no explanation. Two features of F3 limit what it can detect. First, the synthetic gains required a correctly specified $\sigma_a$ (Table~\ref{tab:sigmaa}). On F3, $\sigma_a$ is not identified: 7\,ms comes from the marker--horizon spread (Section~\ref{sec:data:f3}), not from an independent measurement. Second, the reference is itself a point tie, the marker-calibrated sonic of B3b. Its registration error adds to the band RMSE of every method, which pulls ratios towards one, and it favours methods whose label errors resemble its own. Neither feature changes the verdict. +\subsection{Scope: two field cases} +\label{sec:exp:scope} -\begin{table}[t] -\centering -\caption{F3 nested leave-one-well-out, all methods (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, $\sigma_a = 7$\,ms, combined ensembles). Macro over four wells; RMSE in p.u. Coverage is descriptive. Last row: a prediction with no content above $f_c$, whose band RMSE equals the RMS of the band component of the reference; computed after the run, for scale only.} -\label{tab:f3all} -\small -\begin{tabular}{lcccccc} -\toprule -Method & band RMSE & band PCC & RMSE & PCC & cov$_{80}$ & cov$_{90}$ \\ -\midrule -B0a (trend) & 1.239 & $-0.13$ & \textbf{2.48} & 0.81 & -- & -- \\ -B0b ridge & 1.271 & \textbf{0.24} & 2.58 & \textbf{0.83} & -- & -- \\ -B0b random forest & 1.511 & $-0.03$ & 2.67 & 0.79 & -- & -- \\ -B0b gradient boosting & 1.537 & 0.01 & 2.68 & 0.78 & -- & -- \\ -B1 (impedance inversion) & 3.090 & $-0.02$ & 3.60 & 0.44 & -- & -- \\ -B2 (composite loss) & 1.252 & 0.19 & 3.09 & 0.53 & 0.38 & 0.44 \\ -\midrule -B3a & 1.348 & $-0.01$ & 3.13 & 0.44 & 0.47 & 0.57 \\ -B3b & 1.284 & 0.16 & 3.07 & 0.52 & 0.50 & 0.59 \\ -B3c & 1.282 & 0.20 & 3.14 & 0.45 & 0.48 & 0.58 \\ -B3c-R & 1.256 & 0.20 & 2.98 & 0.59 & 0.51 & 0.59 \\ -B3d & 1.266 & 0.16 & 3.05 & 0.52 & 0.51 & 0.60 \\ -\mPM & 1.275 & 0.15 & 3.00 & 0.57 & 0.47 & 0.57 \\ -\midrule -B4a & 1.232 & 0.18 & 3.24 & 0.39 & 0.49 & 0.58 \\ -B4b & \textbf{1.211} & 0.22 & 3.17 & 0.43 & 0.49 & 0.60 \\ -B4c & 1.237 & 0.22 & 3.12 & 0.57 & 0.42 & 0.52 \\ -B4d & 1.254 & 0.21 & 3.14 & 0.57 & 0.47 & 0.58 \\ -\midrule -M1 & 1.286 & 0.13 & 3.14 & 0.49 & 0.50 & 0.58 \\ -\mRML & 1.272 & 0.18 & 3.12 & 0.49 & \textbf{0.52} & \textbf{0.61} \\ -\midrule -No band content & 1.224 & -- & -- & -- & -- & -- \\ -\bottomrule -\end{tabular} -\end{table} +\paragraph{Both field gates failed.} +We ran two field tests under locked protocols. On F3, with four wells, gate G-C required \mRML{} to have a lower band RMSE than the selected point tie at no fewer than three of the four blind wells, and macro coverage of its 80\% and 90\% intervals within $[0.75, 0.85]$ and $[0.85, 0.95]$. On Volve, with six deviated wells and a density-driven porosity label, gate G-D asked for the same at five of six wells under two hold-out schemes, with total RMSE on the labelled samples. Both gates failed. On F3, \mRML{} improved at one well of four, and coverage was 0.52 and 0.61. Its sensitivity variants (anchor uncertainty, scoring reference, band split, label) improved at one to three wells and never met the coverage condition. On Volve, \mRML{} improved at two (leave-one-well-out) and three (slot) of six wells, and coverage of the 90\% interval was 0.48 and 0.47. No method had skill at the Volve blind wells: $R^2$ was negative for every method, and a constant at the training-well mean of PHIF had a lower macro RMSE than every network (6.03 and 6.59\,p.u.\ under the two schemes, against 6.50 and 7.13\,p.u.\ for \mRML; post hoc). Appendix~\ref{app:field} gives the designs, all tables and the protocol deviations. Neither test is an independent replication. F3 also supplied the statistics and the warp prior of the synthetic generator (Section~\ref{sec:data:d2}), and the Volve test was designed after the F3 gate had failed. -\paragraph{All methods.} -Table~\ref{tab:f3all} lists every method under the nested design. B0a, B0b and B1 use the code of Table~\ref{tab:p1} and reproduce its values. The networks have higher total RMSE than in Table~\ref{tab:p1} (B3b: 3.07 against 2.82\,p.u.); here each model is trained on two wells rather than three, and its budget is chosen by inner validation. Only B4b had a lower macro band RMSE than a prediction with no seismic-band content (1.211 against 1.224\,p.u.). B0a, which has almost no band content, came within 1.3\% of that value, and every point tie, \mPM{} and \mRML{} lay above it. Band PCC did not exceed 0.22 for any network. On F3 the networks therefore predicted little of the seismic-band variation of the label, and G-C compared methods whose band errors were nearly the same size: without B3a, the 13 networks span 1.211--1.286\,p.u. The ranking also differs from the synthetic experiments. All four anchor-free losses, B4a--B4d, had lower macro band RMSE than every point tie, \mPM{} and \mRML, by up to 0.06\,p.u. Every probabilistic method under-covered. Macro coverage was 0.38--0.52 for the 80\% intervals and 0.44--0.61 for the 90\% intervals, and \mRML{} had the highest values of both. +\paragraph{Neither test could have detected the effect.} +After both gates had failed, we stated four conditions under which a field test of this kind bears on the synthetic result, and evaluated them without test labels. The thresholds of C1 and C2 were taken mechanically from Experiment~2, so the conditions are post hoc but were not tuned to the field results. (C1) The networks have blind-well skill within the range in which Experiment~2 found the effect: at inner-validation wells, a band PCC of at least 0.468 and an $R^2$ of at least 0.053, the smallest values reached by the best point tie in the cells that passed H2a, and a lower RMSE than a constant. (C2) The tie posterior is wide, $\sigpost \ge 1.5$\,ms, the threshold of H2b; this condition matters only for the comparison with \mPM. (C3) $\sigma_a$ is identified by independent time--depth data at three or more wells outside the test set, because a misset $\sigma_a$ removed the H2a advantage (Table~\ref{tab:sigmaa}). (C4) The number of blind wells reaches $N^\star$ (Table~\ref{tab:t3}). C2 held on both datasets, with median $\sigpost$ of 2.8\,ms on F3 and 4.3\,ms on Volve. C1 failed on both: band PCC at the inner-validation wells was 0.15 on F3 and 0.13 and 0.04 on Volve (leave-one-well-out and slot), and $R^2$ was 0.04, $-0.99$ and $-0.99$. C3 and C4 fail by construction. F3 has no independent time--depth data, and Volve has check shots at two wells. Both tests scored against marker-calibrated sonic ties of the test wells, whose errors are unknown. With four wells no sign test can reject, and with independent wells the gate rules pass with probability 0.31 (three of four) and 0.11 (five of six) when there is no true difference. The failure of either gate is therefore no evidence against the synthetic result, and a pass would not have been evidence for it. -\paragraph{Same posterior, $\sigma_a$ and scoring reference.} -The protocol prescribes four further comparisons. None can replace a G-C condition, and none was used to choose a result. Table~\ref{tab:f3sens} gives the per-well ratios. In no row did the coverage condition hold. -(a) Against \mPM, which is trained on the mean of the same SMC posterior, \mRML{} had lower band RMSE at two wells (F02-1 and F03-4) and higher band RMSE at F03-2, by 9.3\%. Its macro band RMSE was 0.003\,p.u.\ lower. -(b) With $\sigma_a = 3.5$ or 14\,ms, B3c-R, \mPM{} and \mRML{} were registered and trained again, and \mRML{} was compared with B3c-R at the same $\sigma_a$. It had lower band RMSE at one and two of the four wells, and the wells that improved were not the same in the three arms. Macro coverage was 0.47--0.48 and 0.57--0.59. -(c) When the test well is scored against the OpendTect time--depth model instead of the marker-calibrated sonic, \mRML{} again improved only at F03-4. We also scored each method against 64 warps of the test well, drawn from an anchor-only posterior whose prior was fitted on the other three wells. The 5--95\% range of band RMSE over these references was 0.06--0.15\,p.u.\ wide for \mRML{} and for B3c-R, and the ranges of the two methods overlapped at F02-1, F03-2 and F03-4. At F06-1 they did not overlap (\mRML: 1.13--1.18\,p.u.; B3c-R: 1.04--1.11\,p.u.). -(d) Moving the band cutoff to 5 or 8\,Hz changed no ratio by more than 0.01. With the original PHIE label, \mRML{} improved at three wells, but coverage was lower (0.45 and 0.50). In the window the two labels differ by an RMS of 3.2\,p.u.\ at F02-1 and by less than 0.02\,p.u.\ at the other wells. F02-1 is a training well in three of the four outer folds, and the ratios at those three test wells moved by up to 0.13. This shows how much a ratio near one depends on the label of a single training well. The gate is defined on $\mathrm{PHIE}_{\mathrm{DT}}$, and this row does not change its result. - -\begin{table}[t] -\centering -\caption{F3 sensitivity of the G-C comparison (combined ensembles, descriptive). Ratio: band RMSE of \mRML{} divided by that of B3c-R, except in the second row (\mRML{} divided by \mPM). In the $\sigma_a$ rows both methods use the stated $\sigma_a$. Coverage is that of \mRML{} and does not depend on $f_c$ (--). At F03-2 with $f_c = 5$\,Hz the ratio is 1.00002.} -\label{tab:f3sens} -\small -\begin{tabular}{lccccccc} -\toprule -Variant & F02-1 & F03-2 & F03-4 & F06-1 & improved & cov$_{80}$ & cov$_{90}$ \\ -\midrule -Registered (Table~\ref{tab:f3gc}) & 1.008 & 1.000 & 0.981 & 1.070 & 1/4 & 0.52 & 0.61 \\ -\mRML{} / \mPM & 0.970 & 1.093 & 0.941 & 1.012 & 2/4 & -- & -- \\ -$\sigma_a = 3.5$\,ms & 1.010 & 0.939 & 1.003 & 1.034 & 1/4 & 0.48 & 0.59 \\ -$\sigma_a = 14$\,ms & 0.989 & 0.959 & 1.020 & 1.035 & 2/4 & 0.47 & 0.57 \\ -OpendTect reference & 1.022 & 1.018 & 0.974 & 1.071 & 1/4 & 0.50 & 0.60 \\ -$f_c = 5$\,Hz & 1.002 & 1.000 & 0.980 & 1.079 & 1/4 & -- & -- \\ -$f_c = 8$\,Hz & 1.014 & 0.997 & 0.979 & 1.060 & 2/4 & -- & -- \\ -PHIE label & 0.992 & 0.911 & 1.025 & 0.943 & 3/4 & 0.45 & 0.50 \\ -\bottomrule -\end{tabular} -\end{table} - -\paragraph{Posterior width and anchors.} -At $\sigma_a = 7$\,ms, $\sigpost$ of the SMC posterior ranged from 1.7 to 3.6\,ms over the 12 training wells of the six training pairs (median 2.8\,ms). Seven of the 12 values lay in the range of 2.5--3.4\,ms estimated before the run from all four wells. By the rule of Experiment~2 every pair is therefore wide ($\sigpost \ge 1.5$\,ms), the regime in which RML helped at $N = 16$. Each F3 model, however, is trained on two wells, and \mRML{} beat \mPM{} at two of the four outer wells (Table~\ref{tab:f3sens}). The width followed $\sigma_a$: it was 1.2--2.3\,ms at $\sigma_a = 3.5$\,ms and 1.8--6.2\,ms at 14\,ms. Without anchors it was 17--38\,ms at F02-1, F03-2 and F03-4, and 1.4--2.0\,ms at F06-1. The wavelet phase was poorly identified. The six phases estimated at $\sigma_a = 7$\,ms spread over an arc of 214$^\circ$. Over the phases evaluated for each pair, a window 90--120$^\circ$ wide, the summed log evidence of the two wells changed by only 1.0--5.0\,nats. - -Leave-one-anchor-out $z$-scores test the anchor prior on the outer wells. For each well, a linearized Gaussian process conditioned on the anchors alone, with hyperparameters fitted on the other three wells and pick noise $\sigma_a = 7$\,ms, predicts each anchor time from the remaining anchors of that well. Of 62 held-out anchors, 61 lay inside the 90\% interval. The mean $z^2$ was 0.21 (per well: 0.20, 0.01, 0.01 and 0.59), against an expected value of 1. The anchor prior is therefore too wide rather than too narrow, the same direction as the type-II estimate of $\sigma_a$ (0.4\,ms, Section~\ref{sec:method:prior}) and the opposite direction to the under-coverage of porosity. This check does not test the calibration of the SMC posterior, which also depends on the seismic likelihood and the wavelet phase. - -\paragraph{Ablations (descriptive).} -The protocol lists twelve variants of \mRML{} on $\mathrm{PHIE}_{\mathrm{DT}}$ (Table~\ref{tab:f3abl}). They were scored like every other method, but none enters G-C. M2-anchor-only trains on the 64 anchor-only warps of M1 with the same weights, so it reproduces M1 exactly. Nine of the other eleven variants had lower macro band RMSE than \mRML. The variants spanned 1.242--1.309\,p.u., about four times the gap of 0.016\,p.u.\ between \mRML{} and B3c-R. Bank size had no consistent effect: with 1, 8, 64 and 256 SMC labels, band RMSE was 1.273, 1.256, 1.272 and 1.257\,p.u. A convolutional backbone without the GRU lowered band RMSE by about 2\% for both \mRML{} (M2-TCN) and \mPM{} (B3d-Sa-TCN), so it did not change their order. Removing the anchors (M2-no-anchors) lowered band RMSE to 1.247\,p.u.\ but gave the highest total RMSE of the variants (3.23\,p.u.). M2-fixed-sigma was the only variant with coverage close to nominal (0.87 and 0.92), and this is not calibration. Its predicted standard deviation is fixed at the standard deviation of the training labels, which gave 2.9--4.3\,p.u.\ after mixing, against 1.0--2.1\,p.u.\ for \mRML. Its 80\% intervals covered every sample at F03-2 and F03-4 and 0.74 and 0.73 of the samples at F02-1 and F06-1. The macro value is an average of these, not evidence of correct width. M2-LFM adds the low-pass mean label of the training wells as an input channel. It had the lowest total RMSE of any network (2.62\,p.u., against 2.48\,p.u.\ for B0a) and the highest band RMSE of the variants (1.309\,p.u.). Its gain lies below $f_c$, where the gate does not score. - -\begin{table}[t] -\centering -\caption{Ablations of \mRML{} on F3 (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, $\sigma_a = 7$\,ms, combined ensembles; descriptive). Macro over four wells; RMSE in p.u. M2-anchor-only is identical to M1 by construction.} -\label{tab:f3abl} -\small -\begin{tabular}{l>{\raggedright\arraybackslash}p{6.4cm}cccc} -\toprule -Variant & change from \mRML & band RMSE & RMSE & cov$_{80}$ & cov$_{90}$ \\ -\midrule -\mRML & registered method: 64 SMC labels, CNN--GRU backbone & 1.272 & 3.12 & 0.52 & 0.61 \\ -\midrule -M2-anchor-only & 64 anchor-only warps (= M1) & 1.286 & 3.14 & 0.50 & 0.58 \\ -M2-no-anchors & no anchor conditioning; prior hyperparameters at the pre-declared medians & 1.247 & 3.23 & 0.48 & 0.56 \\ -M2-bulk & sonic integration plus a constant shift, resampled by the seismic likelihood & 1.251 & 3.16 & 0.49 & 0.58 \\ -M2-lambda1 & $\lambda = 1$ instead of $1/\tau_c$ & 1.257 & 3.09 & 0.52 & 0.62 \\ -M2-S1 & 1 SMC label & 1.273 & 3.08 & 0.48 & 0.57 \\ -M2-S8 & 8 SMC labels & 1.256 & 3.11 & 0.48 & 0.59 \\ -M2-S256 & 256 SMC labels & 1.257 & 3.10 & 0.50 & 0.58 \\ -M2-fixed-sigma & $\sigma$ fixed at the training-label standard deviation & 1.242 & 3.08 & 0.87 & 0.92 \\ -M2-legacy-loss & composite loss of B2 on the bank mean added & 1.243 & 3.11 & 0.41 & 0.49 \\ -M2-TCN & four dilated convolutions, no GRU & 1.245 & 3.10 & 0.38 & 0.48 \\ -B3d-Sa-TCN & \mPM{} with the M2-TCN backbone & 1.250 & 3.13 & 0.40 & 0.49 \\ -M2-LFM & low-pass mean training label as an extra input & 1.309 & 2.62 & 0.40 & 0.50 \\ -\bottomrule -\end{tabular} -\end{table} - -\paragraph{Predicted volume (descriptive).} -A deployment ensemble of \mRML{} predicted all 649 interior inlines of the survey (Fig.~\ref{fig:f3vol}). It has 20 members: four three-well training sets $\times$ five seeds. The map shows sonic-derived porosity and its ensemble standard deviation. Away from the wells there is no ground truth, and three of the four training sets include any given well, so the prediction at a well is not blind. The same kind of ensemble under-covered at the outer wells, so its standard deviation is not a calibrated error bar. Over the $649 \times 949$ interior traces and the 600--1100\,ms window, the median of the predicted mean was 29.6\,p.u.\ (5--95\% of samples: 27.9--31.5\,p.u.). The median standard deviation was 1.3\,p.u.\ (5--95\%: 0.8--2.5\,p.u.). It was larger above 700\,ms (median 2.0\,p.u.) than below (1.2\,p.u.). Even the median standard deviation is less than half the total RMSE of \mRML{} at the outer wells (3.12\,p.u.). - -\begin{figure}[t] -\centering -\includegraphics[width=\linewidth]{f3_volume.pdf} -\caption{Descriptive prediction of sonic-derived porosity ($\mathrm{PHIE}_{\mathrm{DT}}$) on F3 inline 442, through F03-4 (dashed line): (a) mean and (b) standard deviation of the 20-member \mRML{} deployment ensemble. Colour limits: 1st--99th percentile of the section for (a), 0 to the 99th percentile for (b). Three of the four training sets include F03-4, so the prediction at the well is not blind. Intervals from this kind of ensemble under-covered at the outer wells (Table~\ref{tab:f3gc}).} -\label{fig:f3vol} -\end{figure} - -\paragraph{Execution.} -The run stopped once, after 132 of 649 volume inlines, when the operating system refused to replace a progress-display file. By then the gate had been computed. Only volume inference was resumed, with the locked code and models. Registration, training and scoring were not rerun, and the 132 inlines written before the stop were verified to be unchanged. - -\subsection{Second field dataset} -\label{sec:exp:volve} - -\todoblock{Volve results (gate G-D): same nested protocol, porosity from density--neutron (independent of sonic), comparison of \mPM{} and \mRML{} with the best point tie. If Volve is cut, delete this subsection and every reference to it.} +\paragraph{Limits of field validation.} +A dataset with more wells does not by itself remove the constraint. After the field tests we inventoried Teapot Dome (NPR-3, Wyoming; \citealp{bader2017teapot}), where 152 wells inside the 3-D survey have density logs across a common target interval. This step is post hoc and exploratory. Its conditions were declared before the data were obtained, and the alternative reference described next was declared after the inventory but before any residual or porosity value was computed. Time--depth tables exist at four wells. Three are labelled as derived from synthetic seismograms, and the fourth, a vertical seismic profile, ends above the main reservoirs. Even counting one of the three as independent, at most two wells have an independent time--depth reference, against the $3 + 11$ that C3 and C4 need at Rm5. As an alternative reference, we paired the times of two interpreted 3-D horizons at the wells with the depths of the corresponding formation tops. On 37 development wells we predicted each time from the depth with a quadratic lateral trend of average velocity, fitted by leave-one-out. The residual standard deviation was 6.75\,ms (90\% bootstrap interval over wells 4.1--9.4\,ms; robust estimate 5.0\,ms). Most of it was a bulk shift per well (6.6\,ms): the residuals of the two horizons at a well were correlated (0.85), and those of neighbouring wells were not. The shift is therefore not a smooth velocity change that the trend missed; it resembles per-well errors of datum, statics or top picks. The differential part was 2.8\,ms, and 2.5\,ms from the sonic at five wells. Every estimate exceeded the declared tolerance of 1.5\,ms, the largest grid value at which the Rm5 cell with $N = 16$ reaches a power of 0.8 with no more than the 115 remaining wells. We therefore stopped before reading any porosity value. One dataset is not a survey, but in this one the binding constraint on field validation was the error of the scoring reference, not the number of wells. diff --git a/paper/sections/07_discussion.tex b/paper/sections/07_discussion.tex index 4a1d6eb..76660b5 100644 --- a/paper/sections/07_discussion.tex +++ b/paper/sections/07_discussion.tex @@ -2,30 +2,32 @@ \label{sec:discussion} \paragraph{What the synthetic experiments show.} -The two experiments separate two questions that are easy to conflate. The first is whether the tie posterior is informative. The second is whether training on it helps. In Experiment~1 the posterior was not informative: 64 anchor-conditioned samples reweighted by tie likelihoods stayed as wide as the anchors allowed. Labels drawn from it were no better than a good correlation-based point tie. Once the posterior contracted (SMC, Experiment~2), labels at its mean beat every point tie in all three full-anchor regimes, and a bank of its samples gained further when the posterior was wide. Better registration of the training labels came first. Marginalizing over what remained then added a smaller, width-dependent gain. Neither result says that marginalization rescues a poor posterior. Experiment~1 is direct evidence that it does not. +The two experiments separate two questions that are easy to conflate. The first is whether the tie posterior is informative. The second is whether training on it helps. In Experiment~1 the posterior was not informative: 64 anchor-conditioned samples reweighted by tie likelihoods stayed as wide as the anchors allowed, and labels drawn from them were no better than a good correlation-based point tie. Once the posterior contracted (SMC, Experiment~2), labels at its mean beat every point tie in all three full-anchor regimes, and a bank of its samples gained further when the posterior was wide. Better registration of the training labels came first. Marginalizing over what remained then added a smaller, width-dependent gain. Neither result says that marginalization rescues a poor posterior, and Experiment~1 is direct evidence that it does not. + +\paragraph{Where the bank gain comes from.} +The theory gives a population limit, and whether the measured gains exceed it depends on the structure of the tie error. In population, a calibrated bank has the minimizer of training on the true labels (Proposition~\ref{prop:bank}), and no method improves on a point label by more than the factor $\rho^\star$ of \eqref{eq:rhostar}. Its distortion term is of fourth order in the tie error. For the Oracle predictions of Experiment~2 it sits near 70\,Hz, where a Berkson error distorts much more than a classical error of the same width (Section~\ref{sec:theory:post}). Under the registered bound for classical error, \mRML{} gained more than the limit allows in 7 of the 8 wide cells at $N = 16$. Under the bound for Berkson error, the natural idealization for labels at the posterior-mean warp, it did so in 3 cells at the posterior width and in at most 1 at the measured warp error of \mPM{} (Section~\ref{sec:exp:p2r}). In most cells the bank gain is therefore no larger than removing a population sharpening of \mPM{} could give, but this rests on an error structure that was not tested. On synthetic data the covariance test of Section~\ref{sec:theory:post} can settle it (Section~\ref{sec:exp:mech}). Finite-sample effects can add to this population effect or outweigh it: the label error itself is of first order, and its effect on the conditional variance that a network must absorb is of second order, against the fourth-order population distortion (Section~\ref{sec:theory:post}). Part of the gap to the Oracle is not caused by registration at all. At $c = 0$, with SMC warp errors of 0.2--0.7\,ms, the Oracle was still 1--3\% better than \mPM{}, and it was trained twice as long. \mRML{} closed 27--46\% of the gap between \mPM{} and the Oracle at $c = 1$, and it did not reach the Oracle in any wide cell at $N = 16$. Beyond the population correction, three mechanisms could contribute to the bank gain. The bank acts as label augmentation, and the learned variance absorbs its spread. For $\lambda > 0$ the responsibilities re-register the labels during training (Remark~\ref{rem:lambda}). A multimodal posterior gives the mean warp a non-Gaussian error, against which a bank can gain more than the Gaussian bound allows (Corollary~\ref{cor:twomode}). Until the exploratory analysis of Section~\ref{sec:exp:mech} is done, the bank gain is an empirical regularity of this benchmark whose source is not identified. \paragraph{When to use a bank rather than the posterior mean.} -When the posterior is narrow ($\sigpost < 1.5$\,ms), RML and posterior-mean labels are equivalent within 1\% on average. RML costs little there, but it also brings no benefit. When the posterior is wide, because of low SNR, sparse anchors or strong drift, RML helped in every wide cell at $N = 16$. The size of the gain follows the posterior width. The largest gain came with sparse anchors (R10tb), where the posterior was also overconfident. The bank is cheap: 64 labels per window add little to training cost. A practical rule is therefore to train with the bank whenever the tie posterior is wider than about 1.5\,ms. On real data this width cannot be checked against a true warp. It depends on $\sigma_a$ (next paragraph). +Within this benchmark the answer depends on the posterior width. When the posterior is narrow ($\sigpost < 1.5$\,ms), \mRML{} and \mPM{} are equivalent within 1\% on average, so the bank costs little and brings nothing. When the posterior is wide, because of low SNR, sparse anchors or strong drift, \mRML{} passed in all eight wide cells at $N = 16$, and over all cells at $N = 16$ the gain grew with the width (Spearman $\rho = -0.85$). The bank is cheap: 64 labels per window add little to the cost of training. A practical rule is therefore to train with the bank whenever the tie posterior is wider than about 1.5\,ms. The largest gain at $c = 1$ came with sparse anchors (R10tb), where the posterior was overconfident and the bank was narrower than the error it was meant to represent, so in that regime the bank helped without being calibrated. On real data the width cannot be checked against a true warp, and it depends on $\sigma_a$. \paragraph{The anchor uncertainty is the main risk.} -Every positive result in Experiment~2 assumes that $\sigma_a$ is known. Halving or doubling it removed the H2a advantage in every cell, and it miscalibrated the posterior in both directions. On F3 the time--depth markers are horizon-tie picks on the same seismic. A type-II estimate treats them as exact (0.4\,ms), while the marker--horizon spread suggests 7\,ms. These two values place F3 at opposite ends of the $\sigpost$ axis: about 0.6\,ms (narrow, like R10) or 2.5--3.4\,ms (wide, close to Rm5). The synthetic results therefore do not predict the F3 outcome. Independent check shots, or anchors from a second source (for example, horizons picked on a different volume), would be needed to pin down $\sigma_a$. On F3 we kept the registered 7\,ms, at which $\sigpost$ was 1.7--3.6\,ms, and ran arms at 3.5 and 14\,ms (Table~\ref{tab:f3sens}). \mRML{} beat the selected point tie at one, one and two of the four wells, and coverage failed in all three arms. The field data did not discriminate between these values, and none of them made the result positive. +Every positive result of Experiment~2 assumes that $\sigma_a$ is known. Halving or doubling it removed the H2a advantage in every cell and miscalibrated the posterior in both directions (Table~\ref{tab:sigmaa}). On F3 the time--depth markers are horizon-tie picks on the same seismic. A type-II estimate treats them as exact (0.4\,ms), while the spread between markers and horizons suggests 7\,ms. The two values place F3 at opposite ends of the $\sigpost$ axis, at about 0.6\,ms (narrow, like R10) or 2.5--3.4\,ms (wide, close to Rm5), and the arms at 3.5 and 14\,ms did not change the F3 outcome (Appendix~\ref{sec:exp:f3}). The width that decides between \mPM{} and \mRML{} inherits this dependence. An estimate of $\sigma_a$ from independent time--depth data at wells outside the test set is therefore a precondition for using the tie posterior, not a refinement of it. -\paragraph{Why the RML gain is not explained by the theory.} -Proposition~\ref{prop:blur} bounds what a bank can recover from a Gaussian-blurred posterior mean. In 7 of 8 wide cells, RML gained more than that bound allows. The extra gain is real in the sense that it passed the pre-registered rule, but its cause is open. Label augmentation, which regularizes a network trained on few wells, and bias of the posterior mean under multimodality are both plausible. Separating them needs an experiment in which the bank is replaced by random perturbations of matched size. We did not run it. +\paragraph{What a field test of registration needs.} +Proposition~\ref{prop:reference} and the detectability analysis (Section~\ref{sec:exp:detect}) turn the field failures into four requirements. They are derived under the simulator of the benchmark. First, the scoring reference must be independent of the seismic and accurate to about 1\,ms. To leading order, the measured advantage has the sign of the true one only if the reference error is below $1/\sqrt2$ times the tie error that the comparison is meant to detect (Corollary~\ref{cor:tolerance}), and power is lost well before that point. With an exact reference, a sign test reached a power of 0.8 with 5--18 blind wells in five of the six cells. At 1\,ms it needed 11--30 wells in four cells, and at 3\,ms or more no cell reached that power with 40 wells. Check shots or a vertical seismic profile can meet this requirement once their datum and statics are reconciled with the seismic. A reference tied by synthetic--seismic matching on the same seismic cannot, because its error is not independent of the predictions. Second, the number of blind wells should follow from a power analysis at the expected effect, and the pass rule should be a test. A rule of $k$ of $n$ wells is not one: with independent wells and no true difference, three of four passes with probability 0.31 and five of six with probability 0.11, and no one-sided sign test at $\alpha = 0.05$ can reject with four wells. Third, $\sigma_a$ must be estimated outside the test set (previous paragraph). Fourth, the networks must have skill in the seismic band at blind wells before registration can matter there. The two field cases that we tested meet none of the four. Teapot Dome, the one large dataset that we inventoried, has 152 wells but fails the first and the third: at most two of its wells have an independent time--depth reference, and the best reference that we could build from horizons and formation tops had a per-well error of 5--7\,ms (Section~\ref{sec:exp:scope}). + +\paragraph{What the field cases show.} +Both field gates failed, but in neither case was the timing of the training labels what limited the error at the blind wells. On F3 the networks followed the low-frequency trend (total PCC about 0.5) but predicted little of the seismic band. The macro difference in band RMSE between \mRML{} and B3c-R, 0.016\,p.u., was an eighth of the variation between seeds (up to 0.13\,p.u.) and smaller than the shift produced by plausible alternative scoring references (up to 0.15\,p.u.). Two contrasts with the synthetic results suggest that the F3 band score was insensitive to the timing of the labels, although we did not test this. Without anchors, band RMSE nearly doubled in the synthetic test of H4 but fell slightly on F3 (1.247 against 1.272\,p.u.). The shift-bank losses B4a and B4b, 38--53\% worse than B3b in Experiment~1, had a lower band RMSE than every point tie on F3. The F3 label is, moreover, a linear function of the sonic at three of the four wells, so label and time axis share a source, which violates (A1). On Volve, whose label is density-driven, the error was dominated by the level of porosity, whose well means span 8.5\,p.u. The tie methods changed the macro RMSE by at most 0.25\,p.u.\ out of 6--7\,p.u., and a constant at the training-well mean beat every network (Appendix~\ref{sec:exp:volve}). Neither case is evidence against the synthetic results, and neither is evidence for them. They bound the scope of the paper: its claims about learning rest on the benchmark, and its claims about the field concern what a test there would need. \paragraph{Limitations.} \begin{itemize} - \item \textbf{Labels on F3 are sonic.} At three of four wells, the F3 porosity label is an exact linear function of DT. Learning it from seismic is learning a sonic-derived quantity, and the label and the time axis share a source, which violates (A1). The second field dataset is meant to address this. \todo{Volve: porosity from density--neutron.} - \item \textbf{A trend is the strongest F3 baseline.} No learned model beat B0a in total RMSE on F3, either in the baseline run or under the nested design (Tables~\ref{tab:p1} and~\ref{tab:f3all}). Under the nested design only B4b had a lower band RMSE than a prediction with no seismic-band content, and no network had a band PCC above 0.22. With two or three training wells, the networks learned little of the seismic-band variation of the label. + \item \textbf{One simulator.} Every confirmatory result comes from one generator, whose statistics and warp prior were estimated on F3. The registration methods use the warp family and the wavelet of the generator. They differ from it only in the prior hyperparameters, which are fitted to the training anchors or fixed, and in the estimated wavelet phase, so a misspecified warp family or wavelet has not been tested. \todo{S2 of \texttt{protocol\_bench} (three misspecification axes). If S2 is not locked and run before submission, call the study a controlled synthetic study, not a benchmark, throughout.} + \item \textbf{Experiment~2 is a deviation.} It was pre-registered and run on new realizations, but it was designed after Experiment~1 had failed, and re-running was not among the options registered for that failure (Section~\ref{sec:exp:diag}). \item \textbf{Strong drift.} At $c = 2$ the SMC posterior was multimodal and its mean was unstable between runs. These cells are reported but are not evidence. - \item \textbf{Untested stresses.} The bulk-offset prior $\sigma_b$ was not varied. Rock-physics misspecification between training and test areas was not tested. The anchor-free baselines B4a--B4d were not rerun in Experiment~2. + \item \textbf{Untested stresses.} The bulk-offset prior $\sigma_b$ was not varied, and the anchor-free losses B4a--B4d were not rerun with the SMC posterior. \todo{S3 (B4 under the SMC posterior) and S8 (controlled cycle-skip regime).} \item \textbf{Monte Carlo variability.} At low SNR the SMC run-to-run stability criterion failed in one of four development cells at $c = 1$, mainly through the phase estimate. This variability is small relative to $\sigpost$, but it was not removed. - \item \textbf{Uncertainty quantification.} Seed ensembles under-covered for every method, and more so for better labels. On F3 every probabilistic method under-covered as well (macro 80\% coverage 0.38--0.52). Propagating the tie posterior to predictive uncertainty at a new well needs a different mechanism, for example predicting in depth through the warp posterior. We did not attempt this. + \item \textbf{Uncertainty quantification.} Seed ensembles under-covered for every method ($\xi$ of 0.19--0.66 at R10, $c = 1$, $N = 16$), and more so for better labels and longer training. Because training length and label source are confounded, parts (b) and (c) of Proposition~\ref{prop:coverage} remain untested. On F3 the macro 80\% coverage of every probabilistic method was 0.38--0.52, and on Volve 0.29--0.39. Carrying the tie posterior to predictive uncertainty at a new well needs a different mechanism, for example prediction in depth through the warp posterior. We did not attempt this. \item \textbf{The tempering $\lambda$.} $\lambda = 1/\tau_c$ is a heuristic fixed in advance. We did not compare it with alternatives and make no claim about it. - \item \textbf{One backbone.} All learned methods share one CNN--GRU; only two F3 ablations used a second, purely convolutional backbone (Table~\ref{tab:f3abl}). Assumption (B) of Proposition~\ref{prop:ident} holds only approximately for it. + \item \textbf{One backbone.} All learned methods share one CNN--GRU; only two F3 ablations used a second, purely convolutional backbone (Table~\ref{tab:f3abl}). Assumption (B) of Proposition~\ref{prop:ident} holds only approximately for it. \todo{S4 (second backbone).} + \item \textbf{Detectability.} Section~\ref{sec:exp:detect} rescored predictions with the skill of Experiment~2 against references whose errors are smooth and independent of the predictions. Its numbers of wells hold for predictors of comparable skill. A reference tied on the same seismic adds a covariance with the predictions that we did not model. \end{itemize} - -\paragraph{The F3 field test.} -On the four F3 wells the direction found in Experiment~2 was not reproduced. \mRML{} beat the selected point tie at one well of four, and its intervals under-covered badly (Section~\ref{sec:exp:f3}). Three features of the F3 results bear on how to read this failure. We did not test any of them as an explanation. First, the posterior was wide by the rule of Experiment~2 ($\sigpost$ of 1.7--3.6\,ms), but each model was trained on two wells, and the networks predicted little of the seismic band: only B4b had a lower band RMSE than a prediction with no band content. Second, the difference being tested was small compared with other sources of variation. The macro gap between \mRML{} and B3c-R was 0.016\,p.u. Between seeds, the macro band RMSE of each method varied by up to 0.13\,p.u. The ablations of \mRML{} spanned 0.07\,p.u., and plausible alternative scoring references moved the band RMSE of a method by up to 0.15\,p.u. Third, $\sigma_a$ was not identified. The arms at 3.5 and 14\,ms did not change the outcome, and the leave-one-anchor-out check found the anchor prior at 7\,ms too wide (mean $z^2$ of 0.21), the same direction as the type-II estimate. Two contrasts with the synthetic experiments point the same way. Without anchors, band RMSE nearly doubled in the synthetic test of H4 but fell slightly on F3 (1.247 against 1.272\,p.u.). The shift-bank losses B4a and B4b, 38--53\% worse than B3b in Experiment~1, had lower band RMSE than every point tie on F3. Both contrasts would be expected if the F3 band score were insensitive to the timing of the labels, but we did not test this. A field test that can separate methods whose band errors differ by about 1\% needs more wells, a scoring reference that does not depend on the tie, or both. The predicted volume shows where the ensemble members disagree. Given the under-coverage at the outer wells, its standard deviation is not an error bar. - -\todoblock{Discussion of Volve results (gate G-D): whether the direction holds with a label that does not depend on sonic, and how this changes the reading of the F3 failure. Write this paragraph whatever the outcome, including a failure of G-D.} diff --git a/paper/sections/08_conclusion.tex b/paper/sections/08_conclusion.tex index e1d79ff..1b209f0 100644 --- a/paper/sections/08_conclusion.tex +++ b/paper/sections/08_conclusion.tex @@ -1,13 +1,26 @@ \section{Conclusions} \label{sec:conclusion} -A well tie is an uncertain estimate, yet learning workflows treat it as exact. Under an independence assumption, training with misregistered labels convolves the optimal predictor with the distribution of the timing error, and a variance-matching loss cannot undo this. A controlled experiment matched the predicted transfer function to within 1\% for errors up to 16\,ms. Without time anchors, a shared network and its label alignment can shift together without changing the loss, so alignment losses alone do not fix absolute timing. With anchors, the tie posterior can be used directly in training. On a synthetic benchmark calibrated to F3, our first pre-registered test of this idea failed because the posterior was not informative. In the second test, with a sequential Monte Carlo tie posterior, labels at its mean beat the best point tie by 8--22\% in seismic-band RMSE. RML on its samples improved further when the posterior was wide. Both gains required a correctly specified anchor uncertainty. +A well tie is an uncertain estimate, yet learning workflows treat it as exact. Its error is an error in the time index of the label. Under an independence assumption, the error convolves the optimal predictor with its distribution and blurs the seismic band, and without time anchors the absolute timing of a network and its label alignment is not identified. An estimated tie can have the classical error structure, which blurs the learned predictor, or the Berkson structure, which sharpens it. A calibrated bank of posterior labels removes both biases in population, but its population gain over a point label is of fourth order in the tie error. -On the four F3 wells, a pre-registered nested leave-one-well-out test failed. RML beat the selected point tie at one well of four, and its predictive intervals under-covered. With two training wells per model, the networks predicted little of the seismic band, and the differences between methods were smaller than the variation between seeds. The synthetic gains are therefore not confirmed on field data. -\todo{One or two sentences on Volve (gate G-D), in either direction, and the final take-home statement.} +On a registration-aware synthetic benchmark calibrated to F3, the first pre-registered comparison failed because the anchor-only posterior was not informative. In the second, designed after that failure, labels at the mean of a sequential Monte Carlo tie posterior beat the best point tie by 8--22\% in seismic-band RMSE, provided that the anchor uncertainty was correctly specified. Training on the posterior bank gained further when the posterior was wide. Under the Berkson error structure that is natural for a posterior-mean tie, the gain stayed within the population limit in most cells. That structure was not tested, and the experiments do not separate the population effect from finite-sample effects of the bank. + +Whether such gains hold on field data is a question that the public datasets we examined cannot answer. A blind-well comparison of tie methods needs a reference that is independent of the seismic and accurate to about 1\,ms, enough blind wells for a test with adequate power, an anchor uncertainty estimated outside the test set, and networks with skill in the seismic band. The F3 and Volve tests met none of these conditions and failed, and Teapot Dome has independent time--depth references at no more than two of its 152 wells. We claim no improvement on field data and no calibrated uncertainty. The benchmark, the locked protocols and the detectability analysis are the means to test such claims once a dataset that meets these conditions is available. \paragraph{Data and code availability.} -The F3 Netherlands data are publicly available from dGB Earth Sciences under a CC BY-SA 3.0 licence. The Volve data are available from Equinor under a CC BY-NC-SA 4.0 licence. The code, locked protocols, synthetic generator configurations and the scripts that produce every table and figure are available at \todo{repository URL and archived DOI}. +The F3 Netherlands data are publicly available from dGB Earth Sciences under a CC BY-SA 3.0 licence. The Volve data are available from Equinor under a CC BY-NC-SA 4.0 licence. The Teapot Dome data (RMOTC, U.S.\ Department of Energy) are available from the Texas Data Repository \citep{bader2017teapot}. \todo{Verify the three licences on the providers' pages at submission (Teapot: recorded as CC0 in the project notes).} The code, locked protocols, synthetic generator configurations and the scripts that produce every table and figure are available at \todo{repository URL and archived DOI}. + +\paragraph{Computer code availability.} +\todo{Required by Computers \& Geosciences. Fields in the journal's template (unverified against the current guide): name of the code; developers and contact (e-mail, phone); year first available; hardware requirements (development on an NVIDIA RTX 3060 12\,GB and an H200); software required (Python 3.12, PyTorch; give the versions of the environment locks); program language; program size; licence; repository link.} + +\paragraph{CRediT authorship contribution statement.} +\todo{Author contributions.} + +\paragraph{Declaration of competing interest.} +\todo{Competing interests.} + +\paragraph{Declaration of generative AI and AI-assisted technologies.} +\todo{Elsevier requires authors to disclose the use of generative AI in preparing the manuscript. The authors must write this statement.} \paragraph{Acknowledgements.} \todo{Acknowledgements and funding.} diff --git a/paper/sections/A_proofs.tex b/paper/sections/A_proofs.tex index e6edddc..bc18670 100644 --- a/paper/sections/A_proofs.tex +++ b/paper/sections/A_proofs.tex @@ -27,6 +27,47 @@ For $a > 0$, $h^\star$ has the same PCC and band PCC as $\hat y^\star$, and its \subsection{Proposition~\ref{prop:ident}} Since $t_{u + \beta e_b}(z) = t_u(z) + \beta$, we have $z_{u+\beta e_b}(t) = z_u(t - \beta)$ and hence $y^{u + \beta e_b} = T_\beta y^u$. By (B), $\mu_{\theta'} = T_\beta\mu_\theta$ and $\sigma_{\theta'} = T_\beta\sigma_\theta$. The Gaussian log-likelihood on a window $I$ is $\sum_{i\in I}\log\N(y(t_i - \beta); \mu(t_i-\beta), \sigma^2(t_i-\beta))$, which is the log-likelihood on the window $I - \beta$. Summed over windows that tile the trace, the two objectives differ only at edge samples. The log-sum-exp of RML preserves this invariance, because every bank member is shifted by the same amount. The prior on $g$ is unchanged, because $g$ is unchanged. This proves (a). Parts (b) and (c) follow by direct computation from $t_{u+\beta e_b}(z_{wk}) = t_{u_w}(z_{wk}) + \beta$. The prior adds $-\sum_w (b_w + \beta)^2/(2\sigma_b^2)$, with curvature $N/\sigma_b^2$. The anchors add $-\sum_{w,k}(t_{wk} - t_{u_w}(z_{wk}) - \beta)^2/(2\sigma_a^2)$, with curvature $\sum_w K_w/\sigma_a^2$. The expression for $\sd(\beta)$ is the inverse square root of the total curvature, that is, a quadratic approximation along the ridge. \hfill$\square$ +\subsection{Proposition~\ref{prop:tie}} +(a) Conditional on $X$ and $\delta(t) = d$, independence gives $\E[y(t+d)\mid X, \delta(t) = d] = m(t+d)$ and $\E[y(t+d)^2\mid X, \delta(t) = d] = \E[y(t+d)^2\mid X]$. Integrating over $p_t(\cdot\mid X)$ (Fubini, using (A2)) gives $\tilde m(t)$ and $\E[\tilde y(t)^2\mid X] = \int p_t(d\mid X)\{\Var(y(t+d)\mid X) + m(t+d)^2\}\dd d$. Subtracting $\tilde m(t)^2$ gives the variance. + +(b) $\tilde y$ is a function of $D$ because $\hat u$ is. Since $\varepsilon(t)$ is independent of $D$ given $X$, $\E[y(t)\mid D] = \E[\tilde y(t + \varepsilon(t))\mid D] = \int q_t(e\mid X)\,\tilde y(t+e)\dd e$, and in the same way $\E[y(t)^2\mid D] = \int q_t(e\mid X)\,\tilde y(t+e)^2\dd e$. Because $X$ is a function of $D$, the tower property gives $m(t) = \E\big[\E[y(t)\mid D]\mid X\big] = \int q_t(e\mid X)\,\tilde m(t+e)\dd e$, and the same for the second moment. Subtracting $m(t)^2$ gives the variance. + +If $p_t = p(\cdot\mid X)$ does not depend on $t$, the window average of $\int p(d\mid X)\Var(y(t+d)\mid X)\dd d$ is $\int p(d\mid X)\,|W|^{-1}\!\int_{W+d}\Var(y(s)\mid X)\dd s\dd d$, which equals the window average of $\Var(y\mid X)$ up to contributions from the edges of the window $W$. Since $\Var_p[m(t+d)] \ge 0$, the window average of $\Var(\tilde y\mid X)$ is at least that of $\Var(y\mid X)$. Case (b) is the same with $y$ and $\tilde y$ exchanged. The Fourier statements follow as in Proposition~\ref{prop:blur}. For zero-mean Gaussian $\varepsilon$, $Q = e^{-2\pi^2\sigma^2 f^2} > 0$, so the transform of $\tilde m$ is $\hat m/Q$. \hfill$\square$ + +\subsection{Proposition~\ref{prop:bank}} +(a) Take $G(u, D) = y^u(t)$, which depends on $D$ through the logs. Calibration gives $\bar y(t) = \E[y^{u^\star}(t)\mid D] = \E[y(t)\mid D]$, and the tower property gives $\E[\bar y(t)\mid X] = m(t)$. + +(b) Take $G(u, D) = \ell\big(y^u; \mu_\theta(X), \sigma_\theta(X)\big)$, a function of $(u, D)$ because $X$ is a function of $D$. Calibration gives $\sum_s \pi_s\ell_s = \E[\ell^\star\mid D]$, and taking expectations gives the claim. By Lemma~\ref{lem:sandwich}, $\RML_\lambda \to -\frac1n\sum_s\pi_s\ell_s$ as $\lambda \to 0$, so for every $\theta$ the limit has the expectation of the Gaussian negative log-likelihood on the true labels. Over functions of $X$, the latter is minimized sample by sample at $\mu_i = \E[y(t_i)\mid X]$ and $\sigma_i^2 = \Var(y(t_i)\mid X)$. For the MSE, $\E[\bar y - m\mid X] = 0$ by (a), so $\E(h - \bar y)^2 = \E(h - m)^2 + \E(m - \bar y)^2$ for every function $h$ of $X$. + +The expansion of $\bar y - y^{\bar u}$ in Section~\ref{sec:theory:post} is Taylor's theorem in $u$; the first-order term vanishes because $\sum_s \pi_s (u_s - \bar u) = 0$. \hfill$\square$ + +\subsection{Corollary~\ref{cor:twomode}} +The characteristic function of $\pm\Delta/2$ with equal probabilities is $\frac12\big(e^{i\pi f\Delta} + e^{-i\pi f\Delta}\big) = \cos(\pi f\Delta)$, which is negative for $\pi/2 < \pi|f|\Delta < 3\pi/2$. Under (a) the transfer from $m$ to $\tilde m$ is $P$; under (b) it is $1/Q$, which has the sign of $Q$. A zero-mean Gaussian with variance $\Delta^2/4$ has characteristic function $e^{-2\pi^2(\Delta^2/4)f^2}$. The calibrated bank is covered by Proposition~\ref{prop:bank}(a). For the shifted bank, $\bar y(t) = \frac12\big[\tilde y(t + \Delta/2) + \tilde y(t - \Delta/2)\big]$, so $\E[\bar y\mid X]$ is $\tilde m$ filtered by $\cos(\pi f\Delta)$, that is, $m$ filtered by $\cos^2(\pi f\Delta)$. \hfill$\square$ + +\subsection{Remark~\ref{rem:lambda} and Equation~\texorpdfstring{\eqref{eq:rhostar}}{(\ref{eq:rhostar})}} +For a finite bank, $\log\E_\pi e^{\lambda\ell} = \lambda\E_\pi\ell + \frac{\lambda^2}{2}\Var_\pi\ell + O(\lambda^3)$; dividing by $-\lambda n$ gives the expansion in Remark~\ref{rem:lambda}. + +$B$ is linear, so $B(h - y) = B(h - m) + B(m - y)$. Here $B(h - m)$ is a function of $X$ and $\E[B(m - y)\mid X] = B\,\E[m - y\mid X] = 0$, so the cross term vanishes. Setting $h = \tilde m$ gives \eqref{eq:rhostar}. The transform of $\tilde m - m$ is $(P - 1)\hat m$ under (a) and $(1/Q - 1)\hat m$ under (b). For Gaussian errors let $x = 2\pi^2\sigma^2 f^2$. Then $(1 - e^{-x})^2 = x^2 + O(x^3)$, $(e^{x} - 1)^2 = x^2 + O(x^3)$, and their ratio is $e^{2x}$. At $\sigma = 2.5$\,ms and $f = 25$\,Hz, $e^{2x} = 1.167$. \hfill$\square$ + +\subsection{Proposition~\ref{prop:coverage}} +(a) $\xi_j - \xi_O = (v_j w_O - v_O w_j)/(w_j w_O)$, and $v_j w_O - v_O w_j = \Delta v\, w_O - v_O\, \Delta w$. Dividing by $w_j w_O$ gives the identity. + +(b) Let $V = \E\Var(y\mid X)$. For the oracle, $v_O = w_O = V$. By (A1) and stationarity, $\E\tilde y^2 = \E y^2 = V + \E m^2$, so $v_j = \E\tilde y^2 - \E\tilde m^2 = V + \int(1 - P^2)S_m\dd f$. By the orthogonality used for \eqref{eq:rhostar}, without the band operator, $w_j = V + \E(\tilde m - m)^2 = V + \int(1 - P)^2S_m\dd f$. Hence $\Delta v - \Delta w = \int[(1 - P^2) - (1 - P)^2]S_m\dd f = 2\int P(1 - P)S_m\dd f$, and (a) with $\xi_O = 1$ gives the result. + +(c) By orthogonality, $w_j = V + \E(\tilde m - m)^2 \ge V$. By Proposition~\ref{prop:tie}(b), $\Var(y(t)\mid X) \ge \int q(e\mid X)\Var(\tilde y(t+e)\mid X)\dd e$. Averaging over the window and taking expectations as in the proof of Proposition~\ref{prop:tie}, $V \ge \E\Var(\tilde y\mid X) = v_j$, so $\xi_j \le 1$. A calibrated bank has the population optimum of the oracle (Proposition~\ref{prop:bank}), so $\xi = 1$. + +For the coverage statement, $\Pr(|y - \mu| \le zs) = \Pr(|Z| \le z\sqrt\xi) = 2\Phi(z\sqrt\xi) - 1$. \hfill$\square$ + +\subsection{Proposition~\ref{prop:reference}} +Because $B$ is linear and time-invariant and $\varepsilon_r$ is constant over the window, $By_{\mathrm{ref}}(t) = (By)(t + \varepsilon_r)$. By independence and stationarity, $\E|By_{\mathrm{ref}}|^2 = \E|By|^2$ and +\begin{equation*} +\E\big[B\hat y(t)\; By(t + \varepsilon_r)\big] = \E_{\varepsilon_r}\!\int_{|f|\ge f_c} S_{\hat y y}(f)\, e^{i2\pi f\varepsilon_r}\dd f = \int_{|f|\ge f_c} S_{\hat y y}(f)\, Q_r(f)\dd f . +\end{equation*} +Expanding both squares, the two MSEs differ only in the cross term, $-2\int S_{\hat y y}Q_r\dd f$ against $-2\int S_{\hat y y}\dd f$ over $|f| \ge f_c$. The difference is real, so it equals its real part. \hfill$\square$ + +\subsection{Corollary~\ref{cor:tolerance}} +The expression for $G_r - G$ is \eqref{eq:refbias} applied to both methods. As in the proof of Corollary~\ref{cor:band}, $S_{my} = S_m$, so $S_{\hat y_A y} = HS_m$ and $S_{\hat y_B y} = HPS_m$. For $\hat y = Lm$ with a real filter $L$, $\E|B(\hat y - y)|^2 = \int_{|f|\ge f_c}(L^2 - 2L)S_m\dd f + \E|By|^2$. The difference between $L = HP$ and $L = H$ is $G$, and adding $G_r - G = -2\int_{|f|\ge f_c} H(1 - P)(1 - Q_r)S_m\dd f$ gives $G_r$. Both factors of the integrand of $G$ are non-negative when $0 \le H, P \le 1$. For Gaussian errors, $P = 1 - 2\pi^2\sigma^2f^2 + O(f^4)$ and $Q_r = 1 - 2\pi^2\sigma_r^2f^2 + O(f^4)$. The over-sharp case follows by substituting $S_{\hat y_B y} = HKS_m$. \hfill$\square$ + \subsection{Lemmas~\ref{lem:s1}--\ref{lem:sdtw}} \paragraph{Lemma~\ref{lem:s1}.} If all $\ell_s = \ell$, then $\log\sum_s\pi_s e^{\lambda\ell} = \lambda\ell$. \hfill$\square$ diff --git a/paper/sections/B_field.tex b/paper/sections/B_field.tex new file mode 100644 index 0000000..a96e05d --- /dev/null +++ b/paper/sections/B_field.tex @@ -0,0 +1,272 @@ +\section{Field cases in detail} +\label{app:field} + +This appendix reports the two field tests in full. Section~\ref{sec:exp:scope} summarizes them and states what they can and cannot show. Both protocols were locked before their main runs; both gates failed, and nothing was changed after the test wells were scored. + +\subsection{F3 field data (gate G-C)} +\label{sec:exp:f3} + +\paragraph{Baselines.} +Table~\ref{tab:p1} gives leave-one-well-out results for the baselines on F3. The label is $\mathrm{PHIE}_{\mathrm{DT}}$, and the reference is the marker-calibrated sonic of the test well. The test well contributes nothing to training, tie, hyperparameters or checkpoint selection. A depth--time trend fitted on the training wells (B0a) has the lowest RMSE. No learned model beats it in total RMSE, and its seismic-band PCC is negative. Seismic-attribute ridge regression (B0b) has the highest band PCC (0.24). Among networks, labels from the marker-calibrated tie (B3b) beat single-anchor sonic integration (B3a). With four wells these numbers are descriptive. + +\begin{table}[t] +\centering +\caption{F3 leave-one-well-out baselines (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, 600--1100\,ms). Macro over four wells; $\pm$: standard deviation over five seeds.} +\label{tab:p1} +\small +\begin{tabular}{lcccc} +\toprule +Method & RMSE (p.u.) & PCC & band PCC & skill vs B0a \\ +\midrule +B0a (trend) & \textbf{2.48} & 0.81 & $-0.13$ & 0.00 \\ +B0b ridge & 2.58 & \textbf{0.83} & \textbf{0.24} & $-0.09$ \\ +B0b random forest & $2.67 \pm 0.01$ & 0.79 & $-0.03$ & $-0.22$ \\ +B0b gradient boosting & 2.68 & 0.78 & 0.01 & $-0.20$ \\ +B1 (impedance inversion) & 3.60 & 0.44 & $-0.02$ & $-1.29$ \\ +B2 (composite loss) & $3.07 \pm 0.16$ & 0.52 & 0.15 & $-0.65$ \\ +B3a & $2.93 \pm 0.24$ & 0.62 & $-0.02$ & $-0.47$ \\ +B3b & $2.82 \pm 0.21$ & 0.68 & 0.15 & $-0.36$ \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Protocol and deviations.} +The field test was pre-registered in a third protocol. Its SHA-256 lock also covers the code, the input data and the software environment, and the scripts refuse to run if any of them changes. The lock file records that it was written one minute before the main run started (28 October 2026, 00:14 and 00:15 local time). The protocol was committed to version control and tagged only after the run, together with the results. The record that the lock preceded the run is therefore the time stamp inside the lock file, which is self-reported, not the version history. Before the lock we ran a timing pilot of the registration and a preflight of the classical baselines on F3. Neither computed a metric on a test well. No result on an F3 test well was used to design it. Two facts limit what the test can show. First, F3 is not an untouched field dataset. The same four wells gave the baselines of Table~\ref{tab:p1}, computed before the protocol was written, and they calibrated the synthetic benchmark (Section~\ref{sec:data:d2}). The field test is therefore a descriptive follow-up on wells we had already seen, not an independent replication. Second, the method under test comes from Experiment~2, whose protocol was itself designed after Experiment~1 had failed (Section~\ref{sec:exp:diag}). The field result therefore bears on the SMC variant only, and it leaves the verdict of Experiment~1 unchanged. + +\paragraph{Design.} +We used nested leave-one-well-out validation. Each well is held out once as the outer test well. Within the three remaining wells, each is held out once as an inner validation well, and models are trained on the other two. Registration uses only the two training wells of each model: the warp-prior hyperparameters, the wavelet phase and the SMC posterior ($\sigma_a = 7$\,ms, $P = 1024$, $S = 64$) are all estimated from them. For each outer fold, method and seed, the iteration budget is chosen from $\{125, 250, 500, 1000, 2000\}$ by total validation MSE averaged over the three inner wells, with ties going to the smaller budget. This replaces the selection on development realizations used in the synthetic experiments (Section~\ref{sec:method:train}). The prediction at the outer well is a Gaussian with the mean and variance of the equally weighted mixture of 15 members (three inner models $\times$ five seeds). Nothing is refitted on the outer well, and its labels enter no choice. The primary label is $\mathrm{PHIE}_{\mathrm{DT}}$, and the reference is the marker-calibrated sonic of the test well, as in Table~\ref{tab:p1}. + +Gate G-C required two conditions for \mRML{} in this configuration. (i) \emph{Direction}: lower band RMSE than the point tie chosen for that outer fold among B3b, B3c and B3c-R, by inner-validation MSE averaged over seeds, at no fewer than three of the four outer wells. Any reduction counts, so this rule is weaker than the 0.90 ratio of the synthetic experiments. (ii) \emph{Coverage}: macro coverage of the central 80\% and 90\% intervals within $\pm 0.05$ of nominal, that is, in $[0.75, 0.85]$ and $[0.85, 0.95]$. Coverage is the fraction of time samples in the window that fall inside the interval. These samples are strongly correlated, so coverage is a description, not a test. The protocol also states that better accuracy cannot compensate for failed coverage. Before the run we had recorded that the coverage condition would probably fail, because every ensemble had under-covered in the synthetic experiments. We kept the threshold. + +\paragraph{Result: the gate failed.} +Both conditions failed (Table~\ref{tab:f3gc}). Inner validation chose B3c-R as the competitor at all four outer wells. \mRML{} had lower band RMSE only at F03-4, by 1.9\%. At F02-1 and F03-2 it was 0.8\% and 0.02\% worse, and at F06-1 it was 7.0\% worse. Its macro band RMSE was 1.272\,p.u., against 1.256\,p.u.\ for B3c-R. Macro coverage was 0.524 for the 80\% intervals and 0.609 for the 90\% intervals, far below the lower limits of 0.75 and 0.85. At F03-2 and F03-4 the 80\% and 90\% intervals covered 0.75 and 0.80 of the samples, just below and well below nominal. At F02-1 and F06-1 they covered 0.22--0.38 and 0.33--0.50. At these two wells most of the error lay below 6\,Hz: the low-band RMSE was 4.31 and 3.64\,p.u., out of a total RMSE of 4.56 and 3.82\,p.u., while the mean predicted standard deviation was 1.05 and 1.27\,p.u. Seed by seed (three-member ensembles), \mRML{} beat B3c-R at one to three of the four wells. The macro band RMSE of each method varied between seeds by up to 0.13\,p.u.\ (\mRML: 1.28--1.41\,p.u.; B3c-R: 1.29--1.41\,p.u.), eight times the gap between the combined ensembles. The competitor was not changed after the test wells were scored, and the intervals were not widened. Under this protocol, training on the SMC bank gave no band-RMSE gain over the best point tie on F3, and its predictive intervals were much too narrow. We make no claim of improvement on field data and no claim of calibrated uncertainty. + +\begin{table}[t] +\centering +\caption{Gate G-C on F3 (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, 600--1100\,ms, $\sigma_a = 7$\,ms, 15-member ensemble). Competitor: the point tie chosen by inner validation. Ratio: band RMSE of \mRML{} divided by that of the competitor; at F03-2 it is 1.0002. Coverage: fraction of the 126 time samples inside the central interval of \mRML; at F03-2 and F03-4 the same counts (94 and 101 samples) occur by coincidence.} +\label{tab:f3gc} +\small +\begin{tabular}{lccccc} +\toprule +Outer well & competitor & ratio & improved & cov$_{80}$ & cov$_{90}$ \\ +\midrule +F02-1 & B3c-R & 1.008 & no & 0.222 & 0.333 \\ +F03-2 & B3c-R & 1.000 & no & 0.746 & 0.802 \\ +F03-4 & B3c-R & 0.981 & yes & 0.746 & 0.802 \\ +F06-1 & B3c-R & 1.070 & no & 0.381 & 0.500 \\ +\midrule +Macro & & & 1/4 & 0.524 & 0.609 \\ +Required & & & $\ge 3/4$ & $[0.75, 0.85]$ & $[0.85, 0.95]$ \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Relation to Experiment~2.} +In the synthetic benchmark, \mRML{} beat the best point tie in all three full-anchor regimes, under a stricter rule (Section~\ref{sec:exp:p2r}). On F3 this direction held at one well of four. The field test does not show why, and we tested no explanation. Two features of F3 limit what it can detect. First, the synthetic gains required a correctly specified $\sigma_a$ (Table~\ref{tab:sigmaa}). On F3, $\sigma_a$ is not identified: 7\,ms comes from the marker--horizon spread (Section~\ref{sec:data:f3}), not from an independent measurement. Second, the reference is itself a point tie, the marker-calibrated sonic of B3b. Its registration error adds to the band RMSE of every method, which pulls ratios towards one, and it favours methods whose label errors resemble its own. Neither feature changes the verdict. + +\begin{table}[t] +\centering +\caption{F3 nested leave-one-well-out, all methods (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, $\sigma_a = 7$\,ms, combined ensembles). Macro over four wells; RMSE in p.u. Coverage is descriptive. Last row: a prediction with no content above $f_c$, whose band RMSE equals the RMS of the band component of the reference; computed after the run, for scale only.} +\label{tab:f3all} +\small +\begin{tabular}{lcccccc} +\toprule +Method & band RMSE & band PCC & RMSE & PCC & cov$_{80}$ & cov$_{90}$ \\ +\midrule +B0a (trend) & 1.239 & $-0.13$ & \textbf{2.48} & 0.81 & -- & -- \\ +B0b ridge & 1.271 & \textbf{0.24} & 2.58 & \textbf{0.83} & -- & -- \\ +B0b random forest & 1.511 & $-0.03$ & 2.67 & 0.79 & -- & -- \\ +B0b gradient boosting & 1.537 & 0.01 & 2.68 & 0.78 & -- & -- \\ +B1 (impedance inversion) & 3.090 & $-0.02$ & 3.60 & 0.44 & -- & -- \\ +B2 (composite loss) & 1.252 & 0.19 & 3.09 & 0.53 & 0.38 & 0.44 \\ +\midrule +B3a & 1.348 & $-0.01$ & 3.13 & 0.44 & 0.47 & 0.57 \\ +B3b & 1.284 & 0.16 & 3.07 & 0.52 & 0.50 & 0.59 \\ +B3c & 1.282 & 0.20 & 3.14 & 0.45 & 0.48 & 0.58 \\ +B3c-R & 1.256 & 0.20 & 2.98 & 0.59 & 0.51 & 0.59 \\ +B3d & 1.266 & 0.16 & 3.05 & 0.52 & 0.51 & 0.60 \\ +\mPM & 1.275 & 0.15 & 3.00 & 0.57 & 0.47 & 0.57 \\ +\midrule +B4a & 1.232 & 0.18 & 3.24 & 0.39 & 0.49 & 0.58 \\ +B4b & \textbf{1.211} & 0.22 & 3.17 & 0.43 & 0.49 & 0.60 \\ +B4c & 1.237 & 0.22 & 3.12 & 0.57 & 0.42 & 0.52 \\ +B4d & 1.254 & 0.21 & 3.14 & 0.57 & 0.47 & 0.58 \\ +\midrule +M1 & 1.286 & 0.13 & 3.14 & 0.49 & 0.50 & 0.58 \\ +\mRML & 1.272 & 0.18 & 3.12 & 0.49 & \textbf{0.52} & \textbf{0.61} \\ +\midrule +No band content & 1.224 & -- & -- & -- & -- & -- \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{All methods.} +Table~\ref{tab:f3all} lists every method under the nested design. B0a, B0b and B1 use the code of Table~\ref{tab:p1} and reproduce its values. The networks have higher total RMSE than in Table~\ref{tab:p1} (B3b: 3.07 against 2.82\,p.u.); here each model is trained on two wells rather than three, and its budget is chosen by inner validation. Only B4b had a lower macro band RMSE than a prediction with no seismic-band content (1.211 against 1.224\,p.u.). B0a, which has almost no band content, came within 1.3\% of that value, and every point tie, \mPM{} and \mRML{} lay above it. Band PCC did not exceed 0.22 for any network. On F3 the networks therefore predicted little of the seismic-band variation of the label, and G-C compared methods whose band errors were nearly the same size: without B3a, the 13 networks span 1.211--1.286\,p.u. The ranking also differs from the synthetic experiments. All four anchor-free losses, B4a--B4d, had lower macro band RMSE than every point tie, \mPM{} and \mRML, by up to 0.06\,p.u. Every probabilistic method under-covered. Macro coverage was 0.38--0.52 for the 80\% intervals and 0.44--0.61 for the 90\% intervals, and \mRML{} had the highest values of both. + +\paragraph{Same posterior, $\sigma_a$ and scoring reference.} +The protocol prescribes four further comparisons. None can replace a G-C condition, and none was used to choose a result. Table~\ref{tab:f3sens} gives the per-well ratios. In no row did the coverage condition hold. +(a) Against \mPM, which is trained on the mean of the same SMC posterior, \mRML{} had lower band RMSE at two wells (F02-1 and F03-4) and higher band RMSE at F03-2, by 9.3\%. Its macro band RMSE was 0.003\,p.u.\ lower. +(b) With $\sigma_a = 3.5$ or 14\,ms, B3c-R, \mPM{} and \mRML{} were registered and trained again, and \mRML{} was compared with B3c-R at the same $\sigma_a$. It had lower band RMSE at one and two of the four wells, and the wells that improved were not the same in the three arms. Macro coverage was 0.47--0.48 and 0.57--0.59. +(c) When the test well is scored against the OpendTect time--depth model instead of the marker-calibrated sonic, \mRML{} again improved only at F03-4. We also scored each method against 64 warps of the test well, drawn from an anchor-only posterior whose prior was fitted on the other three wells. The 5--95\% range of band RMSE over these references was 0.06--0.15\,p.u.\ wide for \mRML{} and for B3c-R, and the ranges of the two methods overlapped at F02-1, F03-2 and F03-4. At F06-1 they did not overlap (\mRML: 1.13--1.18\,p.u.; B3c-R: 1.04--1.11\,p.u.). +(d) Moving the band cutoff to 5 or 8\,Hz changed no ratio by more than 0.01. With the original PHIE label, \mRML{} improved at three wells, but coverage was lower (0.45 and 0.50). In the window the two labels differ by an RMS of 3.2\,p.u.\ at F02-1 and by less than 0.02\,p.u.\ at the other wells. F02-1 is a training well in three of the four outer folds, and the ratios at those three test wells moved by up to 0.13. This shows how much a ratio near one depends on the label of a single training well. The gate is defined on $\mathrm{PHIE}_{\mathrm{DT}}$, and this row does not change its result. + +\begin{table}[t] +\centering +\caption{F3 sensitivity of the G-C comparison (combined ensembles, descriptive). Ratio: band RMSE of \mRML{} divided by that of B3c-R, except in the second row (\mRML{} divided by \mPM). In the $\sigma_a$ rows both methods use the stated $\sigma_a$. Coverage is that of \mRML{} and does not depend on $f_c$ (--). At F03-2 with $f_c = 5$\,Hz the ratio is 1.00002.} +\label{tab:f3sens} +\small +\begin{tabular}{lccccccc} +\toprule +Variant & F02-1 & F03-2 & F03-4 & F06-1 & improved & cov$_{80}$ & cov$_{90}$ \\ +\midrule +Registered (Table~\ref{tab:f3gc}) & 1.008 & 1.000 & 0.981 & 1.070 & 1/4 & 0.52 & 0.61 \\ +\mRML{} / \mPM & 0.970 & 1.093 & 0.941 & 1.012 & 2/4 & -- & -- \\ +$\sigma_a = 3.5$\,ms & 1.010 & 0.939 & 1.003 & 1.034 & 1/4 & 0.48 & 0.59 \\ +$\sigma_a = 14$\,ms & 0.989 & 0.959 & 1.020 & 1.035 & 2/4 & 0.47 & 0.57 \\ +OpendTect reference & 1.022 & 1.018 & 0.974 & 1.071 & 1/4 & 0.50 & 0.60 \\ +$f_c = 5$\,Hz & 1.002 & 1.000 & 0.980 & 1.079 & 1/4 & -- & -- \\ +$f_c = 8$\,Hz & 1.014 & 0.997 & 0.979 & 1.060 & 2/4 & -- & -- \\ +PHIE label & 0.992 & 0.911 & 1.025 & 0.943 & 3/4 & 0.45 & 0.50 \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Posterior width and anchors.} +At $\sigma_a = 7$\,ms, $\sigpost$ of the SMC posterior ranged from 1.7 to 3.6\,ms over the 12 training wells of the six training pairs (median 2.8\,ms). Seven of the 12 values lay in the range of 2.5--3.4\,ms estimated before the run from all four wells. By the rule of Experiment~2 every pair is therefore wide ($\sigpost \ge 1.5$\,ms), the regime in which RML helped at $N = 16$. Each F3 model, however, is trained on two wells, and \mRML{} beat \mPM{} at two of the four outer wells (Table~\ref{tab:f3sens}). The width followed $\sigma_a$: it was 1.2--2.3\,ms at $\sigma_a = 3.5$\,ms and 1.8--6.2\,ms at 14\,ms. Without anchors it was 17--38\,ms at F02-1, F03-2 and F03-4, and 1.4--2.0\,ms at F06-1. The wavelet phase was poorly identified. The six phases estimated at $\sigma_a = 7$\,ms spread over an arc of 214$^\circ$. Over the phases evaluated for each pair, a window 90--120$^\circ$ wide, the summed log evidence of the two wells changed by only 1.0--5.0\,nats. + +Leave-one-anchor-out $z$-scores test the anchor prior on the outer wells. For each well, a linearized Gaussian process conditioned on the anchors alone, with hyperparameters fitted on the other three wells and pick noise $\sigma_a = 7$\,ms, predicts each anchor time from the remaining anchors of that well. Of 62 held-out anchors, 61 lay inside the 90\% interval. The mean $z^2$ was 0.21 (per well: 0.20, 0.01, 0.01 and 0.59), against an expected value of 1. The anchor prior is therefore too wide rather than too narrow, the same direction as the type-II estimate of $\sigma_a$ (0.4\,ms, Section~\ref{sec:method:prior}) and the opposite direction to the under-coverage of porosity. This check does not test the calibration of the SMC posterior, which also depends on the seismic likelihood and the wavelet phase. + +\paragraph{Ablations (descriptive).} +The protocol lists twelve variants of \mRML{} on $\mathrm{PHIE}_{\mathrm{DT}}$ (Table~\ref{tab:f3abl}). They were scored like every other method, but none enters G-C. M2-anchor-only trains on the 64 anchor-only warps of M1 with the same weights, so it reproduces M1 exactly. Nine of the other eleven variants had lower macro band RMSE than \mRML. The variants spanned 1.242--1.309\,p.u., about four times the gap of 0.016\,p.u.\ between \mRML{} and B3c-R. Bank size had no consistent effect: with 1, 8, 64 and 256 SMC labels, band RMSE was 1.273, 1.256, 1.272 and 1.257\,p.u. A convolutional backbone without the GRU lowered band RMSE by about 2\% for both \mRML{} (M2-TCN) and \mPM{} (B3d-Sa-TCN), so it did not change their order. Removing the anchors (M2-no-anchors) lowered band RMSE to 1.247\,p.u.\ but gave the highest total RMSE of the variants (3.23\,p.u.). M2-fixed-sigma was the only variant with coverage close to nominal (0.87 and 0.92), and this is not calibration. Its predicted standard deviation is fixed at the standard deviation of the training labels, which gave 2.9--4.3\,p.u.\ after mixing, against 1.0--2.1\,p.u.\ for \mRML. Its 80\% intervals covered every sample at F03-2 and F03-4 and 0.74 and 0.73 of the samples at F02-1 and F06-1. The macro value is an average of these, not evidence of correct width. M2-LFM adds the low-pass mean label of the training wells as an input channel. It had the lowest total RMSE of any network (2.62\,p.u., against 2.48\,p.u.\ for B0a) and the highest band RMSE of the variants (1.309\,p.u.). Its gain lies below $f_c$, where the gate does not score. + +\begin{table}[t] +\centering +\caption{Ablations of \mRML{} on F3 (label $\mathrm{PHIE}_{\mathrm{DT}}$, marker-calibrated reference, $\sigma_a = 7$\,ms, combined ensembles; descriptive). Macro over four wells; RMSE in p.u. M2-anchor-only is identical to M1 by construction.} +\label{tab:f3abl} +\small +\begin{tabular}{l>{\raggedright\arraybackslash}p{6.4cm}cccc} +\toprule +Variant & change from \mRML & band RMSE & RMSE & cov$_{80}$ & cov$_{90}$ \\ +\midrule +\mRML & registered method: 64 SMC labels, CNN--GRU backbone & 1.272 & 3.12 & 0.52 & 0.61 \\ +\midrule +M2-anchor-only & 64 anchor-only warps (= M1) & 1.286 & 3.14 & 0.50 & 0.58 \\ +M2-no-anchors & no anchor conditioning; prior hyperparameters at the pre-declared medians & 1.247 & 3.23 & 0.48 & 0.56 \\ +M2-bulk & sonic integration plus a constant shift, resampled by the seismic likelihood & 1.251 & 3.16 & 0.49 & 0.58 \\ +M2-lambda1 & $\lambda = 1$ instead of $1/\tau_c$ & 1.257 & 3.09 & 0.52 & 0.62 \\ +M2-S1 & 1 SMC label & 1.273 & 3.08 & 0.48 & 0.57 \\ +M2-S8 & 8 SMC labels & 1.256 & 3.11 & 0.48 & 0.59 \\ +M2-S256 & 256 SMC labels & 1.257 & 3.10 & 0.50 & 0.58 \\ +M2-fixed-sigma & $\sigma$ fixed at the training-label standard deviation & 1.242 & 3.08 & 0.87 & 0.92 \\ +M2-legacy-loss & composite loss of B2 on the bank mean added & 1.243 & 3.11 & 0.41 & 0.49 \\ +M2-TCN & four dilated convolutions, no GRU & 1.245 & 3.10 & 0.38 & 0.48 \\ +B3d-Sa-TCN & \mPM{} with the M2-TCN backbone & 1.250 & 3.13 & 0.40 & 0.49 \\ +M2-LFM & low-pass mean training label as an extra input & 1.309 & 2.62 & 0.40 & 0.50 \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Predicted volume (descriptive).} +A deployment ensemble of \mRML{} predicted all 649 interior inlines of the survey (Fig.~\ref{fig:f3vol}). It has 20 members: four three-well training sets $\times$ five seeds. The map shows sonic-derived porosity and its ensemble standard deviation. Away from the wells there is no ground truth, and three of the four training sets include any given well, so the prediction at a well is not blind. The same kind of ensemble under-covered at the outer wells, so its standard deviation is not a calibrated error bar. Over the $649 \times 949$ interior traces and the 600--1100\,ms window, the median of the predicted mean was 29.6\,p.u.\ (5--95\% of samples: 27.9--31.5\,p.u.). The median standard deviation was 1.3\,p.u.\ (5--95\%: 0.8--2.5\,p.u.). It was larger above 700\,ms (median 2.0\,p.u.) than below (1.2\,p.u.). Even the median standard deviation is less than half the total RMSE of \mRML{} at the outer wells (3.12\,p.u.). + +\begin{figure}[t] +\centering +\includegraphics[width=\linewidth]{f3_volume.pdf} +\caption{Descriptive prediction of sonic-derived porosity ($\mathrm{PHIE}_{\mathrm{DT}}$) on F3 inline 442, through F03-4 (dashed line): (a) mean and (b) standard deviation of the 20-member \mRML{} deployment ensemble. Colour limits: 1st--99th percentile of the section for (a), 0 to the 99th percentile for (b). Three of the four training sets include F03-4, so the prediction at the well is not blind. Intervals from this kind of ensemble under-covered at the outer wells (Table~\ref{tab:f3gc}).} +\label{fig:f3vol} +\end{figure} + +\paragraph{Execution.} +The run stopped once, after 132 of 649 volume inlines, when the operating system refused to replace a progress-display file. By then the gate had been computed. Only volume inference was resumed, with the locked code and models. Registration, training and scoring were not rerun, and the 132 inlines written before the stop were verified to be unchanged. + +\subsection{Volve field data (gate G-D)} +\label{sec:exp:volve} + +\paragraph{Protocol and deviations.} +The Volve test was designed on 28 October 2026, after the F3 gate had failed and before any porosity metric, prediction or training run on Volve. Its protocol follows the F3 protocol, and the lock again covers the code, the input data and the software environment. The lock file records that it was written at 01:17:42 UTC on 29 October 2026, before the primary run started; as on F3, this record is the time stamp inside the lock file. Before the lock, a timing pilot ran the registration on training wells only. Two design choices used Volve data, and neither used a porosity value: the target window, taken from the positions of the labelled samples of the six wells, and the member-support rule (ii) below, taken from a CPU smoke test on training wells. The protocol records eleven deviations from F3, of which four matter for reading the result. (i) The label runs are 16--37 samples long, shorter than the 64-sample training windows and the 6\,Hz band split of F3, so the primary metric is total RMSE on the labelled samples, and the loss uses a single 126-sample window with a mask over the label support of each bank member. (ii) Each bank member trains on its own label support. The first draft intersected the supports of all members, which reduced F-11 A to 7 samples, below the minimum of 8; the intersection is kept as a diagnostic. (iii) Under the slot scheme the inner validation is leave-one-well-out rather than slot-blind, because three slots leave too few groups, so inner validation can be optimistic there. (iv) The anchor uncertainty $\sigma_a = 7$\,ms is inherited from F3, not estimated on Volve. One deviation occurred after the lock. The protocol listed the $\sigma_a$ arms after the primary arm on one GPU; they ran concurrently on a second GPU of the same type. The device is not part of the job fingerprint, every job seeds itself, and the primary-arm gate recomputed with all arms present was identical. Like F3, this is a post-failure design on a dataset we had inspected, not an independent replication. + +\paragraph{Design.} +The six wells are held out under two schemes (Section~\ref{sec:data:volve}). Under \emph{lowo}, each well is the outer test well once and the other five train. Under \emph{slot}, the whole slot group of the test well is held out, so F-1 trains on F-11 A, F-11 T2 and F-12 only; for F-12, which is alone in its slot, the two schemes coincide and its rows are identical. Within the outer training wells, each is held out once as an inner validation well. The held-out well never supplies its picks, sonic or logs to its own input. Its path is placed in time by the mean TVDSS--TWT relation of the wells it is held out from, which also moves the 3$\times$3 patch laterally along the deviated trajectory (by up to 76\,m, F-1 A under slot). Registration ($\sigma_a = 7$\,ms, $P = 1024$, $S = 64$) uses the training wells of each model only. Budgets are chosen from $\{125, 250, 500, 1000, 2000\}$ by inner-validation MSE on the labelled samples, and the prediction at the outer well is the moment-matched mixture of the inner models at the selected budget and five seeds (25 members under lowo, 15--25 under slot). The reference is the marker-calibrated vertical sonic of the test well. Gate G-D is descriptive. ``Consistent improvement'' needs \mRML{} below the selected point tie (B3b, B3c or B3c-R, by inner validation) at no fewer than five of six wells under both schemes, the F3 rule of three of four scaled up. ``Calibrated'' needs macro coverage of the 80\% and 90\% intervals within $[0.75, 0.85]$ and $[0.85, 0.95]$ under both schemes. Neither wording can override the F3 result. + +\paragraph{Result: neither condition held.} +Table~\ref{tab:volvegd} gives the per-well comparison. Under lowo, inner validation chose B3b at every well, and \mRML{} had lower RMSE at two wells (F-1 B by 1.1\% and F-11 T2 by 1.5\%). At the other four it was 0.4--4.6\% worse. Its macro RMSE was 6.50\,p.u.\ against 6.36\,p.u.\ for B3b. Under slot, inner validation chose B3c in the F-1 slot and B3b in the others, and \mRML{} improved at three wells. The two large ratios in that scheme, 0.85 at F-1 and 0.90 at F-1 B, are against B3c, which had the lowest inner-validation MSE in that fold but was worse than B3b at both test wells (8.04 against 7.27\,p.u.\ and 5.35 against 5.17\,p.u.); against B3b, \mRML{} is 5.8\% better at F-1 and 7.1\% better at F-1 B. Its macro RMSE under slot was 7.13\,p.u.\ against 7.32\,p.u.\ for the selected ties. Against \mPM, trained on the mean of the same posterior, \mRML{} was lower at three of six wells under lowo and four of six under slot, with macro differences of 0.02 and 0.13\,p.u. Macro coverage was 0.39 and 0.48 (lowo) and 0.35 and 0.47 (slot) for the 80\% and 90\% intervals, lower than on F3 and far below the bands. No well reached nominal coverage; the highest values were 0.68 and 0.72 at F-1 B. Nothing was changed after the test wells were scored. We make no claim of improvement and no claim of calibrated uncertainty on Volve. + +\begin{table}[t] +\centering +\caption{Gate G-D on Volve (label PHIF, marker-calibrated vertical-sonic reference, labelled samples in 2400--2900\,ms, $\sigma_a = 7$\,ms, combined ensembles). Competitor: the point tie chosen by inner validation. Ratio: RMSE of \mRML{} divided by that of the competitor. $n$: labelled 4\,ms samples. Coverage: fraction of those samples inside the central interval of \mRML. F-12 is alone in its slot, so its two rows are identical.} +\label{tab:volvegd} +\small +\setlength{\tabcolsep}{4pt} +\begin{tabular}{llcccccc} +\toprule +Scheme & Outer well & $n$ & competitor & ratio & improved & cov$_{80}$ & cov$_{90}$ \\ +\midrule +lowo & F-1 & 37 & B3b & 1.035 & no & 0.459 & 0.541 \\ + & F-1 A & 20 & B3b & 1.004 & no & 0.450 & 0.550 \\ + & F-1 B & 25 & B3b & 0.989 & yes & 0.680 & 0.720 \\ + & F-11 A & 16 & B3b & 1.046 & no & 0.188 & 0.313 \\ + & F-11 T2 & 23 & B3b & 0.985 & yes & 0.261 & 0.435 \\ + & F-12 & 29 & B3b & 1.043 & no & 0.276 & 0.310 \\ + & Macro & & & & 2/6 & 0.386 & 0.478 \\ +\midrule +slot & F-1 & 37 & B3c & 0.852 & yes & 0.270 & 0.432 \\ + & F-1 A & 20 & B3c & 1.034 & no & 0.450 & 0.600 \\ + & F-1 B & 25 & B3c & 0.897 & yes & 0.600 & 0.720 \\ + & F-11 A & 16 & B3b & 1.002 & no & 0.188 & 0.375 \\ + & F-11 T2 & 23 & B3b & 0.988 & yes & 0.304 & 0.391 \\ + & F-12 & 29 & B3b & 1.043 & no & 0.276 & 0.310 \\ + & Macro & & & & 3/6 & 0.348 & 0.472 \\ +\midrule +\multicolumn{5}{l}{Required, under both schemes} & $\ge 5/6$ & $[0.75, 0.85]$ & $[0.85, 0.95]$ \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{No method had blind-well skill.} +Table~\ref{tab:volveall} lists the five registered methods. Every macro $R^2$ was negative under both schemes ($-0.84$ to $-1.71$): each method predicted the held-out well worse than that well's own label mean, which it cannot know. The macro PCC was 0.12--0.24. After the run we added one row for scale: a constant prediction at the pooled label mean of the outer training wells, with no seismic input. Its macro RMSE was 6.03\,p.u.\ (lowo) and 6.59\,p.u.\ (slot), below every network. Networks beat it only at F-1 and F-1 B; at the other four wells every network was worse than the constant under both schemes. The reason is the between-well variation of the label. The well means of PHIF span 8.5\,p.u.\ (F-1) to 17.0\,p.u.\ (F-12), while the within-well standard deviation is 3.3--6.0\,p.u. A held-out well therefore differs from the training mean by up to 6.4\,p.u.\ before any seismic information is used, and the networks reproduced this offset rather than correcting it: the mean error of \mRML{} at each well tracked the constant's (lowo: $+3.9$ against $+4.9$\,p.u.\ at F-1, $-5.4$ against $-4.3$ at F-11 A, $-6.8$ against $-6.0$ at F-12). After removing the per-well mean error, the standard deviation of the residual of \mRML{}, averaged over wells, was 5.2\,p.u.\ (lowo) and 5.1\,p.u.\ (slot), against an average within-well label standard deviation of 4.8\,p.u., and the standard deviation of its prediction along a well was 1.1--4.1\,p.u. The predictions varied less than the label and did not follow it. Allowing a free time shift of up to $\pm 64$\,ms between prediction and label (a diagnostic that never alters a score) raised the PCC of \mRML{} to 0.40--0.82. At three (lowo) and four (slot) of the six wells, however, the chosen shift was 56--64\,ms, at or near the search limit and far outside the tie posterior ($\sigpost$ below 10\,ms; see below). With 16--37 samples, the maximum over 33 lags is an optimistic statistic, and we read this diagnostic as uninformative. The differences between tie methods, up to 0.25\,p.u.\ in macro RMSE, are therefore differences between predictions that are all dominated by an error the tie does not control. The G-D comparison had no power on these wells, and its outcome is not evidence about RML in either direction. + +\begin{table}[t] +\centering +\caption{Volve nested blind folds, all registered methods (label PHIF, marker-calibrated vertical-sonic reference, $\sigma_a = 7$\,ms, combined ensembles). Macro over six wells; RMSE in p.u. Coverage is descriptive. Last row: a constant prediction at the pooled label mean of the outer training wells, with no seismic input; computed after the run, for scale only.} +\label{tab:volveall} +\small +\begin{tabular}{lcccccccc} +\toprule +& \multicolumn{4}{c}{lowo} & \multicolumn{4}{c}{slot} \\ +\cmidrule(lr){2-5}\cmidrule(lr){6-9} +Method & RMSE & $R^2$ & cov$_{80}$ & cov$_{90}$ & RMSE & $R^2$ & cov$_{80}$ & cov$_{90}$ \\ +\midrule +B3b & 6.36 & $-0.84$ & 0.38 & 0.46 & 7.29 & $-1.64$ & 0.32 & 0.43 \\ +B3c & 6.55 & $-0.97$ & 0.32 & 0.40 & 7.32 & $-1.71$ & 0.33 & 0.40 \\ +B3c-R & 6.61 & $-1.02$ & 0.32 & 0.39 & 7.24 & $-1.61$ & 0.29 & 0.35 \\ +\mPM & 6.52 & $-0.96$ & 0.39 & 0.45 & 7.26 & $-1.59$ & 0.33 & 0.44 \\ +\mRML & 6.50 & $-0.92$ & 0.39 & 0.48 & 7.13 & $-1.48$ & 0.35 & 0.47 \\ +\midrule +Constant (training mean) & \textbf{6.03} & $-0.70$ & -- & -- & \textbf{6.59} & $-1.14$ & -- & -- \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Anchor uncertainty.} +B3c-R, \mPM{} and \mRML{} were registered and trained again at $\sigma_a = 3.5$ and 14\,ms (Table~\ref{tab:volvesens}). The macro RMSE of \mRML{} moved by at most 0.06\,p.u.\ (lowo: 6.49, 6.50 and 6.55\,p.u.; slot: 7.13, 7.13 and 7.09\,p.u.), and coverage stayed between 0.35 and 0.52. The number of wells at which \mRML{} beat B3c-R varied between two and four of six, with no pattern across the arms. In Experiment~2 the H2a advantage depended on $\sigma_a$, and on F3 the arms changed the per-well ratios but not the outcome. On Volve they barely changed the macro error, which is consistent with the previous paragraph: when the error is set by the between-well level, the tie has little to act on. + +\begin{table}[t] +\centering +\caption{Volve sensitivity to $\sigma_a$ (combined ensembles, descriptive). Macro RMSE in p.u.\ of \mRML{} and of B3c-R at the same $\sigma_a$; improved: wells at which \mRML{} is below B3c-R; coverage of \mRML. The registered comparison of Table~\ref{tab:volvegd} is against the tie chosen by inner validation, which is B3b at most wells, so its counts differ.} +\label{tab:volvesens} +\small +\begin{tabular}{lcccccccc} +\toprule +& \multicolumn{4}{c}{lowo} & \multicolumn{4}{c}{slot} \\ +\cmidrule(lr){2-5}\cmidrule(lr){6-9} +$\sigma_a$ (ms) & \mRML & B3c-R & improved & cov$_{90}$ & \mRML & B3c-R & improved & cov$_{90}$ \\ +\midrule +3.5 & 6.49 & 6.65 & 4/6 & 0.48 & 7.13 & 7.28 & 3/6 & 0.42 \\ +7 & 6.50 & 6.61 & 4/6 & 0.48 & 7.13 & 7.24 & 2/6 & 0.47 \\ +14 & 6.55 & 6.52 & 3/6 & 0.52 & 7.09 & 7.27 & 4/6 & 0.46 \\ +\bottomrule +\end{tabular} +\end{table} + +\paragraph{Posterior width and phase.} +Over the 78 training-well registrations of the primary arm, $\sigpost$ of the SMC posterior was 1.9--9.3\,ms over the main window (median 4.3\,ms) and 3.0\,ms over the labelled samples. It was narrowest at F-11 T2 (1.9--2.6\,ms) and widest at F-12 (4.3--9.3\,ms). Unlike F3, the width barely followed $\sigma_a$: the medians were 3.8, 4.3 and 4.1\,ms at 3.5, 7 and 14\,ms. This is consistent with the seismic likelihood rather than the anchor prior setting the width over the logged interval, but we did not test it. By the rule of Experiment~2 every training set was wide. The wavelet phase was better identified than on F3: the 22 phases of the primary arm lay within an arc of 43$^\circ$, against 214$^\circ$ on F3. A well-identified phase and a width set by the data rather than by $\sigma_a$ suggest that registration was not the limiting step, although on field data this cannot be checked against a true warp. The limiting step was the predictive task itself: with 150 labelled samples in six wells, between-well level differences of up to 8.5\,p.u.\ and a target window 2.4--2.9\,s deep in a deviated-well field, the seismic input did not carry the information needed to predict PHIF at a blind well by any of the methods tested. diff --git a/report.html b/report.html index 156c692..661693b 100644 --- a/report.html +++ b/report.html @@ -100,7 +100,7 @@ footer{margin-top:32px;color:var(--mute);font-size:12px}

Theo dõi tiến độ ML-Porosity

-
Dự đoán porosity từ seismic khi việc căn chỉnh giếng với seismic (well tie) không chắc chắn · lịch nén: 26/10 đến hết thứ 7, 31/10/2026 · nguồn: docs/plan.md
+
Dự đoán porosity từ seismic khi việc căn chỉnh giếng với seismic (well tie) không chắc chắn · lịch: 26/10 đến hết thứ 7, 14/11/2026 (Pivot 1 mức B, dời ngày 29/10 từ 31/10) · nguồn: docs/plan.md
@@ -127,12 +127,24 @@ footer{margin-top:32px;color:var(--mute);font-size:12px}

Band RMSE macro của M2-Sa là 1,272 p.u., so với B3c-R 1,256 p.u. Khoảng dự đoán chưa bao phủ đủ nhãn tham chiếu; không claim calibration hoặc ưu thế trên field. Giữ nguyên ngưỡng, không chọn lại phương pháp theo test. Volume chỉ có tính mô tả.

Hoàn tất toàn bộ lúc 06:50 ngày 28/10. Lượt đầu dừng lúc 03:57 vì Windows khóa file dashboard sau 132/649 inline. Đã phục hồi riêng volume; một lần khóa file tái diễn được retry thành công. Giữ nguyên code khoa học, mô hình, G-C và byte của 132 inline cũ. Nhật ký phục hồi · Kiểm tra hoàn tất · Bảng kết quả · Hình bốn giếng.

+
+ Kết quả P4 Volve ngày 29/10: G-D không đạt tiêu chí claim nào +

Sáu giếng nghiêng, nhãn PHIF (dẫn xuất từ density, không phụ thuộc sonic), hai scheme blind: lowo (bỏ một giếng) và slot (bỏ cả nhóm giếng chung lỗ khoan). G-D chỉ mô tả; tham chiếu calibrated, σ_a = 7 ms, ensemble gộp.

+
+ + + +
Tiêu chí đã khóalowoslotKết luận
M2-Sa có RMSE thấp hơn B3 được chọn bằng inner validation ở ≥ 5/6 giếng2/6 (đối thủ B3b ở cả 6)3/6 (B3c ở nhóm F-1, B3b ở còn lại)Không đạt
Coverage 80% trong 75–85%38,6%34,8%Không đạt
Coverage 90% trong 85–95%47,8%47,2%Không đạt
+

RMSE macro của M2-Sa là 6,50 p.u. (lowo) và 7,13 p.u. (slot), so với 6,36 và 7,32 của B3 được chọn, 6,52 và 7,26 của B3d-Sa. R² macro âm với mọi phương pháp (−0,84 đến −1,71), PCC 0,12–0,24. Nhánh σ_a = 3,5 và 14 ms làm RMSE macro của M2-Sa đổi tối đa 0,06 p.u.

+

Post hoc (chỉ để so thang, scripts/25_p4_posthoc.py): dự đoán hằng số bằng trung bình PHIF của các giếng train có RMSE macro 6,03 (lowo) và 6,59 p.u. (slot), thấp hơn mọi mạng. Sai số do mức trung bình khác nhau giữa giếng (8,5–17,0 p.u.) chi phối; khác biệt giữa các phương pháp tie (≤ 0,25 p.u.) nhỏ so với sai số tổng 6–7 p.u. Phép so sánh G-D vì vậy không có lực phân biệt; Volve không phải bằng chứng ủng hộ hay chống RML.

+

Deviation sau khóa (chỉ lịch chạy): nhánh σ_a chạy song song trên cuda:0 thay vì sau nhánh chính trên cuda:1; G-D của nhánh chính tính lại khi có đủ các nhánh trùng hệt. Không chạy lại, không đổi thiết kế. Chi tiết: docs/plan.md §12 ý 20–21.

+

Các mục cần xác minh [XM]

MụcVị trí trong planTrạng tháiKết quả hoặc việc còn lại
-

Quyết định (chốt 26/10/2026, bỏ bước chờ GVHD)

+

Quyết định (D-1 đến D-4 chốt 26/10/2026; D-5 đến D-12 chốt 29/10/2026)

MãQuyết địnhChốtCăn cứ

Phát hiện đã kiểm chứng (từ dữ liệu)

@@ -213,7 +225,7 @@ footer{margin-top:32px;color:var(--mute);font-size:12px}