Repository navigation
Commit 9f4176b
committed
fix(metrics): count true positives for bool inputs in get_confusion_matrix
get_confusion_matrix finds true positives with (y_pred + y) == 2. For bool
tensors that sum is a logical OR, which is never 2, so bool masks such as
pred > 0.5 lost every true positive: a perfect prediction scored
sensitivity 0 and F1 0. Cast bool inputs to float before counting; float
and integer inputs are unchanged.
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: tritsystem <gbranaa4@gmail.com>1 parent 6aa4abf commit 9f4176b
2 files changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
166 | 173 | | |
167 | 174 | | |
168 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
292 | 304 | | |
293 | 305 | | |
294 | 306 | | |
0 commit comments