Package elki.index.vafile
Class VAFile<V extends NumberVector>
- java.lang.Object
-
- elki.index.AbstractRefiningIndex<V>
-
- elki.index.vafile.VAFile<V>
-
- Type Parameters:
V- Vector type
- All Implemented Interfaces:
Index,KNNIndex<V>,RangeIndex<V>
@Title("An approximation based data structure for similarity search") @Reference(authors="R. Weber, S. Blott", title="An approximation based data structure for similarity search", booktitle="Report TR1997b, ETH Zentrum, Zurich, Switzerland", url="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.40.480&rep=rep1&type=pdf", bibkey="tr/ethz/WeberS97") public class VAFile<V extends NumberVector> extends AbstractRefiningIndex<V> implements KNNIndex<V>, RangeIndex<V>
Vector-approximation file (VAFile)Reference:
R. Weber, S. Blott
An approximation based data structure for similarity search
Report TR1997b, ETH Zentrum, Zurich, SwitzerlandTODO: 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 classVAFile.Factory<V extends NumberVector>Index factory class.classVAFile.VAFileKNNQueryKNN query for this index.classVAFile.VAFileRangeQueryRange query for this index.-
Nested classes/interfaces inherited from class elki.index.AbstractRefiningIndex
AbstractRefiningIndex.AbstractRefiningQuery
-
-
Field Summary
Fields Modifier and Type Field Description private static LoggingLOGLogging class.(package private) intpageSizePage size, for estimating the VA file size.private intpartitionsNumber of partitions.(package private) intscansNumber of scans we performed.private double[][]splitPositionsQuantile grid we use.private java.util.List<VectorApproximation>vectorApproxApproximation index.-
Fields inherited from class elki.index.AbstractRefiningIndex
relation
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VectorApproximationcalculateApproximation(DBIDRef id, V dv)Calculate the VA file position given the existing borders.LogginggetLogger()Get the class logger.longgetScannedPages()Get the number of scanned bytes.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.voidsetPartitions(Relation<V> relation)Initialize the data set grid by computing quantiles.-
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
Logging class.
-
vectorApprox
private java.util.List<VectorApproximation> vectorApprox
Approximation index.
-
partitions
private int partitions
Number of partitions.
-
splitPositions
private double[][] splitPositions
Quantile grid we use.
-
pageSize
int pageSize
Page size, for estimating the VA file size.
-
scans
int scans
Number of scans we performed.
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:IndexInitialize the index. For static indexes, this is the moment the index is bulk loaded.- Specified by:
initializein interfaceIndex
-
setPartitions
public void setPartitions(Relation<V> relation) throws java.lang.IllegalArgumentException
Initialize the data set grid by computing quantiles.- Parameters:
relation- Data relation- Throws:
java.lang.IllegalArgumentException
-
calculateApproximation
public VectorApproximation calculateApproximation(DBIDRef id, V dv)
Calculate the VA file position given the existing borders.- Parameters:
id- Object IDdv- Data vector- Returns:
- Vector approximation
-
getScannedPages
public long getScannedPages()
Get the number of scanned bytes.- Returns:
- Number of scanned bytes.
-
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>
-
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
-
-