P2 diagnosis on dev, P3 dev experiments, lock protocol_p3

- P2: SMC tie posterior (numpy + torch), RML/soft-DTW losses, bank training,
  D2 synthetic generator, scripts 09-13, protocol_p2 (locked) and its outcome
  (G-B failed; H1 not rejected, H3 rejected, H4 not rejected).
- Diagnosis on dev realizations 900/901 only (scripts 14-17, run_p3_dev.sh):
  posterior screen, SMC stability (P = 1024, K = 1), sigma_a misspecification
  stress and training, H3 with the SMC posterior, F3 placement on sigma_post.
- protocol_p3: H2 split into H2a (posterior-mean labels vs point ties) and
  H2b (RML vs posterior mean as a function of sigma_post); H3 descriptive only;
  sigma_a arm; new D2 config d2_synth_p3.yaml; main grid on realizations 8-15.
  Locked by configs/protocol_p3.sha256 and tag protocol-p3.
- runlog: per-run logs and runtime index (logs/index.csv).
- Docs: plan §12 items 10-11, theory, technical overview, report; wording
  aligned with Gunning & Glinsky (2006): the tie posterior is not claimed as new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 06:03:33 +00:00
parent a76e61398a
commit cee2ff0859
84 changed files with 8793 additions and 460 deletions

View File

@@ -1,11 +1,11 @@
# B2 (CNN–GRU v2, pipeline đã sửa, loss gốc), chạy thử hạ tầng P0.
# KHÔNG phải kết quả baseline: protocol.yaml phải được commit trước khi chạy thật (plan mục 5.2).
# B2 (CNN–GRU v2, corrected pipeline, original loss), P0 infrastructure smoke run.
# NOT a baseline result: protocol.yaml must be committed before any real run (plan §5.2).
dataset: f3_wells.npz
tdr: calibrated
label: PHIE
test_well: F06-1
val_well: F03-2
train_wells: [F03-4] # F02-1 có định nghĩa PHIE khác (plan mục 1.2d) nên không trộn ở đây
train_wells: [F03-4] # F02-1 uses a different PHIE definition (plan §1.2d), so it is not mixed in here
epochs: 100
lr: 5.0e-3
d_channels: 64

View File

@@ -1,18 +1,18 @@
# D1: F3 Demo 2023, 4 giếng. Đường dẫn dữ liệu lấy từ ml_porosity/paths.py
# (mặc định data/F3_Demo_2023/F3_Demo_2023, đổi bằng biến ML_POROSITY_F3_ROOT).
# D1: F3 Demo 2023, 4 wells. Data paths come from ml_porosity/paths.py
# (default data/F3_Demo_2023/F3_Demo_2023, override with the ML_POROSITY_F3_ROOT variable).
wells: [F02-1, F03-2, F03-4, F06-1]
time_window_ms: [600, 1100] # cửa sổ chính; D-2 chưa chốt
ext_window_ms: [400, 1300] # cửa sổ lưu trữ (biên cho inversion B1 và synthetic)
patch_radius: 1 # 3×3 trace như luận văn
time_window_ms: [600, 1100] # main window; D-2 not yet finalized
ext_window_ms: [400, 1300] # stored window (margin for B1 inversion and synthetics)
patch_radius: 1 # 3×3 traces as in the thesis
curves: [PHIE, PHIE_DT, DT, RHOB, GR, AI] # PHIE_DT = −0.2018 + 0.0011·DT (D-1)
# Các TDR được dựng cho mỗi giếng (xem ml_porosity/data/tdr.py):
# legacy tích phân DT từ mẫu LAS đầu, không hiệu chỉnh (cách của luận văn, chỉ để audit)
# calibrated marker-calibrated sonic: tham chiếu chấm điểm theo plan mục 5.2
# anchors nội suy tuyến tính giữa các cặp marker TD, không dùng DT của giếng
# wlt Depth2Time model của OpendTect (WellInfo/*.wlt), dùng cho phân tích độ nhạy
# TDRs built for each well (see ml_porosity/data/tdr.py):
# legacy DT integrated from the first LAS sample, uncalibrated (the thesis approach; audit only)
# calibrated marker-calibrated sonic: scoring reference per plan §5.2
# anchors linear interpolation between TD marker pairs, does not use the well's DT
# wlt OpendTect Depth2Time model (WellInfo/*.wlt), used for sensitivity analysis
tdrs: [legacy, calibrated, anchors, wlt]
resample:
fine_dt_ms: 0.25
cutoff_frac: 0.8 # lọc thông thấp ở 0.8·Nyquist của lưới 4 ms (100 Hz)
cutoff_frac: 0.8 # low-pass at 0.8·Nyquist of the 4 ms grid (100 Hz)

44
configs/d2_synth.yaml Normal file
View File

@@ -0,0 +1,44 @@
# D2: synthetic hiệu chỉnh theo F3 (plan mục 5.1, 5.5). Bộ sinh: ml_porosity/data/synth_d2.py.
# Các thông số thuộc tính được hiệu chỉnh theo PHIE_DT calibrated của 4 giếng F3 trên cửa sổ 400–1300 ms
# (std phần dư sau trend tuyến tính 0.025–0.051, std băng > 6 Hz 0.010–0.026, τ_c 2.1–3.5 mẫu,
# độ dốc PSD 10–80 Hz từ −1.0 đến −2.3); xem scripts/10_build_d2.py.
horizons: [Shallow, FS8, FS7, Truncation, MFS4] # 5 horizon phủ ≥ 95% survey (Top-Foresets 74%, FS6 49%)
horizon_cache: outputs/d2/horizon_grid.npz
min_gap_ms: 8 # bỏ bin có hai horizon liên tiếp cách nhau < 8 ms hoặc đảo thứ tự
sub_unit_ms: 60 # độ dày danh nghĩa của đơn vị con (biên đơn vị = marker/anchor)
model_t_ms: [-300, 2400] # miền earth model theo thời gian thật; đủ rộng để t(τ) của log 100–1650 ms nằm trong miền ở drift ×2
log_tau_ms: [100, 1650] # miền log theo thời gian sonic τ
fine_dt_ms: 0.5
warp_dtau_ms: 4.0 # lưới của g
dt_ms: 4
ext_window_ms: [400, 1300] # seismic + anchor (như F3)
main_window_ms: [600, 1100] # input/nhãn/chấm điểm (như F3)
patch_radius: 1
wells:
n_test: 8
n_train_pool: 16 # N_train ∈ {2, 4, 8, 16} lấy lồng nhau từ pool
min_dist_test_m: 1000 # test cách mọi giếng khác ≥ 1 km (tách khối không gian)
min_dist_train_m: 500
property:
phi0: 0.32
phi0_sd: 0.01
slope_per_100ms: -0.008
unit_offset_sd: 0.02
unit_lateral_sd: 0.01
grf: # tổng các quá trình OU theo toạ độ địa tầng
- {sd: 0.010, ell_ms: 10.0}
- {sd: 0.006, ell_ms: 2.0}
clip: [0.05, 0.45]
wavelet: statistical # outputs/wavelets.npz (pha không, 128 ms) từ scripts/04
snr_db: 10 # lưới chính; stress {inf, 20, 5} để sau
drift:
prior_json: outputs/p2/warp_prior_f3.json # fit Matérn-3/2 trên anchor F3 (scripts/09)
factors: [0, 0.5, 1, 2]
anchors:
density: full
sigma_a_ms: 7.0 # σ robust (MAD) của chênh lệch marker–horizon tại 4 giếng F3 (18 cặp): 6.9 ms

50
configs/d2_synth_p3.yaml Normal file
View File

@@ -0,0 +1,50 @@
# D2 for protocol_p3: GENERATOR IDENTICAL to configs/d2_synth.yaml (protocol_p2, sha256 68e8f844…). This file differs only in
# comments and the `regimes` block at the end; every key read by ml_porosity/data/synth_d2.py keeps its value, so the same
# realization yields the same data. Do not edit configs/d2_synth.yaml (locked in protocol_p2).
horizons: [Shallow, FS8, FS7, Truncation, MFS4] # 5 horizons covering ≥ 95% of the survey (Top-Foresets 74%, FS6 49%)
horizon_cache: outputs/d2/horizon_grid.npz
min_gap_ms: 8 # drop bins where two consecutive horizons are < 8 ms apart or out of order
sub_unit_ms: 60 # nominal sub-unit thickness (unit boundaries = markers/anchors)
model_t_ms: [-300, 2400] # earth-model domain in true time; wide enough that t(τ) of the 100–1650 ms log stays inside at drift ×2
log_tau_ms: [100, 1650] # log domain in sonic time τ
fine_dt_ms: 0.5
warp_dtau_ms: 4.0 # grid of g
dt_ms: 4
ext_window_ms: [400, 1300] # seismic + anchors (as in F3)
main_window_ms: [600, 1100] # input/labels/scoring (as in F3)
patch_radius: 1
wells:
n_test: 8
n_train_pool: 16 # N_train ∈ {2, 4, 8, 16}, nested draws from the pool
min_dist_test_m: 1000 # test wells ≥ 1 km from every other well (spatial block split)
min_dist_train_m: 500
property:
phi0: 0.32
phi0_sd: 0.01
slope_per_100ms: -0.008
unit_offset_sd: 0.02
unit_lateral_sd: 0.01
grf: # sum of OU processes in stratigraphic coordinates
- {sd: 0.010, ell_ms: 10.0}
- {sd: 0.006, ell_ms: 2.0}
clip: [0.05, 0.45]
wavelet: statistical # outputs/wavelets.npz (zero phase, 128 ms) from scripts/04
snr_db: 10 # generator default; protocol_p3 takes SNR from the regimes below
drift:
prior_json: outputs/p2/warp_prior_f3.json # Matérn-3/2 fit on F3 anchors (scripts/09)
factors: [0, 0.5, 1, 2]
anchors:
density: full
sigma_a_ms: 7.0 # robust σ (MAD) of marker–horizon differences at the 4 F3 wells (18 pairs): 6.9 ms
regimes: # protocol_p3: observation regimes (seismic SNR at train + test wells, anchor density at train wells)
R10: {snr_db: 10, anchor_density: full} # P2 default; narrow posterior (dev σ_post ≈ 0.85 ms at c = 1)
R0: {snr_db: 0, anchor_density: full} # dev σ_post ≈ 1.9 ms at c = 1
Rm5: {snr_db: -5, anchor_density: full} # close to F3 under the protocol prior (dev σ_post ≈ 3.0 ms, F3 2.5–3.4 ms)
R0h: {snr_db: 0, anchor_density: half} # sparse anchors: dev σ_post ≈ 1.8 / 4.5 ms at c = 1 / 2
R10tb: {snr_db: 10, anchor_density: topbottom} # top–bottom anchors only: dev σ_post ≈ 2.6 / 11 ms (multimodal, overconfident posterior)

View File

