# Question regarding distance weighting in KNN models

Dear all,

I'm not sure if this is the right section for my question. However, since I haven't found any better place I will post it here. Please move the topic if appropriate.

For the KNN operator there is the possibility to weight the nearest neighbors by distance. The exact algorithm is as follows (reposted from another topic/author):

Kind regards,

cherokee

I'm not sure if this is the right section for my question. However, since I haven't found any better place I will post it here. Please move the topic if appropriate.

For the KNN operator there is the possibility to weight the nearest neighbors by distance. The exact algorithm is as follows (reposted from another topic/author):

This algorithm is also used in KNNRegressionModel. I haven't seen this formula for weighting before. Can somebody please cite the paper/book where this formula is introduced.

steffen wrote: Let x be the object to classifiy, and x_i the nearest neighbours, i=1,...,k

totalDistance = sum(dist(x,x_i)) for all i

totalSimiliarity= sum ( 1-(dist(x,x_i)/totalDistance)) for all i <= see here

counter is then weighted by:

(1-(dist(x,x_i)/totalDistance))/totalSimilarity <= weighted by normalized similaritysource: com.rapidminer.operator.learner.lazy.KNNClassificationModel.java

Kind regards,

cherokee

0

## Answers

82Guruthis is still a relevant question for me. I have been using RapidMiner in academia for the last four years. I have written my own plugins for different projects and used it in my teachings. If I cannot comprehend RapidMiners operators (and cite their algorithms properly) I will not be able to use them. So I have to find another data mining tool (at least for knn) for me and my students which will be rather cumbersome .

Is there somebody out there who can help me? Perhaps the author of the class(es) Sebastian Land?

Kind regards,

cherokee