Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug in NearestNeighborLearner class in learning.py #15

Closed
GoogleCodeExporter opened this issue Apr 10, 2015 · 1 comment
Closed

bug in NearestNeighborLearner class in learning.py #15

GoogleCodeExporter opened this issue Apr 10, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

"best" is described as a sorted list of (distance, example) pairs.
Yet when looping over "examples" and filling this list, we simply append
while the count is less than "k", which violates the sorting condition. We
only start sorting once the list is full and the new example has a distance
less than the top of the list.
As an example, take k=5, and imagine a dataset where the first four
instances are the furthest from the example we want to predict. Then
imagine that the fifth example happens to be the closest. Then when we
evaluate the rest of the examples, none will be added to the list "best"
since the condition on line 225 is never met.

Original issue reported on code.google.com by amroamro...@gmail.com on 13 Dec 2009 at 2:04

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision r71.

Original comment by wit...@gmail.com on 15 Sep 2011 at 2:41

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant