Package org.ddogleg.nn
Class FactoryNearestNeighbor
java.lang.Object
org.ddogleg.nn.FactoryNearestNeighbor
Factory for creating implementations of
NearestNeighbor
.
Constructor Summary

Method Summary
Modifier and TypeMethodDescriptionstatic <P> NearestNeighbor<P>
exhaustive
(KdTreeDistance<P> distance) Performs an optimalNearestNeighbor
by exhaustively consider all possible solutions.static <P> NearestNeighbor<P>
generic
(ConfigNearestNeighborSearch config, KdTreeDistance<P> distance) Factory for genericNearestNeighbor
.static <P> NearestNeighbor<P>
kdRandomForest
(KdTreeDistance<P> distance, int maxNodesSearched, int numTrees, int numConsiderSplit, long randomSeed) ApproximateNearestNeighbor
search which uses a set of randomly generated KD trees and a BestBinFirst search.static <P> NearestNeighbor<P>
kdtree
(KdTreeDistance<P> distance) Performs an optimalNearestNeighbor
search using KD tree.static <P> NearestNeighbor<P>
kdtree
(KdTreeDistance<P> distance, int maxNodesSearched) Performs an approximateNearestNeighbor
search using KD tree.static NearestNeighbor<double[]>
vptree
(long randSeed) Vantage point
tree implementation for nearest neighbor search.

Constructor Details

FactoryNearestNeighbor
public FactoryNearestNeighbor()


Method Details

generic
public static <P> NearestNeighbor<P> generic(ConfigNearestNeighborSearch config, KdTreeDistance<P> distance) Factory for genericNearestNeighbor
. 
kdtree
Performs an optimalNearestNeighbor
search using KD tree. Distance measure is Euclidean squared. Type Parameters:
P
 Point type. Parameters:
distance
 Specifies how distance is computed between two points. Returns:
NearestNeighbor
implementation See Also:

kdtree
Performs an approximateNearestNeighbor
search using KD tree. Node are searched in BestBinFirst order. Distance measure is Euclidean squared. Type Parameters:
P
 Point type. Parameters:
maxNodesSearched
 Maximum number of nodes it will search. Controls speed and accuracy.distance
 Specifies how distance is computed between two points. Returns:
NearestNeighbor
implementation See Also:

kdRandomForest
public static <P> NearestNeighbor<P> kdRandomForest(KdTreeDistance<P> distance, int maxNodesSearched, int numTrees, int numConsiderSplit, long randomSeed) ApproximateNearestNeighbor
search which uses a set of randomly generated KD trees and a BestBinFirst search. Designed to work in high dimensional space. Distance measure is Euclidean squared. Type Parameters:
P
 Point type. Parameters:
distance
 Specifies how distance is computed between two points.maxNodesSearched
 Maximum number of nodes it will search. Controls speed and accuracy.numTrees
 Number of trees that are considered. Try 10 and tune.numConsiderSplit
 Number of nodes that are considered when generating a tree. Must be less than the point's dimension. Try 5randomSeed
 Seed used by random number generator Returns:
NearestNeighbor
implementation See Also:

exhaustive
Performs an optimalNearestNeighbor
by exhaustively consider all possible solutions. Distance measure is Euclidean squared. Parameters:
distance
 Specifies how distance is computed between two points. Returns:
NearestNeighbor
implementation See Also:

vptree
Vantage point
tree implementation for nearest neighbor search. Slower than KDTree on random data, but faster than it for some pathological cases. Parameters:
randSeed
 Random seed Returns:
NearestNeighbor
implementation See Also:
