scikit-learn/scikit-learn — pull request #3219 by perimosocordiae (2014-05-28 21:52:40+00:00)
Title: ENH: use partial sort for kneighbors selection

This produces a considerable speedup with Numpy >= 1.8. Faster implementations of `argpartition` exist (see [bottleneck's argpartsort](http://berkeleyanalytics.com/bottleneck/reference.html#bottleneck.argpartsort), but that would involve adding dependencies.

Is this sort of on-demand feature checking acceptable, or should I make a shim for `argpartition`?

Also note that this has the side-effect of leaving the selected indices unsorted. I don't think any downstream code relies on this, but I haven't checked.