0

How does the KNeighborsClassifier work?

In the course Data science with python the example of the the KNeighborsClassifier presented. And as far as I understand the method searches the n next points and based on a majority vote it gets decided to what the point belongs. So were is the freedome of the programm to vary parameter. when it just looks for the nearst points an compares. It is said that in the default mode it uses euclidean distances. So it can't vary the distant. And if it is a majority vote there is also no parameters that could give nearer points more weight. So what does it do when I let the programm learn? And second question isn't the point of minkowski space that it isn't euclidean so why is the default metric 'minkowski' the eucildean metric?

16th Sep 2020, 8:55 PM
Tim
Tim - avatar
2 Antworten
0
I had a difficulty understanding your questions, so correct me if I am wrong. - 1st where is the freedom of the program to vary parameter. knn is used for supervised machine learning. the parameters are given by the user, and checks which value of K is more accurate. - 2nd what does it do when I let the program learn? it tries to predict where some unlabeled data belongs based on the K value you gave it. it's not an unsupervised algorithm. I couldn't understand the last one clearly, could you elaborate more.
16th Sep 2020, 11:36 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
Bahha🐧 so my problem with understanding is the following: In the course data science with python: linear reggretion it is stated that linear reggretion is also supervised but it has the task to find the best coefficients intercept b and slope m so that the residues are as small as possible so if i train it it will try different b and m to find the best solution. So what is does the training do by the KNeighborsClassifier. As you said and I interpreted the lesson it just takes all points looks what are the nearest and evaluets how much would be correctly predicted. But this just would be machine learning because the computer doesn't try to find the best solution it just tells you how good your model would be. I hope this makes it clearer The second thing was just something mathematical I wonderd
17th Sep 2020, 6:55 AM
Tim
Tim - avatar