Package elki.index.preprocessed.knn
Class AbstractMaterializeKNNPreprocessor<O>
- java.lang.Object
-
- elki.index.preprocessed.knn.AbstractMaterializeKNNPreprocessor<O>
-
- Type Parameters:
O
- Object type
- Direct Known Subclasses:
CachedDoubleDistanceKNNPreprocessor
,KNNJoinMaterializeKNNPreprocessor
,MaterializeKNNPreprocessor
,MetricalIndexApproximationMaterializeKNNPreprocessor
,NNDescent
,PartitionApproximationMaterializeKNNPreprocessor
,RandomSampleKNNPreprocessor
,SpacefillingMaterializeKNNPreprocessor
,SpatialApproximationMaterializeKNNPreprocessor
public abstract class AbstractMaterializeKNNPreprocessor<O> extends java.lang.Object implements KNNIndex<O>
Abstract base class for KNN Preprocessors.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractMaterializeKNNPreprocessor.Factory<O>
The parameterizable factory.
-
Field Summary
Fields Modifier and Type Field Description protected Distance<? super O>
distance
The distance function to be used.protected DistanceQuery<O>
distanceQuery
The distance query we used.protected int
k
The query k value.protected Relation<O>
relation
The relation we are bound to.protected WritableDataStore<KNNList>
storage
The data store.
-
Constructor Summary
Constructors Constructor Description AbstractMaterializeKNNPreprocessor(Relation<O> relation, DistanceQuery<O> distanceQuery, int k)
Constructor.AbstractMaterializeKNNPreprocessor(Relation<O> relation, Distance<? super O> distance, int k)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) void
createStorage()
Create the default storage.KNNList
get(DBIDRef id)
Get the k nearest neighbors.DistanceQuery<O>
getDistanceQuery()
The distance query we used.int
getK()
Get the value of 'k' supported by this preprocessor.protected abstract Logging
getLogger()
Get the classes static logger.void
initialize()
Initialize the index.PreprocessorKNNQuery
kNNByDBID(DistanceQuery<O> distQ, int maxk, int flags)
Get a KNN query object for the given distance query and k.KNNSearcher<O>
kNNByObject(DistanceQuery<O> distanceQuery, int maxk, int flags)
Deprecated.not possibleprotected abstract void
preprocess()
Perform the preprocessing step.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.index.Index
logStatistics
-
-
-
-
Field Detail
-
k
protected final int k
The query k value.
-
distanceQuery
protected final DistanceQuery<O> distanceQuery
The distance query we used.
-
storage
protected WritableDataStore<KNNList> storage
The data store.
-
-
Constructor Detail
-
AbstractMaterializeKNNPreprocessor
public AbstractMaterializeKNNPreprocessor(Relation<O> relation, Distance<? super O> distance, int k)
Constructor.- Parameters:
relation
- Relationdistance
- Distance functionk
- k
-
AbstractMaterializeKNNPreprocessor
public AbstractMaterializeKNNPreprocessor(Relation<O> relation, DistanceQuery<O> distanceQuery, int k)
Constructor.- Parameters:
relation
- RelationdistanceQuery
- Distance queryk
- k
-
-
Method Detail
-
getDistanceQuery
public DistanceQuery<O> getDistanceQuery()
The distance query we used.- Returns:
- Distance query
-
getK
public int getK()
Get the value of 'k' supported by this preprocessor.- Returns:
- k
-
preprocess
protected abstract void preprocess()
Perform the preprocessing step.
-
get
public KNNList get(DBIDRef id)
Get the k nearest neighbors.- Parameters:
id
- Object ID- Returns:
- Neighbors
-
createStorage
void createStorage()
Create the default storage.
-
initialize
public void initialize()
Description copied from interface:Index
Initialize the index. For static indexes, this is the moment the index is bulk loaded.- Specified by:
initialize
in interfaceIndex
-
kNNByObject
@Deprecated public KNNSearcher<O> kNNByObject(DistanceQuery<O> distanceQuery, int maxk, int flags)
Deprecated.not possibleDescription copied from interface:KNNIndex
Get a KNN query object for the given distance query and k.This function MAY return null, when the given distance is not supported!
- Specified by:
kNNByObject
in interfaceKNNIndex<O>
- Parameters:
distanceQuery
- Distance querymaxk
- Maximum value of kflags
- Hints for the optimizer- Returns:
- KNN Query object or
null
-
kNNByDBID
public PreprocessorKNNQuery kNNByDBID(DistanceQuery<O> distQ, int maxk, int flags)
Description copied from interface:KNNIndex
Get a KNN query object for the given distance query and k.This function MAY return null, when the given distance is not supported!
-
getLogger
protected abstract Logging getLogger()
Get the classes static logger.- Returns:
- Logger
-
-