Commit 196f910
Reject negative-dose samples in mse_optimal_bandwidth (P1)
CI AI review P1: mse_optimal_bandwidth did not enforce the HAD
support requirement D_{g,2} >= 0. Negative-dose samples could
silently pass through both boundary branches: boundary=0 (accepted
via _at_zero even with d_min<0) and boundary=float(d.min()) (accepts
any lower edge). The symmetric nprobust kernel would happily
calibrate a two-sided interior bandwidth while the downstream
one-sided fitter runs on [boundary, boundary+h] -- silent
assumption violation.
Front-door check added: np.any(d < 0) raises ValueError with a
message citing the paper's support assumption.
Two new regression tests:
- test_negative_dose_rejected_boundary_zero: d ~ U(-0.5, 0.5) with
boundary=0 raises.
- test_negative_dose_rejected_boundary_at_d_min: d ~ U(-1, -0.1)
with boundary=d.min() raises.
Deferred (P3 same as last round): tri/uni/shifted-boundary golden
parity extension. All three kernels share lprobust_bw, so epa parity
transitively covers kernel dispatch.
177 tests pass (up from 175).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 044baed commit 196f910
2 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
625 | 644 | | |
626 | 645 | | |
627 | 646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
379 | 397 | | |
380 | 398 | | |
381 | 399 | | |
| |||
0 commit comments