
V - the type of FeatureVector handled by this AlgorithmN - the type of node used in the spatial index structureE - the type of entry used in the spatial node@Title(value="K-Nearest Neighbor Join") @Description(value="Algorithm to find the k-nearest neighbors of each object in a spatial database") public class KNNJoin<V extends NumberVector,N extends SpatialNode<N,E>,E extends SpatialEntry> extends AbstractDistanceBasedAlgorithm<V,DataStore<KNNList>>
| Modifier and Type | Class and Description |
|---|---|
static class |
KNNJoin.Parameterizer<V extends NumberVector,N extends SpatialNode<N,E>,E extends SpatialEntry>
Parameterization class.
|
private class |
KNNJoin.Task
Task in the processing queue.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
k
The k parameter.
|
private static Logging |
LOG
The logger for this class.
|
DISTANCE_FUNCTION_ID| Constructor and Description |
|---|
KNNJoin(DistanceFunction<? super V> distanceFunction,
int k)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private double |
computeStopDistance(List<KNNHeap> heaps)
Compute the maximum stop distance.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
private List<KNNHeap> |
initHeaps(SpatialPrimitiveDistanceFunction<V> distFunction,
N pr)
Initialize the heaps.
|
private void |
processDataPages(SpatialPrimitiveDistanceFunction<? super V> df,
List<KNNHeap> pr_heaps,
List<KNNHeap> ps_heaps,
N pr,
N ps)
Processes the two data pages pr and ps and determines the k-nearest
neighbors of pr in ps.
|
WritableDataStore<KNNList> |
run(Relation<V> relation)
Joins in the given spatial database to each object its k-nearest neighbors.
|
getDistanceFunctionmakeParameterDistanceFunction, runprivate static final Logging LOG
int k
public KNNJoin(DistanceFunction<? super V> distanceFunction, int k)
distanceFunction - Distance functionk - k parameterpublic WritableDataStore<KNNList> run(Relation<V> relation)
relation - Relation to processprivate List<KNNHeap> initHeaps(SpatialPrimitiveDistanceFunction<V> distFunction, N pr)
distFunction - Distance functionpr - Node to initialize forprivate void processDataPages(SpatialPrimitiveDistanceFunction<? super V> df, List<KNNHeap> pr_heaps, List<KNNHeap> ps_heaps, N pr, N ps)
df - the distance function to usepr - the first data pageps - the second data pagepr_heaps - the knn lists for each data objectps_heaps - the knn lists for each data object in psprivate double computeStopDistance(List<KNNHeap> heaps)
heaps - Heaps listpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithmgetInputTypeRestriction in interface AlgorithmgetInputTypeRestriction in class AbstractAlgorithm<DataStore<KNNList>>protected Logging getLogger()
AbstractAlgorithmgetLogger in class AbstractAlgorithm<DataStore<KNNList>>Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.