Felix Ha
Felix Ha

Reputation: 411

implementation of KD Tree in sk learn

I am curious how the kd-tree is built in sk learn. I have already looked up in web and found kdtree But unfortunately it cant be the implemenation, because in KD Tree from sklearn there is a method quer_rangesk KDtree and there not. Is there a site where i can look up the code?

Upvotes: 0

Views: 397

Answers (1)

sascha
sascha

Reputation: 33522

It's splitted across multiple files.

In the beginning of your linked file you will see:

cdef class KDTree(BinaryTree)

meaning, that it's inheriting from BinaryTree, which defines the function you mentioned.

Also some comments within this (BinaryTree) file:

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

So within this special file, you linked to, some abstract methods are defined which are enough to make the query_radius-method from the base-class work.

Upvotes: 2

Related Questions