question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

import failure for sklearn.naive_bayes.ComplementNB

See original GitHub issue

Description

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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

11reactions
SadafShaficommented, Feb 5, 2020

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)

0reactions
jnothmancommented, Aug 4, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found