Orange Forum • View topic - Documentation KNN

## Documentation KNN

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

### Documentation KNN

Just a small question:

In the documentation for kNN (
http://www.ailab.si/orange/doc/reference/kNNLearner.htm) it says that the weighting formula is:

exp(-t^2/s^2)

where t is the distance or rank (depending on setting of rankWeight) of `learned' example, and s is chosen so that the impact of the farthest example is 0.001.

However, -t^2 is the same as t^2, so what exactly is meant by this formula? Should it be exp(-(t^2) / s^2)?

There is also an inconsistency in the meaning of k when k=0: first it says that when k=0, the square root of the number of examples is used, while a little bit further it is stated that when k=0 all examples are used. Which is correct?

Thanks for the comment. The documentation about the meaning of k=0 was indeed wrong: the square root of the number of examples is taken this case.

As for -t^2 I believe that there is no ambiguity, since squaring has precedence over negation, thus the parentheses in -(t^2) would be redundant (especially considering that ^2 is rendered as a superscript in the documentation, there should be no doubt about the precedence).

Janez