How to Solve NameError: name 'KNeighborsClassifier' is not defined -- sklearn

Solution: Import the 'KNeighborsClassifier' module

To Solve the error, add the following line to the top of your code.

from sklearn.neighbors import KNeighborsClassifier

 

For more information:
Python sklearn KNeighborsClassifier