KDTree constructor
- DataFrame points, {
- int leafSize = 1,
- DType dtype = DType.float32,
- KDTreeSplitStrategy splitStrategy = KDTreeSplitStrategy.inOrder,
points
Data points which will be used to build the tree.
leafSize
A number of points on a leaf node.
The bigger the number, the less effective search is. If leafSize
is
equal to the number of points
, a regular KNN-search will take place.
Small leafSize
leads to an increasing amount of time for tree building,
but querying will be very fast
dtype
A data type which will be used to convert raw data from points
into internal numerical representation
splitStrategy
Describes how to choose a split dimension. Default value
is KDTreeSplitStrategy.inOrder
if splitStrategy
is KDTreeSplitStrategy.inOrder, dimension for data
splits will be chosen one by one in order, in this case, tree building is
very fast
if splitStrategy
is KDTreeSplitStrategy.largestVariance, dimension with
the widest column (in terms of variance) will be chosen to split the data
KDTreeSplitStrategy.largestVariance results in more balanced tree, but this strategy takes much more time to build the tree than KDTreeSplitStrategy.inOrder
Implementation
factory KDTree(DataFrame points,
{int leafSize = 1,
DType dtype = DType.float32,
KDTreeSplitStrategy splitStrategy = KDTreeSplitStrategy.inOrder}) =>
createKDTree(points, leafSize, dtype, splitStrategy);