O
- Object type@Reference(authors="C. Yu, B. C. Ooi, K. L. Tan, H. V. Jagadish",title="Indexing the distance: An efficient method to knn processing",booktitle="Proc. 27th Int. Conf. on Very Large Data Bases",url="http://www.vldb.org/conf/2001/P421.pdf",bibkey="DBLP:conf/vldb/OoiYTJ01") @Reference(authors="H. V. Jagadish, B. C. Ooi, K. L. Tan, C. Yu, R. Zhang",title="iDistance: An adaptive B+-tree based indexing method for nearest neighbor search",booktitle="ACM Transactions on Database Systems (TODS), 30(2)",url="https://doi.org/10.1145/1071610.1071612",bibkey="DBLP:journals/tods/JagadishOTYZ05") public class InMemoryIDistanceIndex<O> extends AbstractRefiningIndex<O> implements RangeIndex<O>, KNNIndex<O>
Important note: we are currently using a different query strategy. The original publication discusses queries based on repeated radius queries. We use a strategy based on shrinking spheres, iteratively refined starting with the closes reference point. We also do not use a B+-tree as data structure, but simple in-memory lists. Therefore, we cannot report page accesses needed.
Feel free to contribute improved query strategies. All the code is essentially here, you only need to query every reference point list, not just the best.
Reference:
C. Yu, B. C. Ooi, K. L. Tan, H. V. Jagadish
Indexing the Distance: An Efficient Method to KNN Processing.
In Proceedings of the 27th International Conference on Very Large Data Bases
H. V. Jagadish, B. C. Ooi, K. L. Tan, C. Yu, R. Zhang
iDistance: An adaptive B+-tree based indexing method for nearest neighbor
search.
ACM Transactions on Database Systems (TODS), 30(2).
Modifier and Type | Class and Description |
---|---|
static class |
InMemoryIDistanceIndex.Factory<V>
Index factory for iDistance indexes.
|
protected class |
InMemoryIDistanceIndex.IDistanceKNNQuery
kNN query implementation.
|
protected class |
InMemoryIDistanceIndex.IDistanceRangeQuery
Exact Range query implementation.
|
AbstractRefiningIndex.AbstractKNNQuery, AbstractRefiningIndex.AbstractRangeQuery
Modifier and Type | Field and Description |
---|---|
private DistanceQuery<O> |
distanceQuery
Distance query.
|
private ModifiableDoubleDBIDList[] |
index
The actual index.
|
private KMedoidsInitialization<O> |
initialization
Initialization method.
|
private static Logging |
LOG
Class logger.
|
private int |
numref
Number of reference points.
|
private ArrayDBIDs |
referencepoints
Reference points.
|
relation
Constructor and Description |
---|
InMemoryIDistanceIndex(Relation<O> relation,
DistanceQuery<O> distance,
KMedoidsInitialization<O> initialization,
int numref)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
binarySearch(ModifiableDoubleDBIDList index,
DoubleDBIDListIter iter,
double val)
Seek an iterator to the desired position, using binary search.
|
private DistanceFunction<? super O> |
getDistanceFunction()
Distance function.
|
KNNQuery<O> |
getKNNQuery(DistanceQuery<O> distanceQuery,
java.lang.Object... hints)
Get a KNN query object for the given distance query and k.
|
Logging |
getLogger()
Get the class logger.
|
java.lang.String |
getLongName()
A "pretty" name for the result, for use in titles, captions and menus.
|
RangeQuery<O> |
getRangeQuery(DistanceQuery<O> distanceQuery,
java.lang.Object... hints)
Get a range query object for the given distance query and k.
|
java.lang.String |
getShortName()
A short name for the result, useful for file names.
|
void |
initialize()
Initialize the index.
|
void |
logStatistics()
Send statistics to the logger, if enabled.
|
protected static <O> DoubleIntPair[] |
rankReferencePoints(DistanceQuery<O> distanceQuery,
O obj,
ArrayDBIDs referencepoints)
Sort the reference points by distance to the query object
|
countRefinements, refine
private static final Logging LOG
private DistanceQuery<O> distanceQuery
private KMedoidsInitialization<O> initialization
private int numref
private ArrayDBIDs referencepoints
private ModifiableDoubleDBIDList[] index
public InMemoryIDistanceIndex(Relation<O> relation, DistanceQuery<O> distance, KMedoidsInitialization<O> initialization, int numref)
relation
- Data relationdistance
- Distanceinitialization
- Initialization methodnumref
- Number of reference pointspublic void initialize()
Index
initialize
in interface Index
public KNNQuery<O> getKNNQuery(DistanceQuery<O> distanceQuery, java.lang.Object... hints)
KNNIndex
getKNNQuery
in interface KNNIndex<O>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
public RangeQuery<O> getRangeQuery(DistanceQuery<O> distanceQuery, java.lang.Object... hints)
RangeIndex
getRangeQuery
in interface RangeIndex<O>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
private DistanceFunction<? super O> getDistanceFunction()
public java.lang.String getLongName()
Result
getLongName
in interface Result
getLongName
in class AbstractIndex<O>
public java.lang.String getShortName()
Result
getShortName
in interface Result
getShortName
in class AbstractIndex<O>
public Logging getLogger()
AbstractRefiningIndex
getLogger
in class AbstractRefiningIndex<O>
public void logStatistics()
Index
logStatistics
in interface Index
logStatistics
in class AbstractRefiningIndex<O>
protected static <O> DoubleIntPair[] rankReferencePoints(DistanceQuery<O> distanceQuery, O obj, ArrayDBIDs referencepoints)
distanceQuery
- Distance queryobj
- Query objectreferencepoints
- Iterator for reference pointsprotected static void binarySearch(ModifiableDoubleDBIDList index, DoubleDBIDListIter iter, double val)
index
- Index to searchiter
- Iteratorval
- Distance to search toCopyright © 2019 ELKI Development Team. License information.