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

Poisson naive Bayes classifier (PoissonNB) #3708

Closed
wants to merge 1 commit into from

Conversation

BrianLondon
Copy link

Added PoissonNB class to naive_bayes.py to implement a Poisson naieve Bayes classifier. Poisson classifiers have important applications in systems neuroscience. See: Ma et Al. Bayesian inference with probabilistic population codes Nat. Neuroscience 9:1432 (2006).

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 5377e75 on BrianLondon:master into 5569035 on scikit-learn:master.

X = check_array(X)

joint_log_likelihood = []
for i in range(np.size(self.classes_)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.size(self.classes_) -> len(self.classes_)

@agramfort
Copy link
Member

looks clean

you'll need to add proper tests and some narrative doc to explain for what type of data this model is useful.

@BrianLondon
Copy link
Author

By narrative doc, do you mean expand the class docstring or somewhere else?

@jnothman
Copy link
Member

Narrative as distinct from docstrings, examples and tutorials: stuff in
doc/modules

On 27 September 2014 23:36, BrianLondon notifications@github.com wrote:

By narrative doc, do you mean expand the class docstring or somewhere
else?


Reply to this email directly or view it on GitHub
#3708 (comment)
.

>>> clf.fit(X, y)
PoissonNB()
>>> print(clf.predict(X))
[1 1 1 2 2 2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add here a reference paper which includes the derivation?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 14a4820 on BrianLondon:master into 5569035 on scikit-learn:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 954c2e0 on BrianLondon:master into 5569035 on scikit-learn:master.

@@ -0,0 +1,91 @@
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this file here?

same for out.txt

looks like something went wrong in this PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I checked in four working files by mistake, then only pulled two back out.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll need to squash commits to remove these files from history

Poisson classifiers have important applications in systems neuroscience.
See: Ma et Al. Nat. Neuroscience 9:1432 (2006).

Added some tests specifically for the PoissonNB class.
Implemented some of the TODOs in test_naive_bayes.py while I was in there.

Added documentation of PoissonNB to naive_bayes.rst and some details
to the docstring in naive_bayes.py.

Adding documentation for PoissonNB class.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 07a91e6 on BrianLondon:master into 74b9563 on scikit-learn:master.

@BrianLondon
Copy link
Author

Added previous round (including PEP8) fixes and rebased.

for i in range(np.size(self.classes_)):

joint_log_likelihood = np.zeros((np.shape(X)[0],
np.size(self.classes_)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.size -> len

@BrianLondon
Copy link
Author

Closing stale PR. I'll reopen if I get time to work on this again.

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

Successfully merging this pull request may close these issues.

None yet

5 participants