Commit 4c8f630
Fix ranking_ci zero-division when comparing a feature to itself
Two fixes from dependency audit:
1. _inference.py: guard in ranking_ci() when both arguments name the same
feature. diff==0 and SE==0 (rho_a - rho_b is the zero vector), so
0/0 produced z_stat=inf. Return z_stat=0.0, p_value=1.0 in this case —
the null of equal importance trivially holds when comparing a feature
against itself.
2. test_inference.py: test_wrong_feature_names_length_raises was matching
against "n_features" which no longer appears in the ValueError message.
Updated regex to match the actual message "len(feature_names)=...".
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ad0fef5 commit 4c8f630
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
586 | 591 | | |
587 | 592 | | |
588 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| |||
0 commit comments