-
Notifications
You must be signed in to change notification settings - Fork 19
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
Bug in MultinomialNB? Incorrect calculation of P(x|c). #42
Comments
Yes, this package was created in prehistoric times and has never been seriously reviewed since then, so it's pretty possible it contains even trivial bugs. I might have had something different in my mind at the time of writing, but looking at the code now I believe you are right. This may also be the reason for #40. If you post a PR fixing this I'll try to review it within 12 hours. |
Okay, I'm going to try and get a PR for this during the next week. |
I am struggling to understand the code below from NaiveBayes.jl/src/multinomial.jl. It seems to me that the denominator in
x_priors_for_c = m.x_counts[c] ./ m.x_totals
is incorrect. Rather, the denominator should besum(m.x_counts[c])
, no?Since the test code for MultinomialNB is not very thorough, this could easily have been missed.
@dfdx Assuming you agree this is a bug, if I create a PR with a correction, plus rigorous test, would you consider reviewing in near future?
The text was updated successfully, but these errors were encountered: