Package elki.database.query.knn
Class WrappedKNNDBIDByLookup<O>
- java.lang.Object
-
- elki.database.query.knn.WrappedKNNDBIDByLookup<O>
-
- Type Parameters:
O- relation object type
- All Implemented Interfaces:
KNNSearcher<DBIDRef>
- Direct Known Subclasses:
WrappedKNNDBIDByLookup.Linear
public class WrappedKNNDBIDByLookup<O> extends java.lang.Object implements KNNSearcher<DBIDRef>
Find nearest neighbors by querying with the original object.- Since:
- 0.8.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWrappedKNNDBIDByLookup.Linear<O>Linear scan searcher.
-
Constructor Summary
Constructors Modifier Constructor Description privateWrappedKNNDBIDByLookup(Relation<? extends O> relation, KNNSearcher<O> inner)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KNNListgetKNN(DBIDRef id, int k)Get the k nearest neighbors for a particular object.static <O> KNNSearcher<DBIDRef>wrap(Relation<? extends O> relation, KNNSearcher<O> inner)Wrap a query, if notnull.
-
-
-
Field Detail
-
inner
private KNNSearcher<O> inner
Inner kNN searcher.
-
-
Constructor Detail
-
WrappedKNNDBIDByLookup
private WrappedKNNDBIDByLookup(Relation<? extends O> relation, KNNSearcher<O> inner)
Constructor.- Parameters:
relation- data relationinner- inner kNN searcher
-
-
Method Detail
-
getKNN
public KNNList getKNN(DBIDRef id, int k)
Description copied from interface:KNNSearcherGet the k nearest neighbors for a particular object.- Specified by:
getKNNin interfaceKNNSearcher<O>- Parameters:
id- query objectk- Number of neighbors requested- Returns:
- neighbors
-
wrap
public static <O> KNNSearcher<DBIDRef> wrap(Relation<? extends O> relation, KNNSearcher<O> inner)
Wrap a query, if notnull.- Type Parameters:
O- inner data type- Parameters:
relation- Relation to get object frominner- inner query- Returns:
- wrapped query, or
nullif inner wasnull
-
-