
Introduction to K-nearest neighbour algorithm using Sklear - shsharma
https://ranvir.xyz/blog/k-nearest-neighbor-algorithm-using-sklearn-distance-metric/
======
atty
Unless I am not understanding something, this appears to have multiple
incorrect statements in it, for instance:

> It first identifies the k points in the training data that are closest to
> the test value and calculates the distance between all those categories. The
> test value will belong to the category whose distance is the least.

There is no distance measure in deciding a category. The distance measure is
used to find the N nearest neighbors. Once those neighbors are found, the
class of the new data point is assigned based on the relative number of
entities of each class in the N neighbor set (always taken as the most common
class in the neighbor set, as far as I am aware).

------
BorisTheBrave
This reads weird. Either this is transcribed lecture notes, or the author is
not that fluent an English speaker. Either way, I think somone unfamiliar with
KNN would struggle to learn anything from this.

~~~
mattkrause
To be a little more constructive:

The probabilistic interpretation is odd, since it can only produce a few
(maybe even one!) distinct values.

$k$ should probably be chosen to avoid ties (e.g., odd for a two-class
problem) so you always get exactly one answer, and you should definitely chose
$k$ using different data than you use to evaluate the model (e.g., validation
set or inside a cross-validation loop).

------
jorblumesea
This is a bit confusing if you're not already familiar with KNN. A simple
example using heap or some of the more basic data structure oriented
approaches.

------
CyberDildonics
Finding nearest neighbors isn't an algorithm, it is a goal. There are many
different algorithms to accomplish that. This is more about what certain
functions do in python.

~~~
shsharma
Not sure where in the post you felt that the finding nearest neighbour is
considered as an algorithm. Couldn't agree with you less, anyway.

~~~
CyberDildonics
The title is "Introduction to K-nearest neighbor algorithm"

The first sentence is "KNN also known as K-nearest neighbor is a supervised
and pattern classification learning algorithm"

If someone said 'the triangle rendering algorithm' they would be asked 'which
triangle rendering algorithm'.

