Closed ablaom closed 3 years ago
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?