HI , the query point used in the video generates a different set of values in my code.
I am getting class 0 for k=5 for the point(2,3) using the same code
while in the video there are 2 class 1 as well
Link to the code-
KNN -Not getting the correct output as per the video
Hi, there is a bug in your code. Inside “dist” function you are doing np.sqrt(sum(x1-x2)**2). But it should be np.sqrt(sum((x1-x2)**2)) , as first we have to square the difference and then sum those (x1-x2)**2 terms. In your code you are first performing summation of (x1-x2) and then squaring the term.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.