2017-05-27 92 views
0

我很好奇kd-tree是如何在sk学习中构建的。我已经在网上查找,发现kdtree但不幸的是它不能实现,因为在sklearn的KD树有一个方法quer_range sk KDtree,没有。有没有可以查看代码的网站?在sk中实现KD Tree学习

回答

2

它分成多个文件。

在你的链接文件的开头,你会看到:

cdef class KDTree(BinaryTree) 

含义,即它是从BinaryTree继承,它定义了function you mentioned

这个(二叉树)文件中也有一些意见:

# 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. 

所以这个特殊的文件中,你挂,定义一些抽象方法这是足以让从基类的query_radius - 方法工作。