Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultinomialNB fails when features have negative values #176

Open
sunnmy opened this issue Mar 30, 2016 · 2 comments
Open

MultinomialNB fails when features have negative values #176

sunnmy opened this issue Mar 30, 2016 · 2 comments

Comments

@sunnmy
Copy link
Contributor

sunnmy commented Mar 30, 2016

On my dataset machineJS failed because it was trying to use negative X values with multinomial Naive Bayes classifier.

Suggested solutions:

  • Skip MultinomialNB when some of the features have negative values.
  • Use GaussianNB instead.
  • Normalize features to [0, 1] range.
@ClimbsRocks
Copy link
Owner

Sweet, thanks for pointing that out! Out of curiosity, did the entire process break at that point, or did the rest of it continue to run with only MultinomialNB failing?

Your suggested solutions are solid. We're already doing feature normalization in data-formatter, so it shouldn't be too hard to expand that here. The other two look very straightforward as well. If you wanted to take a crack at any of those solutions, that'd be an easy PR to merge!

Thanks for reporting this! Keep the issues coming :)

@muffin-head
Copy link

multinomial don't take neg values, so while preprocessing numerical data best use is minmaxscaler()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants