Commit 8d24377
authored
fix: add epsilon to prevent ZeroDivisionError in BPR-based models (#686)
The BPR zero-division fix (+ 1e-8) was previously applied to
recom_bpr.pyx but not to other models that use the same pattern:
- cornac/models/companion/recom_companion.pyx
- cornac/models/comparer/recom_comparer_sub.pyx
- cornac/models/lrppm/recom_lrppm.pyx
When all samples are skipped (e.g., on very small datasets),
the denominator (n_samples - skipped) becomes 0, causing a
ZeroDivisionError during training progress display.
Related to #6751 parent 81e88df commit 8d24377
File tree
3 files changed
+3
-3
lines changed- cornac/models
- companion
- comparer
- lrppm
3 files changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
475 | | - | |
| 475 | + | |
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| |||
0 commit comments