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 classPartialVAFile.Factory<V extends NumberVector>Index factory class.protected static classPartialVAFile.PartialVACandidateObject in a VA approximation.classPartialVAFile.PartialVAFileKNNQueryKNN query for this index.classPartialVAFile.PartialVAFileRangeQueryRange query for this index.static classPartialVAFile.StatisticsClass for tracking Partial VA file statistics.protected static classPartialVAFile.WorstCaseDistComparatorCompare 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>daFilesPartial VA files.private static LoggingLOGClass logger.private intpageSizePage size.private intpartitionsNumber of partitions.private double[][]splitPartitionsSplitting grid.protected PartialVAFile.StatisticsstatsStatistics.private java.util.ArrayList<VectorApproximation>vectorApproxThe (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 VectorApproximationcalculateFullApproximation(DBIDRef id, V dv)Calculate the VA file position given the existing borders.protected static VectorApproximationcalculatePartialApproximation(NumberVector dv, java.util.List<DoubleObjPair<DAFile>> daFiles)Calculate partial vector approximation.protected static voidcalculateSelectivityCoeffs(java.util.List<DoubleObjPair<DAFile>> daFiles, NumberVector query, double epsilon)Calculate selectivity coefficients.LogginggetLogger()Get the class logger.voidinitialize()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.voidlogStatistics()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 longroundToPageSize(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.IllegalStateExceptionDescription copied from interface:IndexInitialize the index. For static indexes, this is the moment the index is bulk loaded.- Specified by:
initializein interfaceIndex- Throws:
java.lang.IllegalStateException
-
getLogger
public Logging getLogger()
Description copied from class:AbstractRefiningIndexGet the class logger.- Specified by:
getLoggerin classAbstractRefiningIndex<V extends NumberVector>- Returns:
- Logger
-
logStatistics
public void logStatistics()
Description copied from interface:IndexSend 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:
logStatisticsin interfaceIndex- Overrides:
logStatisticsin 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:KNNIndexGet 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:
kNNByObjectin 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:RangeIndexGet 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:
rangeByObjectin 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
-
-