fix: error for large sample sizes in Multinomial NB#51
Merged
yoshoku merged 1 commit intoyoshoku:mainfrom Oct 21, 2025
Merged
Conversation
Owner
|
@keegnotrub Thank you for your contribution. The CI is failing due to RuboCop and commitlint validations. Please fix the issues detected by RuboCop. Also, this project adopts conventional commits. Please squash the commits and revise the commit messages accordingly. |
Contributor
Author
No problem. I should be able to get to this today. CI wasn't running yesterday (AWS issues) so I didn't notice these, apologies! |
9ed577d to
73e9296
Compare
Contributor
Author
|
Should be ready now, TY! |
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.
73e9296 to
3be5ed0
Compare
Owner
|
@keegnotrub Thanks for this fix. This has been included in version 2.0.1: https://rubygems.org/gems/rumale-naive_bayes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::DFloatas 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.casthere, passing in the array, as that will just be a single param.