@@ -1,17 +1,17 @@
# D3: Volve. Dữ liệu tải từ data village nằm ở data/Volve (ml_porosity.paths.volve_root, đổi bằng
# ML_POROSITY_VOLVE_ROOT); mọi đường dẫn dưới đây tính từ đó. Hash ở data_manifest/volve.json.
# D3: Volve. Data downloaded from the data village live in data/Volve (ml_porosity.paths.volve_root, override with
# ML_POROSITY_VOLVE_ROOT); all paths below are relative to it. Hashes in data_manifest/volve.json.
well_logs_dir: Well_logs_pr_WELL
# Stack ST10010 (time, Kirchhoff final, góc 3–41°), tải từ data village ngày 26/10/2026
# Stack ST10010 (time, Kirchhoff final, angles 3–41°), downloaded from the data village on 2026-10-26
cube: Seismic/ST10010/Stacks/ST10010ZC11_PZ_PSDM_KIRCH_FULL_T.MIG_FIN.POST_STACK.3D.JS-017536.segy
picks: Geophysical_Interpretations/Wells/Well_picks_Volve_v1.dat
horizons_twt: Geophysical_Interpretations/Horizons/Horizons_TWT
grid_horizon: Official_Horizons/Hugin_Fm_Top+ST10010ZC11_Near_190314+STAT+TIME.dat
# 9 giếng có PHIF và F-15 A (có VSP checkshot, không có PHIF)
# 9 wells with PHIF, plus F-15 A (VSP checkshot, no PHIF)
wells: [NO 15/9-F-1, NO 15/9-F-1 A, NO 15/9-F-1 B, NO 15/9-F-1 C, NO 15/9-F-11 A, NO 15/9-F-11 B,
NO 15/9-F-11 T2, NO 15/9-F-12, NO 15/9-F-15 A, NO 15/9-F-15 D]
# Mặt pick ↔ horizon TWT để đối chiếu (BCU so với Draupne Fm. Top)
# Pick surface ↔ TWT horizon for cross-checking (BCU vs. Draupne Fm. Top)
pick_horizons:
Utsira Fm. Top: Other_Horizons/Utsira_Top+ST10010_Pz_PSDM_Full+STAT+TIME.dat
Ty Fm. Top: Official_Horizons/Ty_Fm_Top+ST10010_Full+STAT+TIME.dat
@@ -21,12 +21,12 @@ pick_horizons:
Hugin Fm. VOLVE Top: Official_Horizons/Hugin_Fm_Top+ST10010ZC11_Near_190314+STAT+TIME.dat
Hugin Fm. VOLVE Base: Official_Horizons/Hugin_Fm_Base+ST10010ZC11_Near_190314+STAT+TIME.dat
# TWT của các pick nông không dùng làm anchor: cùng một MD (F-1 A/B/C dùng chung lỗ khoan) nhưng TWT
# lệch nhau ~110 ms, và ở F-11 T2 lệch checkshot ~100 ms.
# TWT of shallow picks is not used as anchors: the same MD (F-1 A/B/C share a borehole) has TWTs
# differing by ~110 ms, and at F-11 T2 the offset from the checkshot is ~100 ms.
anchor_exclude_surfaces: [Seabed, NORDLAND GP. Top, Utsira Fm. Top, HORDALAND GP. Top]
# NL (not logged): đoạn giếng không có log; 31/51 pick NL vẫn ghi TWT nhưng không kiểm chứng được.
# NR (not reached, ví dụ F-11 B đi ngang trong Hugin): điểm quay đầu của giếng, không nằm trên mặt phản xạ
# (lệch horizon ~−40 ms) và mỗi dòng bị lặp hai lần.
# NL (not logged): well interval without logs; 31/51 NL picks still record a TWT that cannot be verified.
# NR (not reached, e.g. F-11 B running horizontally in the Hugin): the well's turning point, not on the reflector
# (~−40 ms off the horizon), and each row is duplicated.
anchor_exclude_qlf: [NL, NR]
checkshots:
@@ -37,5 +37,5 @@ checkshots:
NO 15/9-F-15 A:
VSP: 15_9-F-15 A/08.VSP_VELOCITY/TZV_TIME_CHECKSHOT_1.ASC
# ROI từ quỹ đạo của 10 giếng trên + 500 m (inventory D3 mục 4), ED50 / UTM 31N
# ROI from the trajectories of the 10 wells above + 500 m (D3 inventory §4), ED50 / UTM 31N
roi_xy: [433308, 437150, 6477323, 6479997]

View File

@@ -0,0 +1 @@
0733620042c4ec1b7dce447eef3ec64f915db05acbebbe5b6c977ac42e71a470 configs/protocol_p2.yaml

129
configs/protocol_p2.yaml Normal file
View File

@@ -0,0 +1,129 @@
# Giao thức P2 (pre-registration, plan mục 4–6; gate G-B, giả thuyết H1, H3, H4).
# Khoá bằng SHA-256 trong configs/protocol_p2.sha256 TRƯỚC khi chạy lưới chính và H1; scripts/11_run_d2.py --main
# và scripts/12_h1_blur.py từ chối chạy nếu hash không khớp. Chỉ mục training.budgets được điền sau vòng dev
# (realization 900, 901 — không bao giờ dùng cho kết quả) và trước khi khoá. Mọi thay đổi sau khoá: tạo version mới.
version: 1
date: 2026-10-26
inputs:
d2_config: {path: configs/d2_synth.yaml, sha256: 68e8f8449e4854f49c4bba3e9134688d9f22ad0e3af42c51be940d574b7199d4}
warp_prior: {path: outputs/p2/warp_prior_f3.json, sha256: 55cda573c06b3a7275bdb4ac5f169fb4e5af329e1d199acc3d4daffe15624d27,
fit: matern32}
wavelet: {path: outputs/wavelets.npz, key: statistical, sha256: b689ea12578e580d8c2305c8f7219be05ff6e339884fa30b694111e968c0fc64}
grid:
drift_factors: [0, 0.5, 1, 2] # warp thật = prior F3 × c (g → c·g, b → c·b)
realistic_drift: 1 # "vùng drift thực tế" của G-B
n_train: [2, 4, 8, 16] # lồng nhau từ pool 16 giếng
realizations: [0, 1, 2, 3, 4, 5, 6, 7]
dev_realizations: [900, 901] # chỉ để chọn ngân sách bước
seeds: [0, 1, 2, 3, 4] # seed điều khiển mẫu warp, multi-start MAP-II và khởi tạo mạng
snr_db: 10
anchor_density: full
test_wells: 8 # cùng 8 giếng test cho mọi ô của một realization
registration: # ml_porosity/registration/pipeline.py
hyper: MAP-II (m_g, σ_g, ℓ) trên anchor của giếng train; σ_a, σ_b cố định
kernel: matern32
sigma_a_ms: 7.0 # bằng σ_a sinh dữ liệu (MAD marker–horizon F3)
sigma_b_ms: 50.0 # prior bulk shift rộng
hyperprior: {sigma_g: [0.05, 1.0], ell_ms: [150.0, 1.0]} # log-normal (trung vị, sd log)
hyper_starts: 4
S: 64 # mẫu warp mỗi giếng (Laplace/Gauss–Newton + elliptical slice)
g_max: 1.0 # sai khác: plan ghi |g| ≤ 0.15; drift ×2 của D2 có g thật vượt 0.15
wavelet: thống kê pha không 128 ms từ trace giữa của giếng train
phase: "pha hằng ∈ {−180, −165, …, 165}° cực đại Σ_w log mean_s p(s_w | g_ws, φ) trên mẫu warp anchor; biên độ α ≥ 0"
physics_weights: "log p = −(n/2) log RSS (α ≥ 0, σ_n profile) trên 400–1300 ms; π ∝ p^γ, γ lớn nhất cho ESS ≥ S/4"
invalid_samples: mẫu warp không phủ hết cửa sổ chính có π = 0
ess_min_frac: 0.25
shift_K: 8 # bank B4: ±8 mẫu
wavelet_ms: 128
lambda: "λ = 1/τ_c, τ_c = 1 + 2 Σ ρ(k)², ρ = ACF gộp của nhãn train B3b lọc thông cao 6 Hz (tới lag đầu tiên ρ ≤ 0)"
training: # ml_porosity/models/bank_train.py
backbone: CNNGRUHetero(9 kênh, σ_min 1e-3) # cùng backbone P1
model: {d_channels: 64, p_dropout: 0.05}
optimizer: {name: Adam, lr: 5.0e-3, grad_clip: 5.0}
batch: full batch mọi giếng train
windows: "sub-window 64 mẫu bắt đầu 0, 2, …, 62 (32 cửa sổ/giếng); mọi loss tính trên cùng các cửa sổ"
input: patch 3×3 trên cửa sổ chính, z-score theo kênh trong từng giếng (như P1)
label_norm: trung bình/sd của log φ (chống alias) trên τ ∈ cửa sổ chính của giếng train (không phụ thuộc tie)
device: cuda:1
budget_candidates: [125, 250, 500, 1000, 2000]
budget_selection: >
Riêng từng phương pháp: ngân sách có RMSE tổng (p.u., macro 8 giếng test) trung bình nhỏ nhất trên
realization dev {900, 901} × N ∈ {4, 16} × seed {0, 1} ở c = 1. Cùng tập ứng viên và cùng công sức cho mọi
phương pháp; không dùng metric băng để chọn.
budgets: {Oracle: 500, B3a: 250, B3b: 125, B3c: 250, B3d: 250, B4a: 125, B4b: 125, B4c: 500, B4d: 250,
M1: 250, M2: 125, MSE0: 500} # outputs/p2/dev/budgets.json
dev_note: >
Ghi trước khi chạy lưới chính: ở dev, σ dự đoán co lại theo số bước với mọi loss có σ học được
(coverage_90 ≈ 0.10–0.66, NLL 2.5–99 ở ngân sách đã chọn) do mạng nhớ nhãn train khi N ≤ 16. Không sửa
trong P2; metric calibration báo cáo nguyên trạng, H3 là so sánh tương đối (cùng backbone, cùng UQ).
softdtw: {gamma: 0.1, band: 8}
dilate: {alpha: 0.5, gamma: 0.1, band: 8}
methods: # nhãn của mọi phương pháp: labels_for_warps (log chống alias, warp nghịch)
Oracle: {bank: warp thật, S: 1, loss: Gaussian NLL, note: "trần tham chiếu; không là đối thủ"}
B3a: {tie: "một điểm tại anchor nông nhất, t = τ + (t_0 − τ_0)", loss: Gaussian NLL}
B3b: {tie: "marker-calibrated sonic qua anchor (bỏ anchor đảo thứ tự bằng dãy con tăng dài nhất)", loss: Gaussian NLL}
B3c: {tie: "B3b + dịch cục bộ theo tương quan synthetic–seismic (cửa sổ 120 ms, bước 20 ms, ±16 ms, r ≥ 0.3, trơn 3)", loss: Gaussian NLL}
B3d: {tie: "warp trung bình có trọng số M2 (sai khác: plan ghi MAP)", loss: Gaussian NLL}
B4a: {bank: "nhãn B3b dịch ±8 mẫu (±32 ms), π đều", loss: "hard-min theo cửa sổ của Gaussian NLL (sai khác: σ học được, không cố định)"}
B4b: {bank: như B4a, loss: "RML (soft-min) với λ"}
B4c: {loss: "soft-DTW, chi phí Gaussian NLL, bước đối xứng (chéo ×2), γ = 0.1, dải ±8, chia 2n", labels: B3b}
B4d: {loss: "DILATE α = 0.5 (soft-DTW + TDI, Ω_ij = ((i − j)/n)²), γ = 0.1, dải ±8", labels: B3b}
B5: "ensemble 5 seed của B3b: μ = trung bình μ_s, σ² = trung bình σ_s² + phương sai μ_s"
M1: {bank: "S = 64 mẫu warp posterior theo anchor", weights: đều, loss: "RML với λ"}
M2: {bank: như M1, weights: "π vật lý (tempered)", loss: "RML với λ"}
M2-ens: như B5 cho M2
M3: hoãn (ngoài phạm vi P2)
metrics:
reference: "y_true: φ thật của earth model theo thời gian thật, chống alias, trên 600–1100 ms (8 giếng test)"
units: p.u. (×100)
bands: {f_c_hz: 6, filter: Butterworth bậc 4 pha không}
per_run: macro trên 8 giếng test cho mỗi (realization, c, N, method, seed)
calibration: [NLL, CRPS, coverage_50, coverage_80, coverage_90, coverage_95]
warp_diagnostics: "RMSE τ(t) trên cửa sổ chính so với warp thật, coverage 90% (chỉ báo cáo, không dùng để chọn)"
gates:
G-B:
text: "M2 hơn B3/B4 tốt nhất: RMSE băng seismic −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."
competitors: [B3a, B3b, B3c, B3d, B4a, B4b, B4c, B4d]
best_competitor: "mỗi ô (c, N): đối thủ có band RMSE trung bình (realization × seed) nhỏ nhất"
improves: "band_rmse(M2) ≤ 0.90 · band_rmse(best) HOẶC band_pcc(M2) ≥ band_pcc(best) + 0.05"
cell_pass: >
improves đúng ở ≥ 4/5 seed (mỗi seed: trung bình trên realization) VÀ ở > 1/2 số realization (mỗi
realization: trung bình trên seed)
realistic_pass: cell_pass ở c = 1 cho ≥ 3/4 giá trị N
zero_drift_guard: >
ở c = 0: band_rmse(M2) ≤ 1.02 · band_rmse(best), xét trên trung bình theo N (macro) và từng N
pass: realistic_pass VÀ zero_drift_guard
report: "bản đồ pha (c × N) của tỉ số band RMSE M2/best và chênh band PCC; CI bootstrap 95% theo realization"
if_fail: "chẩn đoán λ/prior ≤ 2 tuần rồi pivot theo plan mục 9; báo cáo bất kể chiều nào"
hypotheses:
H1:
statement: "Prop 1: MSE với nhãn lệch thời gian ngẫu nhiên δ ~ N(0, σ²) cho dự đoán bị làm mờ với hàm truyền exp(−2π²σ²f²)"
setup: "c = 0, N = 16, nhãn Oracle; mỗi (giếng, cửa sổ) một δ cố định ~ N(0, σ_δ²); loss MSE trên μ; 5 seed; mọi realization"
sigma_ms: [0, 4, 8, 16, 32]
budget: ngân sách dev của MSE0 (nhãn Oracle không dịch, loss MSE theo cửa sổ)
estimator: >
Ĥ(f) = Σ Re[Y* P_σ] / Σ Re[Y* P_0] gộp mọi giếng test, realization và seed (taper Hann trên 126 mẫu);
tần số dùng: f ≥ 6 Hz, lý thuyết exp(−2π²σ²f²) ≥ 0.1 và Re S_{y,p0}(f) ≥ 10% cực đại trong băng
statistic: "r(σ) = trung bình hình học Ĥ/lý thuyết trên các tần số dùng"
reject_if: "r(σ) ∉ [0.5, 2] ở bất kỳ σ > 0 nào"
also_report: [band_std_ratio, band_pcc, band_rmse]
H3:
statement: "M2-ens hiệu chỉnh tốt hơn B5 ở drift thực tế"
cells: c = 1, mọi N
ce: "trung bình |coverage − danh nghĩa| trên 50/80/90/95%"
reject_if: "CE(M2-ens) ≥ CE(B5), hoặc CE giảm nhưng độ rộng khoảng (mean σ) > 1.2 × B5 trong khi cả NLL lẫn CRPS đều không tốt hơn"
H4:
statement: "Anchor cần thiết: bỏ anchor (chỉ vật lý) làm warp và nhãn xấu đi"
setup: >
c = 1, N = 4: M1/M2 không anchor, mẫu từ prior F3 × c với σ_b = 50 ms, wavelet pha không (pha thật của D2 —
thuận lợi cho biến thể không anchor), λ từ nhãn trung bình có trọng số M2; ngân sách = của M1/M2
reject_if: "warp RMSE (không anchor / có anchor) ≤ 1.10 VÀ band RMSE (không anchor / có anchor) ≤ 1.02 cho M2"
deferred: [M3, "lưới stress (SNR {inf, 20, 5}, mật độ anchor)", "backbone thứ hai"]

