O
- Object typeD
- Distance typepublic class MetricalIndexKNNQuery<O,D extends Distance<D>> extends AbstractDistanceKNNQuery<O,D>
Modifier and Type | Field and Description |
---|---|
protected AbstractMTree<O,D,?,?> |
index
The index to use
|
distanceQuery
relation
HINT_BULK, HINT_EXACT, HINT_HEAVY_USE, HINT_NO_CACHE, HINT_OPTIMIZED_ONLY, HINT_SINGLE
Constructor and Description |
---|
MetricalIndexKNNQuery(AbstractMTree<O,D,?,?> index,
DistanceQuery<O,D> distanceQuery)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
doKNNQuery(O q,
KNNHeap<D> knnList)
Performs a k-nearest neighbor query for the given FeatureVector with the
given parameter k and the according distance function.
|
List<List<DistanceResultPair<D>>> |
getKNNForBulkDBIDs(ArrayDBIDs ids,
int k)
Bulk query method
|
void |
getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
Bulk query method configured by a map.
|
List<DistanceResultPair<D>> |
getKNNForDBID(DBID id,
int k)
Get the k nearest neighbors for a particular id.
|
List<DistanceResultPair<D>> |
getKNNForObject(O obj,
int k)
Get the k nearest neighbors for a particular id.
|
getDistanceFactory, getDistanceQuery
getRelation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRelation
protected final AbstractMTree<O,D extends Distance<D>,?,?> index
public MetricalIndexKNNQuery(AbstractMTree<O,D,?,?> index, DistanceQuery<O,D> distanceQuery)
index
- Index to usedistanceQuery
- Distance query usedprotected final void doKNNQuery(O q, KNNHeap<D> knnList)
q
- the id of the query objectknnList
- the query result listpublic List<DistanceResultPair<D>> getKNNForObject(O obj, int k)
KNNQuery
getKNNForObject
in interface KNNQuery<O,D extends Distance<D>>
getKNNForObject
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
obj
- Query objectk
- Number of neighbors requestedpublic List<DistanceResultPair<D>> getKNNForDBID(DBID id, int k)
KNNQuery
getKNNForDBID
in interface KNNQuery<O,D extends Distance<D>>
getKNNForDBID
in class AbstractDistanceKNNQuery<O,D extends Distance<D>>
id
- query object IDk
- Number of neighbors requestedpublic List<List<DistanceResultPair<D>>> getKNNForBulkDBIDs(ArrayDBIDs ids, int k)
KNNQuery
ids
- query object IDsk
- Number of neighbors requestedpublic void getKNNForBulkHeaps(Map<DBID,KNNHeap<D>> heaps)
KNNQuery
heaps
- Map of heaps to fill.