KNN Implementation

plt.scatter(X[ : ,0], X[ : ,1]) here why did we plot columns of X on different axes?

Hi, if your X has two features lets say X denotes dog name and lets say bruno the labra dog(a point in some space) has 2 features-(height and weight). Now for seeing where the point lies in the space we are plotting X[:,0] AND X[:,1]. Its just like plotting x and y for a line’s equation where a line has two variable features x and y for the equation y-mx+c=0. So just like that x[:,0]=x and x[:,1]=y. SO we are plotting these.

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.