-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[ENH] Naive Bayes: Implement predict, fix predict_storage #3540
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3540 +/- ##
==========================================
+ Coverage 83.95% 83.97% +0.01%
==========================================
Files 370 370
Lines 66876 66920 +44
==========================================
+ Hits 56146 56193 +47
+ Misses 10730 10727 -3 |
6116c1b
to
49a5b4a
Compare
49a5b4a
to
0dddfc8
Compare
Ok, I like the change. But why did you decide not route Instance (transformed to Table now) through predict also? If I do it, I see that code to compute probabilities in predict_storage is not run anymore. :) We should hardcode some actual probabilities into tests. We do not have any test that checks actual results (comparing CA does not count; these tests should be removed, I think). |
357861e
to
33b6e55
Compare
33b6e55
to
9f3ce8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markotoplak, I routed Instance
through predict
and wrote tests that actually check probabilities against those I computed manually.
I removed almost all existing tests but I kept the testing of CA as an (admittedly insensitive) sanity check. |
Good to have good tests (I did not redo your calculations though), thanks. It must have been a little late while you were coding this. :) I added two commits. I added the code from the last commit just for my testing, but then I added it, because it makes tests more explicit. |
@@ -48,10 +48,10 @@ def __init__(self, log_cont_prob, class_prob, domain): | |||
self.class_prob = class_prob | |||
|
|||
def predict_storage(self, data): | |||
if isinstance(data, Instance): | |||
data = Table(np.atleast_2d(data.x)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I somehow thought I've done this correctly. (But I have no good explanation for assert_not_called
in tests. :))
Please check if I did something stupid and then merge at will (you can also rebase if you want). |
Implement
predict
to:predict_storage
now callspredict
when possible.predict_storage
also didn't work forInstance
. Fixed.Includes