View File

@@ -0,0 +1 @@
921d01ca888da155f32bf4024bd792488b07751ed572bd390f48d19840059acd configs/protocol_p3.yaml

189
configs/protocol_p3.yaml Normal file
View File

@@ -0,0 +1,189 @@
# Protocol P3 (pre-registration; successor to protocol_p2 after gate G-B failed). Locked by SHA-256 in
# configs/protocol_p3.sha256 and git tag protocol-p3 BEFORE generating or running any of realizations 8–15.
# Every choice below is based on dev 900/901 (outputs/p2/diag, summary in outputs/p2/diag/p3dev/summary.md) and F3
# (descriptive only); no test labels of realizations 0–7 or 8–15 are used for selection. Changes after locking: new version.
# STATUS: LOCKED 2026-10-27, before realizations 8–15 were generated.
version: 1
date: 2026-10-27
supersedes: {path: configs/protocol_p2.yaml, sha256: 0733620042c4ec1b7dce447eef3ec64f915db05acbebbe5b6c977ac42e71a470}
p2_outcome: # reported as is, not rewritten
G-B: "failed — 0/4 cells at c = 1 passed (band RMSE ratio M2/best 0.985–1.045); c = 0 guard failed (macro 1.039)"
H1: "not rejected (Prop 1 matches at σ = 4–32 ms)"
H3: "rejected — CE(M2-ens) 0.278 ≥ CE(B5) 0.230"
H4: "not rejected"
diagnosis_dev: >
(dev 900/901, SNR 10, full) the M2 posterior is only 64 anchor-conditioned samples with tempered physical weights:
it does not contract to the true warp (warp RMSE 3.25 ms, 90% width 11.6 ms at c = 1 — on par with B3c 3.85 ms), so M2 ≈ B3d ≈
B3c. Seismic-conditioned SMC tempering (phase re-estimated via log Z) gives warp RMSE 0.56 ms and 90% coverage
0.97; labels at the SMC mean warp are close to Oracle. P2 therefore could not test the RML hypothesis: the failure lies in registration.
inputs:
d2_config: {path: configs/d2_synth_p3.yaml, sha256: 3b74411c42ca5e4906dad9a874dbfa81d98857d7668b204c6622c6d6e90d00c6} # generator identical to configs/d2_synth.yaml; adds regimes
warp_prior: {path: outputs/p2/warp_prior_f3.json, sha256: 55cda573c06b3a7275bdb4ac5f169fb4e5af329e1d199acc3d4daffe15624d27,
fit: matern32}
wavelet: {path: outputs/wavelets.npz, key: statistical, sha256: b689ea12578e580d8c2305c8f7219be05ff6e339884fa30b694111e968c0fc64}
budgets: {path: outputs/p2/diag/train/budgets.json, sha256: 815c6f7abc3d961255feb79bbed57a3e326cbc24cec11bbd97f455f0356e28c5}
grid:
regimes: [R10, R0, Rm5, R0h, R10tb] # configs/d2_synth_p3.yaml; full-anchor R10/R0/Rm5 for H2a, all five for H2b
drift_factors: [0, 1, 2]
realistic_drift: 1
n_train: [4, 16] # nested from the 16-well pool
realizations: [8, 9, 10, 11, 12, 13, 14, 15] # new; 0–7 already used for P2 (and the B(σ) exploration, see notes)
dev_realizations: [900, 901] # used to design P3; never used for results
seeds: [0, 1, 2, 3, 4] # network seeds; registration and SMC use seed 0 (reg_seed) as in dev
test_wells: 8 # observed at the regime SNR (test seismic is noisy too)
sigma_a_arm: # secondary, reported; sets the scope of the H2a claim (hypotheses.H2a.sigma_a_scope)
regime: R10
sigma_a_reg_ms: [3.5, 14] # data generated with σ_a = 7 ms; every method registered with the same σ_a_reg
drift_factors: [1]
n_train: [4, 16]
registration:
base: "as in protocol_p2 (MAP-II, σ_a 7 ms, σ_b 50 ms, 128 ms statistical wavelet, anchor-based constant phase) — for B3b, B3c, B3d"
phase_R: "constant phase re-estimated from the SMC log Z on the train wells (smc_fit_phase, 15° grid)"
smc:
code: ml_porosity/registration/smc_torch.py (smc_tie_posterior), same algorithm as smc.py
start: "P anchor-posterior samples (Laplace/Gauss–Newton + elliptical slice) for each well"
target: "p(warp | anchor) · p(seis | warp, wavelet phase_R)^γ, γ = 1/κ (κ = residual-ACF inflation factor at the best anchor sample; g_acf)"
tempering: "γ increased adaptively keeping ESS ≥ P/2; systematic resampling; 8 elliptical-slice steps per level; inflation 2"
particles: 1024
runs_K: 1 # one run (phase + SMC) per (realization, c, N); SMC seeds as in dev
stability:
criterion: >
registered before the trial: p95 over t of |τ̄_k(t) − τ̄_l(t)| between independent runs k ≠ l (main window),
averaged over the train wells of a cell (rid, c, N), ≤ 0.5 ms; the per-well maximum is reported alongside
dev_result: >
(SNR 10, full, rid 900/901, N 4/16) P = 256, K = 1: c = 1 passes 2/4 cells (max 0.69 ms), c = 2 0/4 (max 2.9 ms),
phase_R differs by up to 10°/26° between runs. P = 256 pooled K = 2: c = 1 4/4 (max 0.43 ms), c = 2 0/4.
P = 1024, K = 1: c = 1 4/4 (max 0.29 ms; worst well 0.86 ms), c = 2 2/4 (max 0.95 ms), phase differs
≤ 3°/9°. Cost of P = 1024 ≈ 3.3 × P = 256 per run. SNR −5, full (F3-like), P = 1024, K = 1: c = 1 passes 3/4 cells
(0.42–0.45 ms; r900 N = 4: 0.95 ms with phase_R differing by 12.6°), c = 2 0/4 (0.59–0.73 ms); relative to
σ_post (2.8 / 3.8 ms) the run-to-run p95 is ≤ 0.34 σ_post.
choice: "P = 1024, K = 1: passes at c = 1 with margin; one phase estimate (no phase mixing across runs)"
limitation: >
at c = 2 the posterior is multimodal and the mean warp is unstable between runs under every configuration tried;
c = 2 results are reported with an "unstable posterior" flag and are not primary evidence for H2a.
At low SNR the 0.5 ms criterion also fails in 1/4 cells at c = 1 (phase estimate varies between runs); this Monte
Carlo variability is small relative to σ_post but is not removed; reported as a limitation, not corrected.
training:
backbone: as in protocol_p2 (CNNGRUHetero, Adam 5e-3, full batch, 64-sample window, per-well z-score)
device: cuda:1
budgets: {Oracle: 500, B3b: 125, B3c: 250, B3c-R: 500, B3d: 250, B3d-Sa: 250, M2-Sa: 250} # iterations; from dev
# (inputs.budgets, SNR 10, c = 1); B3b, B3c, B3d, Oracle as protocol_p2; not re-selected per regime
lambda: "λ = 1/τ_c as in protocol_p2"
bank_S: 64 # M2-S: 64 particles drawn without replacement from the P particles, uniform π
methods:
Oracle: {labels: true warp, note: "reference ceiling; not a competitor"}
B3b: as in protocol_p2
B3c: as in protocol_p2 (protocol_p2 wavelet phase)
B3c-R: "B3c with wavelet phase phase_R"
B3d: "weighted mean warp of the old M2 (protocol_p2)"
B3d-Sa: "labels at the mean warp of the SMC particles (g_acf)"
M2-Sa: "RML (soft-min, λ) on a bank of 64 SMC particles (g_acf), uniform π"
ensembles: "Oracle-ens, B5 (= B3b-ens), B3c-R-ens, B3d-Sa-ens, M2-Sa-ens: 5 network seeds, μ = mean μ_s, σ² = mean σ_s² + var μ_s"
cells: "cell = (regime, c, N); all cell statistics are averaged over realization × seed as in protocol_p2"
common:
improves_seed: "mean difference (over realizations) for seed s in the hypothesized direction"
cell_pass: ">= 4/5 seeds AND > 1/2 of realizations (per realization: mean over seeds) — same rule as G-B"
ci: "95% bootstrap CI over realizations (2000 resamples) for every ratio; reported regardless of direction"
hypotheses:
H2a:
statement: "Labels from the tie posterior (SMC mean warp) beat labels from the best point tie"
method: B3d-Sa # primary; M2-Sa reported additionally under the same rule, not as a substitute
competitors: [B3b, B3c, B3c-R] # point ties, as in the statement
best_competitor: "per cell: the competitor with the smallest mean band RMSE"
improves: "band_rmse(B3d-Sa) ≤ 0.90 · band_rmse(best) OR band_pcc(B3d-Sa) ≥ band_pcc(best) + 0.05 (protocol_p2 rule)"
regimes: [R10, R0, Rm5] # full anchors; one verdict per regime
regime_pass: "cell_pass at c = 1 for both N, AND zero_drift_guard of the same regime"
zero_drift_guard: "at c = 0 of the same regime: band_rmse(B3d-Sa) ≤ 1.02 · band_rmse(best), macro over N and for each N"
pass: >
H2a passes if R10 passes. The claim is scoped to the regimes that pass; Rm5 (the F3-like regime, notes.f3_placement)
is reported as a separate pre-registered verdict, and no claim is made for a regime that fails.
sigma_a_scope: >
the H2a rule applied to grid.sigma_a_arm (no c = 0 guard). If it fails for a σ_a_reg, the paper states that the
H2a result requires a correctly specified anchor uncertainty σ_a. Dev: fails for both 3.5 and 14 ms (notes.sigma_a_stress).
secondary_vs_B3d: >
same rule with competitors [B3b, B3c, B3c-R, B3d], where B3d is the protocol_p2 M2 mean warp (an anchor-conditioned
posterior mean with tempered physical weights, not a point tie). Reported per regime; a claim that SMC labels beat the
P2 anchor posterior is made only for regimes where this passes. Added after dev showed B3d is the strongest
competitor at SNR 0 and −5 dB.
dev_result: >
(900/901, 5 seeds; with 2 dev realizations cell_pass needs both) point-tie competitors, c = 1, N = 4 / 16:
R10 ratio 0.85 / 0.76 (pass / pass; c = 0 guard 0.85 / 0.77 with 2 seeds); R0 0.87 / 0.89, ΔPCC +0.11 / +0.07
(pass / 1 of 2 realizations); Rm5 0.94 / 0.95, ΔPCC +0.10 / +0.08 (pass / 1 of 2). Including B3d: R10 unchanged
(B3d is not best at c = 1); R0 0.91 / 0.90 and Rm5 0.98 / 0.95 against B3d (no cell passes). c = 2: R10 ratio
0.91 / 0.83 but improves in 1 of 2 realizations (unstable posterior, see registration.smc.stability).
H2b:
statement: >
RML on the posterior bank beats posterior-mean labels when the tie posterior is wide, the gain increases with
σ_post, and RML costs at most 2% band RMSE when the posterior is narrow
ratio: "band_rmse(M2-Sa) / band_rmse(B3d-Sa) per cell"
sigma_post: "from SMC particles of the train wells (notes.sigma_post); no labels used; mean over realizations"
wide: "σ_post ≥ 1.5 ms (Prop 1: 50 Hz transfer factor ≤ 0.90)"
primary_n: 16
tests:
a_wide_gain: "at N = 16, M2-Sa < B3d-Sa (cell_pass) in ≥ 2/3 of wide cells"
b_dose: "at N = 16, Spearman ρ(σ_post, ratio) over all cells (c ∈ {0, 1, 2} × regime) < 0; one-sided permutation p reported"
c_narrow_guard: "at N = 16, mean ratio over narrow cells (σ_post < 1.5 ms) ≤ 1.02 (no-harm guard; a gain there is not required)"
pass: "a AND b AND c"
secondary_n4: >
N = 4 reported only (no claim): on dev the gain is smaller and unstable (ratio < 1 in 16/19 wide cells;
SNR −5/full ratio 1.02).
mechanism_note: >
Do not attribute the gain to deblurring (Prop 1) unless the measured ratio lies within the bound 1/B(σ_post) (notes.blur_bound):
on dev at SNR −5 the 4% gain exceeds the bound of ≈ 0–2% (docs/theory.md §1.4).
H3:
status: "not tested as a hypothesis in P3; reported descriptively (decided on dev before locking)"
reason: >
dev h3_smc (900/901, SNR 10, full, 5 seeds; CE as in protocol_p2) at c = 1 / 2, N = 16: CE(B5) 0.113 / 0.152,
CE(B3d-Sa-ens) 0.298 / 0.319, CE(M2-Sa-ens) 0.318 / 0.335, CE(Oracle-ens) 0.389 / 0.366 (N = 4: 0.31 / 0.29 vs
0.45 / 0.41 / 0.45 / 0.48). Every ensemble trained on better labels under-covers more than B5, and the ensemble
trained on the true warp is the worst calibrated. CE against B5 therefore rewards label noise that widens the
predicted σ, not propagation of tie uncertainty: a seed ensemble of the heteroscedastic network does not carry
the tie posterior to the test wells. Testing H3 as in protocol_p2 cannot inform the posterior-label question.
reported: "for each ensemble at c = 1 per regime and N: CE, coverage 50/80/90/95%, NLL, CRPS, mean σ, with bootstrap CI"
claim_forbidden: "no claim that posterior-label ensembles are calibrated or better calibrated than B5"
notes:
sigma_post: "σ_post = (90% width of τ(t) over the main window, mean over train wells) / 3.29; computed from particles, no labels used"
sigma_a_stress: >
(dev 900/901, SNR 10, full, estR, g_acf; data generated with σ_a = 7 ms) registering with the correct σ_a gives warp RMSE
0.56/1.63 ms and 90% coverage 0.97/0.93 at c = 1/2. With σ_a = 3.5 ms (anchors over-trusted): RMSE 5.9/5.7 ms, coverage
0.45/0.54. With σ_a = 14 ms: RMSE 3.1/3.4 ms, coverage 0.50/0.75, σ_post 1.1/1.8 ms (overconfident). The SMC posterior
is calibrated only when σ_a is correct, in both directions. All P3 D2 results use the correct σ_a and are therefore
optimistic about registration; on F3 σ_a is not known (TD markers are not independent checkshots). Training under
misspecified σ_a: dev train_sa (900/901, 5 seeds, every method registered with the same σ_a), B3d-Sa / best point tie
at c = 1, N = 4 / 16: σ_a = 3.5 ms 1.08 / 1.18, σ_a = 14 ms 1.04 / 0.96 (0/4 cells pass at c ∈ {1, 2} in both cases);
M2-Sa / best: 1.04 / 1.10 and 0.98 / 0.93. The H2a advantage on dev depends on a correctly specified σ_a.
blur_bound: >
B(σ) = band_rmse(Gaussian blur_σ of the Oracle prediction μ) / band_rmse(μ), per regime and N, from the Oracle
predictions of the main run (descriptive; used only for mechanism_note, never for selection). If B3d-Sa labels carry
N(0, σ_post²) timing errors and RML removed them fully, the best attainable M2-Sa/B3d-Sa ratio is ≈ 1/B(σ_post).
Dev: SNR 10, full, N = 16: B(1.5 / 2 / 3 ms) = 1.015 / 1.044 / 1.157; N = 4: 0.98 / 0.98 / 1.01. SNR −5, full:
B ≤ 1.003 up to 3 ms for both N (noisy inputs already smooth the prediction), yet M2-Sa/B3d-Sa = 0.96 at N = 16.
f3_placement: >
descriptive only (scripts/16, 4 F3 wells, P = 256, never used to choose γ, P, λ or budgets). Under the protocol
registration (σ_a = 7 ms): σ_post 2.5–3.4 ms (g_acf), κ 1.7–2.6, r_post 0.24–0.57, run-to-run p95 0.63–1.31 ms,
i.e. close to Rm5 (dev σ_post ≈ 3.0 ms at c = 1). With the type-II ML σ_a of scripts/09 (≈ 0.4 ms, treating TD
markers as exact): σ_post 0.56–0.64 ms, i.e. narrower than R10. Since the SMC posterior is calibrated only for the
correct σ_a (notes.sigma_a_stress) and σ_a is not identifiable on F3, F3's place on the σ_post axis is uncertain
between these two ends; no F3 claim is drawn from the D2 regime results.
wording: # plan §10 + prior literature
prior_art: >
Uncertainty in the time–depth tie is not new: Gunning & Glinsky (2006) cast the tie as MAP + a Laplace approximation of the
time–depth posterior; Buland & Omre (2003) sample marker shifts by MCMC. SMC tempering here is a tool, not a
contribution. The contribution under test: using the tie posterior as training labels (posterior mean or RML on a bank).
forbidden: ["first", "novel", "new posterior tie",
"F3 labels called porosity without stating they are linear in DT",
"calibration/conformal assuming i.i.d. time samples",
"generalizing to the field from synthetic results",
"TD markers as independent checkshots",
"geologically plausible without a metric",
"tuning on test labels", "claims about λ (λ = 1/τ_c kept fixed; no evidence that a variant is better)"]