Error when running the knn solution

Error when running the knn solution

by Matvey Tymchenko -
Number of replies: 2

Hello, I'm completely lost. I tried reinstalling all the files and miniconda itself, but when I simply run this cell in the solution file or the normal file it gives me this error (I've run the previous cells as well beforehand). Can you please help me ?

In reply to Matvey Tymchenko

Re: Error when running the knn solution

by Zhen Wei -
Hi Tymchenko! Not very sure about the exact reason for your error. One possible guess is maybe you are using win64 platform and the default int type for numpy (or C long) is int32, rather than int64 as we usually assume.
To solve it, you can try modify the code from 'np.bincount(labels_train)' to 'np.bincount(labels_train.astype(np.int32))' to see whether it works.
In reply to Zhen Wei

Re: Error when running the knn solution

by Matvey Tymchenko -
Hi, thanks a lot for your answer. It was indeed a problem with windows. I searched around before writing here but didn't find any information. Your suggestion worked, but I will work inside of a wsl instead because it's not just this cell. Thanks a lot again!