Skip to content

Naive Bayes Classifier with Mixed Bernoulli/Gaussian Models #12957

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

Open
jarednielsen opened this issue Jan 11, 2019 · 8 comments · May be fixed by #22574
Open

Naive Bayes Classifier with Mixed Bernoulli/Gaussian Models #12957

jarednielsen opened this issue Jan 11, 2019 · 8 comments · May be fixed by #22574

Comments

@jarednielsen
Copy link

jarednielsen commented Jan 11, 2019

Description

I suggest allowing mixed datasets (half binary variables, half real-valued variables) into the Naive Bayes classifier. Currently the GaussianNB and BernoulliNB classes handle one case or the other, but not combined. I'd be happy to write the code for this, so I'm curious if this has been explored before and if it would be helpful!

For example, on the Titanic dataset, gender is a bernoulli variable while age is real-valued. Passing both into a Naive Bayes classifier would improve it.

This is related to this currently pending PR: #12569

@jnothman
Copy link
Member

jnothman commented Jan 13, 2019 via email

@timbicker
Copy link
Contributor

Hi @jarednielsen ,
I am currently working on PR #12569, and I am soon ready to change the status of my PR from WIP to MRG. I am mentioning this because I have refactored the other naive Bayes classifiers and the naive Bayes tests, as well.
I would, therefore, recommend to look into my PR, to avoid any merge conflicts as good as possible. And further, it might decrease your total time spent on the PR, because I did the refactoring with the intention of making the code more understandable.

@timbicker
Copy link
Contributor

I personally would appreciate it, if the general/mixed naive Bayes classifier would also work with the other NB classifiers and not only with Gaussian and Bernoulli.
I am not sure if there is a use case to combine Multinomial with other NB classifiers, but I think categorical does make sense.

@jarednielsen
Copy link
Author

I agree, we should make the general NBC as, well, general as possible :) Let me know when you've merged PR #12569!

@jnothman
Copy link
Member

jnothman commented Jan 22, 2019 via email

@FlorianWilhelm
Copy link
Contributor

@jarednielsen Are you working on this? As @jnothman already said, you could also start to work on a GeneralNB even if the CategoricalNB is not merged right now. Let @timbicker and me know if you need any pointers or want to discuss something. We would like to support this endeavour.

@gautam-e
Copy link

gautam-e commented Nov 11, 2021

I think a Mixed / General Naive Bayes classifier that allows one to mix and match the already available sklearn implementations of Naive Bayes with categorical and continuous columns is a use case that has been left unattended. It has been asked several times on Stackoverflow etc. with mostly pretty unsatisfactory answers. I have already derived and written some code that does this but have never made a PR before. Would be happy to team up on this @jarednielsen

@avm19
Copy link
Contributor

avm19 commented Feb 18, 2022

take

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

Successfully merging a pull request may close this issue.

7 participants