Commit 5799d42
Address CI AI review: boundary check, stage guards, docstring refresh
P1 #1 (methodology): mse_optimal_bandwidth now rejects boundary > d.min()
with a clear ValueError. The Phase 1b wrapper is scoped to the HAD
lower-boundary case (Design 1' with d_0 = 0 or Design 1 continuous-near-
d_lower with d_0 = min D_2). Interior or upper-boundary inputs would
silently run the boundary selector with a symmetric kernel and return
a bandwidth incompatible with the one-sided fitter. The port remains
available for interior / broader surface via
_nprobust_port.lpbwselect_mse_dpi.
P1 #2 (code quality): lprobust_bw validates in-window observation
counts at each of the three local-poly fits before calling qrXXinv:
- variance: n_V >= o+1
- B1: n_B1 >= o_B+1
- B2: n_B2 >= o_B+2
Each guard raises a targeted ValueError naming the failing stage, the
bandwidth, and suggested remediation. Previously these failed with
opaque LinAlgError from Cholesky on under-determined designs.
P3 (doc): local_linear.py module docstring updated to say Phase 1b
"ships" instead of "will add"; tiny-sample test now asserts the new
ValueError contract instead of accepting any non-IndexError failure.
New behavioral tests:
- test_interior_boundary_rejected: boundary=0.5 on U(0,1) rejected
- test_upper_boundary_rejected: boundary=d.max() rejected
- test_boundary_equal_to_min_d_accepted: boundary=min(d) accepted
(Design 1 continuous-near-d_lower path)
- test_boundary_below_min_d_accepted: boundary=0 with d.min()>0
accepted (Design 1' path)
- test_bwcheck_none_on_tiny_sample_raises_valueerror: upgraded from
"catch anything non-IndexError" to pytest.raises(ValueError,
match="lprobust_bw").
153 tests pass (up from 149).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c125e7c commit 5799d42
3 files changed
Lines changed: 108 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
374 | 383 | | |
375 | 384 | | |
376 | 385 | | |
| |||
383 | 392 | | |
384 | 393 | | |
385 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
386 | 403 | | |
387 | 404 | | |
388 | 405 | | |
| |||
443 | 460 | | |
444 | 461 | | |
445 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
446 | 470 | | |
447 | 471 | | |
448 | 472 | | |
| |||
493 | 517 | | |
494 | 518 | | |
495 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
496 | 527 | | |
497 | 528 | | |
498 | 529 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
603 | 605 | | |
604 | 606 | | |
605 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
606 | 636 | | |
607 | 637 | | |
608 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
264 | 260 | | |
265 | 261 | | |
266 | 262 | | |
267 | 263 | | |
268 | | - | |
| 264 | + | |
269 | 265 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
274 | 305 | | |
275 | 306 | | |
276 | 307 | | |
| |||
0 commit comments