Mnist project 11111111

I am getting this while training the mnist in knn model:

ValueError Traceback (most recent call last)
in ()
----> 1 pred=knn(x_train,y_train,x_test,1)

in knn(X, Y, queryPoint, k)
11
12
—> 13 vals = sorted(vals)
14 # Nearest/First K points
15 vals = vals[:k]

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Hey vibhor,
Can you please provide me your code on cb.lk/ide You might be doing something wrong while calculating distance or in knn algorithm.
Would be waiting

Thanks :slight_smile:

my code is at :https://ide.codingblocks.com/s/135237

Hi,
In distance formula use np.sqrt(np.sum(x1-x2)**2)

Thanks :slight_smile: