Package elki.database.query.knn
Class PreprocessorKNNQuery
- java.lang.Object
-
- elki.database.query.knn.PreprocessorKNNQuery
-
- All Implemented Interfaces:
KNNSearcher<DBIDRef>
- Direct Known Subclasses:
PreprocessorSqrtKNNQuery,PreprocessorSquaredKNNQuery
public class PreprocessorKNNQuery extends java.lang.Object implements KNNSearcher<DBIDRef>
Use precomputed kNN.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private static LoggingLOGClass loggerprivate AbstractMaterializeKNNPreprocessor<?>preprocessorThe last preprocessor resultprotected Relation<?>relationThe data to use for this queryprivate booleanwarnedWarn only once.
-
Constructor Summary
Constructors Constructor Description PreprocessorKNNQuery(Relation<?> relation, AbstractMaterializeKNNPreprocessor<?> preprocessor)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KNNListgetKNN(DBIDRef id, int k)Get the k nearest neighbors for a particular object.protected LogginggetLogger()Get the class logger.AbstractMaterializeKNNPreprocessor<?>getPreprocessor()Get the preprocessor instance.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger
-
relation
protected final Relation<?> relation
The data to use for this query
-
preprocessor
private final AbstractMaterializeKNNPreprocessor<?> preprocessor
The last preprocessor result
-
warned
private boolean warned
Warn only once.
-
-
Constructor Detail
-
PreprocessorKNNQuery
public PreprocessorKNNQuery(Relation<?> relation, AbstractMaterializeKNNPreprocessor<?> preprocessor)
Constructor.- Parameters:
relation- Relation to querypreprocessor- Preprocessor instance to use
-
-
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<DBIDRef>- Parameters:
id- query objectk- Number of neighbors requested- Returns:
- neighbors
-
getPreprocessor
public AbstractMaterializeKNNPreprocessor<?> getPreprocessor()
Get the preprocessor instance.- Returns:
- preprocessor instance
-
getLogger
protected Logging getLogger()
Get the class logger. Override when subclassing!- Returns:
- Class logger.
-
-