samkit-jain/Handwriting-Recognition

ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 165

saurabhbidwai opened this issue · 2 comments

Enter choice - 2
Traceback (most recent call last):

File "", line 164, in
recognise_letter()

File "", line 136, in recognise_letter
plt.title('letter is ' + clf.predict([gray_letter])[0])

File "C:\Users\DELL\Anaconda3\lib\site-packages\sklearn\neighbors\classification.py", line 145, in predict
neigh_dist, neigh_ind = self.kneighbors(X)

File "C:\Users\DELL\Anaconda3\lib\site-packages\sklearn\neighbors\base.py", line 347, in kneighbors
(train_size, n_neighbors)

ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 165

Did you train the model? If yes, how?

I have done a code rewrite and you won't be facing this error anymore. Please reopen this if the issue persists.