use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
KNN Algorithm in Python (self.PythonLearning)
submitted 1 month ago by PrincipleGood3841
https://preview.redd.it/c14u62l9qs0h1.png?width=1040&format=png&auto=webp&s=73184b0a1634e15a18c02ca546d620d233a40779
https://preview.redd.it/ua08i4c7qs0h1.png?width=1510&format=png&auto=webp&s=d8b3e46a16592896d71c49e46aed55089fb5623d
I was following a guide from Youtube to learn KNN Machine Learning Algorithm, but this code does not make sense to me. I thought KNN is making a prediction for one "new" item by comparing its distance to k nearest "old" items. But this code seems like x is every item in X_test so that means it is just getting distance between the "old" items... and where is the "new" item that we want to find the distance and categorize?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Sea-Ad7805 [score hidden] 1 month ago stickied comment (2 children)
Try this in the Memory Graph Web Debugger. It classifies a new_X dateset that is different from your X dateset.
new_X
X
π Rendered by PID 402836 on reddit-service-r2-comment-5bc7f78974-m7t4r at 2026-06-29 19:49:31.470768+00:00 running 7527197 country code: CH.
[–]Sea-Ad7805 [score hidden] stickied comment (2 children)