|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.util.kdtree.KDTree<T>
T
- the type of the data that is to be stored in the treepublic class KDTree<T>
This class is an implementation of a k-d tree as described in
KDTreeBuilder
.
Constructor Summary | |
---|---|
KDTree(int k,
Node rootNode,
int size)
Creates a new optimized k-d tree. |
Method Summary | |
---|---|
List<NearestNeighbour<T>> |
getKNearestNeighbours(double[] query,
int k)
Searches for the k nearest neighbours of the
query pattern. |
List<NearestNeighbour<T>> |
getMaxDistanceNeighbours(double[] query,
double maxDist)
Searches for all neighbours of the query pattern that are
not more than maxDist away from it. |
int |
getTestedPatterns()
Returns the number of tested patterns during the last call to getKNearestNeighbours(double[], int) . |
int |
size()
Returns the tree's size, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
KDTree(int k, Node rootNode, int size)
KDTreeBuilder
.
k
- the number of dimensions of the patternsrootNode
- the root node of the treesize
- the size of the treeMethod Detail |
---|
public int size()
public List<NearestNeighbour<T>> getKNearestNeighbours(double[] query, int k)
k
nearest neighbours of the
query
pattern. The returned list is sorted by the distance
to the query pattern in increasing order. The returned list may contain
more than k
patterns if the patterns from k
to
the end have equal distance to the query pattern.
query
- the query pattern, must have the same dimensionality as the
patterns inside the treek
- the number of nearest neighbours to retrieve
public List<NearestNeighbour<T>> getMaxDistanceNeighbours(double[] query, double maxDist)
query
pattern that are
not more than maxDist
away from it. The returned list is
sorted by the distance to the query pattern in increasing order.
query
- the query pattern, must have the same dimensionality as the
patterns inside the treemaxDist
- the maximum distance the patterns may have (exclusive)
public int getTestedPatterns()
getKNearestNeighbours(double[], int)
. The lower the number the
better the k-d tree could prune the search.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |