import failure for sklearn.naive_bayes.ComplementNB
See original GitHub issueDescription
Attempting to import ComplementNB produces an import error (ImportError: cannot import name ‘ComplementNB’)
Steps/Code to Reproduce
from sklearn.naive_bayes import ComplementNB
Note: produces the same result in terminal, a jupyter notebook, and the https://www.python.org/shell/ online shell
Expected Results
No error is thrown.
Actual Results
ImportError: cannot import name 'ComplementNB'
Versions
Darwin-17.6.0-x86_64-i386-64bit
Python 3.6.4 (default, Mar 9 2018, 16:06:49)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]
NumPy 1.14.2
SciPy 1.0.1
Scikit-Learn 0.19.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
sklearn.naive_bayes.ComplementNB
Fit Naive Bayes classifier according to X, y. Parameters: X{array-like, sparse matrix} of shape (n_samples, n_features) Training vectors, where n_samples is ...
Read more >Complement Naive Bayes and weighted class in sklearn
I'm trying to implement a complement naive bayes classifier using sklearn. My data have very imbalanced classes (30k samples of class 0 and...
Read more >Source code for sklearn.naive_bayes - Diffprivlib
The :mod:`sklearn.naive_bayes` module implements Naive Bayes algorithms. These are supervised learning methods based on applying Bayes' theorem with strong ...
Read more >Naive bayes - OCaml scikit-learn interface
BaseDiscreteNB wraps Python class sklearn.naive_bayes. ... 5, 6]) >>> from sklearn.naive_bayes import ComplementNB >>> clf = ComplementNB() >>> clf.fit(X, ...
Read more >Scikit-Learn - Naive Bayes Classifiers
GaussianNB; ComplementNB; MultinomialNB; CategoricalNB; Summary Of Results; Naive Bayes for Large Datasets. We'll start by importing the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i am having the same problem even though i have scikit-learn of version 0.21 this is the error message i am getting
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'CategoricalNB' from 'sklearn.naive_bayes' (C:\ProgramData\Anaconda3\lib\site-packages\sklearn\naive_bayes.py)
CategoricalNB should be present from Scikit-learn 0.22. If that is installed (check
sklearn.__version__
), then you’ve confused your environments or something. We really aren’t able to help resolving such issues, but suggest uninstalling and reinstalling, and checking that the environment you’re running in is the same that you’re installing into.