Commit 49905a2
committed
fix: guard against ZeroDivisionError in Comparitor._calc_stats
When there are no reference annotations (tp + fn == 0) or no test
annotations (n_test == 0), computing sensitivity and positive
predictivity raises ZeroDivisionError. Return NaN instead, matching
the convention used by sklearn.metrics for undefined ratios.
Fixes #2781 parent 6850ad1 commit 49905a2
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
0 commit comments