Commit 3be5ed0
committed
fix: error for large sample sizes in Multinomial NB
I was seeing SystemStackError issues with Multinomial NB when running
with larger sample sizes. I believe this is due to splatting the
samples into `Numo::DFloat` as params. That param list can be very
large with large sample sets, which overflows Ruby's default heap
size.
I think instead we can use `Numo::DFloat.cast` here, passing in the
array, as that will just be a single param.
I've also lifted this cast to the `bin_x` variable so we don't have to
do it per class.1 parent fd12b80 commit 3be5ed0
File tree
2 files changed
+14
-2
lines changed- rumale-naive_bayes
- lib/rumale/naive_bayes
- spec/rumale/naive_bayes
2 files changed
+14
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
0 commit comments