Package elki.index.vafile
Class PartialVAFile<V extends NumberVector>
- java.lang.Object
-
- elki.index.AbstractRefiningIndex<V>
-
- elki.index.vafile.PartialVAFile<V>
-
- Type Parameters:
V
- Vector type
- All Implemented Interfaces:
Index
,KNNIndex<V>
,RangeIndex<V>
@Reference(authors="Hans-Peter Kriegel, Peer Kr\u00f6ger, Matthias Schubert, Ziyue Zhu", title="Efficient Query Processing in Arbitrary Subspaces Using Vector Approximations", booktitle="Proc. 18th Int. Conf. on Scientific and Statistical Database Management (SSDBM 06)", url="https://doi.org/10.1109/SSDBM.2006.23", bibkey="DBLP:conf/ssdbm/KriegelKSZ06") public class PartialVAFile<V extends NumberVector> extends AbstractRefiningIndex<V> implements KNNIndex<V>, RangeIndex<V>
PartialVAFile. In-memory only implementation.Reference:
Hans-Peter Kriegel, Peer Kröger, Matthias Schubert, Ziyue Zhu
Efficient Query Processing in Arbitrary Subspaces Using Vector Approximations
Proc. 18th Int. Conf. on Scientific and Statistical Database Management (SSDBM 06)TODO: This needs to be optimized more low-level.
- Since:
- 0.5.0
- Author:
- Thomas Bernecker, Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PartialVAFile.Factory<V extends NumberVector>
Index factory class.protected static class
PartialVAFile.PartialVACandidate
Object in a VA approximation.class
PartialVAFile.PartialVAFileKNNQuery
KNN query for this index.class
PartialVAFile.PartialVAFileRangeQuery
Range query for this index.static class
PartialVAFile.Statistics
Class for tracking Partial VA file statistics.protected static class
PartialVAFile.WorstCaseDistComparator
Compare DAfiles by their worst case distance.-
Nested classes/interfaces inherited from class elki.index.AbstractRefiningIndex
AbstractRefiningIndex.AbstractRefiningQuery
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<DAFile>
daFiles
Partial VA files.private static Logging
LOG
Class logger.private int
pageSize
Page size.private int
partitions
Number of partitions.private double[][]
splitPartitions
Splitting grid.protected PartialVAFile.Statistics
stats
Statistics.private java.util.ArrayList<VectorApproximation>
vectorApprox
The (full - we are in-memory only right now) vector approximations.-
Fields inherited from class elki.index.AbstractRefiningIndex
relation
-
-
Constructor Summary
Constructors Constructor Description PartialVAFile(int pageSize, Relation<V> relation, int partitions)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected VectorApproximation
calculateFullApproximation(DBIDRef id, V dv)
Calculate the VA file position given the existing borders.protected static VectorApproximation
calculatePartialApproximation(NumberVector dv, java.util.List<DoubleObjPair<DAFile>> daFiles)
Calculate partial vector approximation.protected static void
calculateSelectivityCoeffs(java.util.List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon)
Calculate selectivity coefficients.Logging
getLogger()
Get the class logger.void
initialize()
Initialize the index.KNNSearcher<V>
kNNByObject(DistanceQuery<V> distanceQuery, int maxk, int flags)
Get a KNN query object for the given distance query and k.void
logStatistics()
Send statistics to the logger, if enabled.RangeSearcher<V>
rangeByObject(DistanceQuery<V> distanceQuery, double maxradius, int flags)
Get a range query object for the given distance query and k.protected long
roundToPageSize(long l)
Round a value to the next page size.-
Methods inherited from class elki.index.AbstractRefiningIndex
countRefinements, refine
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.index.RangeIndex
rangeByDBID
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
daFiles
java.util.List<DAFile> daFiles
Partial VA files.
-
partitions
private final int partitions
Number of partitions.
-
pageSize
private final int pageSize
Page size.
-
splitPartitions
private double[][] splitPartitions
Splitting grid.
-
stats
protected PartialVAFile.Statistics stats
Statistics.
-
vectorApprox
private java.util.ArrayList<VectorApproximation> vectorApprox
The (full - we are in-memory only right now) vector approximations.
-
-
Method Detail
-
initialize
public void initialize() throws java.lang.IllegalStateException
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
- Throws:
java.lang.IllegalStateException
-
getLogger
public Logging getLogger()
Description copied from class:AbstractRefiningIndex
Get the class logger.- Specified by:
getLogger
in classAbstractRefiningIndex<V extends NumberVector>
- Returns:
- Logger
-
logStatistics
public void logStatistics()
Description copied from interface:Index
Send statistics to the logger, if enabled.Note: you must have set the logging level appropriately before initializing the index! Otherwise, the index might not have collected the desired statistics.
- Specified by:
logStatistics
in interfaceIndex
- Overrides:
logStatistics
in classAbstractRefiningIndex<V extends NumberVector>
-
calculateFullApproximation
protected VectorApproximation calculateFullApproximation(DBIDRef id, V dv)
Calculate the VA file position given the existing borders.- Parameters:
id
- Object IDdv
- Data vector- Returns:
- Vector approximation
-
kNNByObject
public KNNSearcher<V> kNNByObject(DistanceQuery<V> distanceQuery, 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!
- Specified by:
kNNByObject
in interfaceKNNIndex<V extends NumberVector>
- Parameters:
distanceQuery
- Distance querymaxk
- Maximum value of kflags
- Hints for the optimizer- Returns:
- KNN Query object or
null
-
rangeByObject
public RangeSearcher<V> rangeByObject(DistanceQuery<V> distanceQuery, double maxradius, int flags)
Description copied from interface:RangeIndex
Get a range query object for the given distance query and k.This function MAY return null, when the given distance is not supported!
- Specified by:
rangeByObject
in interfaceRangeIndex<V extends NumberVector>
- Parameters:
distanceQuery
- Distance querymaxradius
- Maximum rangeflags
- Hints for the optimizer- Returns:
- KNN Query object or
null
-
calculateSelectivityCoeffs
protected static void calculateSelectivityCoeffs(java.util.List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon)
Calculate selectivity coefficients.- Parameters:
daFiles
- List of files to usequery
- Query vectorepsilon
- Epsilon radius
-
calculatePartialApproximation
protected static VectorApproximation calculatePartialApproximation(NumberVector dv, java.util.List<DoubleObjPair<DAFile>> daFiles)
Calculate partial vector approximation.- Parameters:
dv
- Object vectordaFiles
- List of approximations to use- Returns:
- Vector approximation
-
roundToPageSize
protected long roundToPageSize(long l)
Round a value to the next page size.- Parameters:
l
- value- Returns:
- rounded value
-
-