Package elki.index.vafile
Class PartialVAFile.PartialVAFileKNNQuery
- java.lang.Object
-
- elki.index.AbstractRefiningIndex.AbstractRefiningQuery
-
- elki.index.vafile.PartialVAFile.PartialVAFileKNNQuery
-
- All Implemented Interfaces:
KNNSearcher<V>
- Enclosing class:
- PartialVAFile<V extends NumberVector>
public class PartialVAFile.PartialVAFileKNNQuery extends AbstractRefiningIndex.AbstractRefiningQuery implements KNNSearcher<V>
KNN query for this index.- Author:
- Erich Schubert, Thomas Bernecker
-
-
Field Summary
Fields Modifier and Type Field Description private double
p
Lp-Norm p.private long[]
subspace
Subspace.-
Fields inherited from class elki.index.AbstractRefiningIndex.AbstractRefiningQuery
distanceQuery
-
-
Constructor Summary
Constructors Constructor Description PartialVAFileKNNQuery(DistanceQuery<V> ddq, double p, long[] subspace)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.LinkedList<PartialVAFile.PartialVACandidate>
filter1(int k, int reducedDims, java.util.List<DAFile> daFiles, VectorApproximation queryApprox, int subspaceDims, VALPNormDistance dist)
private int
getIOCosts(int size, int subspaceDims)
Computes IO costs (in bytes) needed for refining the candidates.private int
getIOCosts(DAFile sample, int numberOfDAFiles)
Computes IO costs (in bytes) needed for reading several DA-files.KNNList
getKNN(V query, int k)
Get the k nearest neighbors for a particular object.java.util.List<DAFile>
getWorstCaseDistOrder(VALPNormDistance dist, long[] subspace)
Order subspaces by their worst case distance.protected KNNList
retrieveAccurateDistances(java.util.List<PartialVAFile.PartialVACandidate> sortedCandidates, int k, long[] subspace, V query)
-
Methods inherited from class elki.index.AbstractRefiningIndex.AbstractRefiningQuery
incRefinements, refine
-
-
-
-
Constructor Detail
-
PartialVAFileKNNQuery
public PartialVAFileKNNQuery(DistanceQuery<V> ddq, double p, long[] subspace)
Constructor.- Parameters:
ddq
- Distance queryp
- LP-norm psubspace
- Subspace to query
-
-
Method Detail
-
getKNN
public KNNList getKNN(V query, int k)
Description copied from interface:KNNSearcher
Get the k nearest neighbors for a particular object.- Specified by:
getKNN
in interfaceKNNSearcher<V extends NumberVector>
- Parameters:
query
- query objectk
- Number of neighbors requested- Returns:
- neighbors
-
filter1
private java.util.LinkedList<PartialVAFile.PartialVACandidate> filter1(int k, int reducedDims, java.util.List<DAFile> daFiles, VectorApproximation queryApprox, int subspaceDims, VALPNormDistance dist)
-
getIOCosts
private int getIOCosts(int size, int subspaceDims)
Computes IO costs (in bytes) needed for refining the candidates.- Parameters:
size
- The nuber of candidatessubspaceDims
- the required subspace dimensions- Returns:
- the cost value (in bytes)
-
getIOCosts
private int getIOCosts(DAFile sample, int numberOfDAFiles)
Computes IO costs (in bytes) needed for reading several DA-files.- Parameters:
sample
- the DA-file specific costsnumberOfDAFiles
- the number of DA-files that have to be read- Returns:
- the cost value (in bytes)
-
getWorstCaseDistOrder
public java.util.List<DAFile> getWorstCaseDistOrder(VALPNormDistance dist, long[] subspace)
Order subspaces by their worst case distance.- Parameters:
dist
- Distance functionsubspace
- Subspace- Returns:
- Ordered list of dimension files
-
retrieveAccurateDistances
protected KNNList retrieveAccurateDistances(java.util.List<PartialVAFile.PartialVACandidate> sortedCandidates, int k, long[] subspace, V query)
-
-