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 Logging
LOG
Class loggerprivate AbstractMaterializeKNNPreprocessor<?>
preprocessor
The last preprocessor resultprotected Relation<?>
relation
The data to use for this queryprivate boolean
warned
Warn 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 KNNList
getKNN(DBIDRef id, int k)
Get the k nearest neighbors for a particular object.protected Logging
getLogger()
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:KNNSearcher
Get the k nearest neighbors for a particular object.- Specified by:
getKNN
in 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.
-
-