[ENH] Naive Bayes: Implement predict, fix predict_storage#3540
[ENH] Naive Bayes: Implement predict, fix predict_storage#3540janezd merged 4 commits intobiolab:masterfrom
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
janezd
left a comment
There was a problem hiding this comment.
@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. |
|
|
||
| def predict_storage(self, data): | ||
| if isinstance(data, Instance): | ||
| data = Table(np.atleast_2d(data.x)) |
There was a problem hiding this comment.
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
predictto:predict_storagenow callspredictwhen possible.predict_storagealso didn't work forInstance. Fixed.Includes