Difference between scipy.spatial.KDTree and scipy.

2019-03-14 07:52发布

What is the difference between these two algorithms?

2条回答
相关推荐>>
2楼-- · 2019-03-14 08:26

cKDTree is a subset of KDTree, implemented in C++ wrapped in Cython, so therefore faster.

Each of them is

a binary trie, each of whose nodes represents an axis-aligned hyperrectangle. Each node specifies an axis and splits the set of points based on whether their coordinate along that axis is greater than or less than a particular value.

but KDTree

also supports all-neighbors queries, both with arrays of points and with other kd-trees. These do use a reasonably efficient algorithm, but the kd-tree is not necessarily the best data structure for this sort of calculation.

查看更多
Root(大扎)
3楼-- · 2019-03-14 08:40

In a use case (5D nearest neighbor look ups in a KDTree with approximately 100K points) cKDTree is around 12x faster than KDTree.

查看更多
登录 后发表回答