Reputation: 173
I am working on jupyter notebook on a python assignment and I am trying to import KNearestNeighbor from sklearn but I am getting the error:
ImportError: cannot import name 'KNearestNeighbor' from 'sklearn' (C:\Users\michaelconway\Anaconda3\lib\site-packages\sklearn__init__.py)
I have checked and I do have sklearn installed: version 0.22
Any ideas please?
Upvotes: 1
Views: 2217
Reputation: 21
from sklearn.neighbors import KNeighborsClassifier
If you are working on jupyter notebook on a python assignment and you are trying to import KNearestNeighbor from sklearn but you are getting an error: IMPORT ERROR
then try
from sklearn.neighbors import NearestNeighbors
Upvotes: 0
Reputation: 6173
I have never seen KNearestNeighbor
in sklearn. There is two thing you can do instead of KNearestNeighbor
from sklearn.neighbors import KNeighborsClassifier
or
from sklearn.neighbors import NearestNeighbors
I think 1st option is the option which you want now
Upvotes: 3