KD树在sklearn中的实现

implementation of KD Tree in sk learn

很好奇sk-learn中的kd-tree是怎么构建的。我已经在网上查找并找到 kdtree But unfortunately it cant be the implemenation, because in KD Tree from sklearn there is a method quer_rangesk KDtree 但没有。有没有可以查询代码的网站?

它被拆分成多个文件。

在链接文件的开头,您将看到:

cdef class KDTree(BinaryTree)

意思是,它继承自 BinaryTree,它定义了 function you mentioned

此 (BinaryTree) 文件中还有一些注释:

# Implementation Notes
# --------------------
# This implementation uses the common object-oriented approach of having an
# abstract base class which is extended by the KDTree and BallTree
# specializations.
#
# The BinaryTree "base class" is defined here and then subclassed in the BallTree
# and KDTree pyx files. These files include implementations of the
# "abstract" methods.

因此,在您链接到的这个特殊文件中,定义了一些抽象方法,这些方法足以使 base-class 中的 query_radius-方法起作用。