2017-05-27 44 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 - 方法工作。