Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
我认为你应该使用 scikit ann。
这里有一个关于最近邻的很好的教程。
根据文档:
I think that you should use scikit ann.
There is a good tutorial about the nearest neightbour here.
According to the documentation :
这是一个比较 scipy.spatial.cKDTree 和 pyflann.FLANN 的脚本。亲自看看哪一个对您的应用程序来说更快。
Here is a script comparing scipy.spatial.cKDTree and pyflann.FLANN. See for yourself which one is faster for your application.
scipy.spatial.cKDTree
快速且稳定。
有关使用它进行 NN 插值的示例,请参阅(咳咳)
反距离-weighted-idw-interpolation-with-python所以。
(如果你可以说“我在 3d 中有 1M 个点,并且想要 1k 个新点的 k=5 个最近邻”,
您可能会得到更好的答案或代码示例。
找到邻居后,您想对他们做什么?)
scipy.spatial.cKDTree
is fast and solid.
For an example of using it for NN interpolation, see (ahem)
inverse-distance-weighted-idw-interpolation-with-python on SO.
(If you could say e.g. "I have 1M points in 3d, and want k=5 nearest neighbors of 1k new points",
you might get better answers or code examples.
What do you want to do with the neighbors once you've found them ?)
如果您想要采用 kd-tree 方法,它本身就在 scipy 中: http://docs.scipy.org/doc/scipy/reference/ generated/scipy.spatial.KDTree.html#scipy.spatial.KDTree
It is natively in scipy if you're looking to do a kd-tree approach: http://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.html#scipy.spatial.KDTree