
V - Vector typepublic class InMemoryInvertedIndex<V extends NumberVector> extends AbstractIndex<V> implements KNNIndex<V>, RangeIndex<V>
| Modifier and Type | Class and Description |
|---|---|
protected class |
InMemoryInvertedIndex.ArcCosineKNNQuery
kNN query object, for arc cosine distance.
|
protected class |
InMemoryInvertedIndex.ArcCosineRangeQuery
kNN query object, for cosine distance.
|
protected class |
InMemoryInvertedIndex.CosineKNNQuery
kNN query object, for cosine distance.
|
protected class |
InMemoryInvertedIndex.CosineRangeQuery
kNN query object, for cosine distance.
|
static class |
InMemoryInvertedIndex.Factory<V extends NumberVector>
Index factory
|
| Modifier and Type | Field and Description |
|---|---|
(package private) ArrayList<ModifiableDoubleDBIDList> |
index
Inverted index.
|
(package private) WritableDoubleDataStore |
length
Length storage.
|
private static Logging |
LOG
Class logger.
|
relation| Constructor and Description |
|---|
InMemoryInvertedIndex(Relation<V> relation)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
KNNQuery<V> |
getKNNQuery(DistanceQuery<V> distanceQuery,
Object... hints)
Get a KNN query object for the given distance query and k.
|
String |
getLongName()
A "pretty" name for the result, for use in titles, captions and menus.
|
private ModifiableDoubleDBIDList |
getOrCreateColumn(int dim)
Get (or create) a column.
|
RangeQuery<V> |
getRangeQuery(DistanceQuery<V> distanceQuery,
Object... hints)
Get a range query object for the given distance query and k.
|
String |
getShortName()
A short name for the result, useful for file names.
|
private void |
indexDense(DBIDRef ref,
V obj)
Index a single (dense) instance.
|
private void |
indexSparse(DBIDRef ref,
SparseNumberVector obj)
Index a single (sparse) instance.
|
void |
initialize()
Initialize the index.
|
void |
logStatistics()
Send statistics to the logger, if enabled.
|
private double |
naiveQuery(V obj,
WritableDoubleDataStore scores,
HashSetModifiableDBIDs cands)
Query the most similar objects, abstract version.
|
private double |
naiveQueryDense(NumberVector obj,
WritableDoubleDataStore scores,
HashSetModifiableDBIDs cands)
Query the most similar objects, dense version.
|
private double |
naiveQuerySparse(SparseNumberVector obj,
WritableDoubleDataStore scores,
HashSetModifiableDBIDs cands)
Query the most similar objects, sparse version.
|
private static final Logging LOG
ArrayList<ModifiableDoubleDBIDList> index
WritableDoubleDataStore length
public void initialize()
Indexinitialize in interface Indexprivate void indexSparse(DBIDRef ref, SparseNumberVector obj)
ref - Object referenceobj - Object to index.private void indexDense(DBIDRef ref, V obj)
ref - Object referenceobj - Object to index.private ModifiableDoubleDBIDList getOrCreateColumn(int dim)
dim - Dimensionprivate double naiveQuerySparse(SparseNumberVector obj, WritableDoubleDataStore scores, HashSetModifiableDBIDs cands)
obj - Query objectscores - Score storagecands - Non-zero objects setprivate double naiveQueryDense(NumberVector obj, WritableDoubleDataStore scores, HashSetModifiableDBIDs cands)
obj - Query objectscores - Score storagecands - Non-zero objects setprivate double naiveQuery(V obj, WritableDoubleDataStore scores, HashSetModifiableDBIDs cands)
obj - Query objectscores - Score storage (must be initialized with zeros!)cands - Non-zero objects set (must be empty)public void logStatistics()
IndexlogStatistics in interface Indexpublic KNNQuery<V> getKNNQuery(DistanceQuery<V> distanceQuery, Object... hints)
KNNIndexgetKNNQuery in interface KNNIndex<V extends NumberVector>distanceQuery - Distance queryhints - Hints for the optimizernullpublic RangeQuery<V> getRangeQuery(DistanceQuery<V> distanceQuery, Object... hints)
RangeIndexgetRangeQuery in interface RangeIndex<V extends NumberVector>distanceQuery - Distance queryhints - Hints for the optimizernullpublic String getLongName()
ResultgetLongName in interface ResultgetLongName in class AbstractIndex<V extends NumberVector>public String getShortName()
ResultgetShortName in interface ResultgetShortName in class AbstractIndex<V extends NumberVector>Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.