k-NN classification can be realized in two ways:a. Selecting for the classified sample its k nearest neighbors for  each class, and computing the neighborhood radius $r_i$ for each of  the classes. As the result of classification, we select class $i$, for  which its radius $r_i$ is smallest.b. Selecting for the classified sample its k nearest neighbors in  the training set (without taking class labels into account in this  step). As the result of classification we select class $i$ which is  most numerous in the set of k nearest neighbors of the classified  sample.Can you rephrase the above two ideas for a beginner in layman's terms?Let $k=5$.As I understand it,(a) We know all the classes beforehand. I.e. we know that there are 2 classes RECTANGLE, TRIANGLE. We would select 05 RECTANGLE neighbors of the new sample, and 05 TRIANGLE neighbors of the new sample. Then we would calculate their radii. Suppose, we have $R\{rr_1, rr_2, rr_3, rr_4, rr_5\}$ from RECTANGLE-class and  $T\{tr_1, tr_2, tr_3, tr_4, tr_5\}$ from TRIANGLE class. Now, we would test to see whether the set $R$ or set $T$ has smaller values. Suppose, $T$ has smaller values. Then, we would assign the class $T$ to our new sample. Am I correct?But, still, my question is, how can we determine which set has the smaller values? Do, we find the mean of each of the classes?(b) We would select 05 neighbors of our new sample by calculating radii from each of them. In the figure, we see that in the dotted circle, there are 03 RECTANGLEs and 02 TRIANGLEs. So, we can take decision that our new sample is a RECTANGLE.Am I correct?If I am correct in both occasions, can you please tell me what are the names of those approaches?
Two approaches of implementing k-NN classification algorithm
classification;algorithms