Class ProjectedIndex<O,I>
- java.lang.Object
-
- elki.index.projected.ProjectedIndex<O,I>
-
- Type Parameters:
O- Outer object typeI- Inner object type
- All Implemented Interfaces:
Index,KNNIndex<O>,RangeIndex<O>,RKNNIndex<O>
- Direct Known Subclasses:
LatLngAsECEFIndex,LngLatAsECEFIndex
public class ProjectedIndex<O,I> extends java.lang.Object implements KNNIndex<O>, RKNNIndex<O>, RangeIndex<O>
Index data in an arbitrary projection.Note: be careful when using this class, as it may/will yield incorrect distances, depending on your projection! It may be desirable to use a modified index that corrects for this error, or supports specific combinations only.
See
LatLngAsECEFIndexandLngLatAsECEFIndexfor example indexes that support only a specific (good) combination.FIXME: add refinement to bulk queries!
- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProjectedIndex.Factory<O,I>Index factory.(package private) classProjectedIndex.ProjectedKNNByDBIDClass to proxy kNN queries.(package private) classProjectedIndex.ProjectedKNNByObjectClass to proxy kNN queries.(package private) classProjectedIndex.ProjectedRangeByDBIDClass to proxy range queries.(package private) classProjectedIndex.ProjectedRangeByObjectClass to proxy range queries.(package private) classProjectedIndex.ProjectedRKNNByDBIDClass to proxy RkNN queries.(package private) classProjectedIndex.ProjectedRKNNByObjectClass to proxy RkNN queries.
-
Field Summary
Fields Modifier and Type Field Description (package private) IndexinnerInner index.(package private) doublekmultiMultiplier for k.private static LoggingLOGClass logger(package private) booleannorefineRefinement disable flag.(package private) Projection<O,I>projProjection.(package private) CounterrefinementsCount the number of distance refinements computed.(package private) Relation<? extends O>relationThe relation we predend to index.(package private) Relation<I>viewThe view that we really index.
-
Constructor Summary
Constructors Constructor Description ProjectedIndex(Relation<? extends O> relation, Projection<O,I> proj, Relation<I> view, Index inner, boolean norefine, double kmulti)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcountRefinement()Count a single distance refinement.voidinitialize()Initialize the index.KNNSearcher<DBIDRef>kNNByDBID(DistanceQuery<O> distanceQuery, int maxk, int flags)Get a KNN query object for the given distance query and k.KNNSearcher<O>kNNByObject(DistanceQuery<O> 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<DBIDRef>rangeByDBID(DistanceQuery<O> distanceQuery, double maxradius, int flags)Get a range query object for the given distance query and k.RangeSearcher<O>rangeByObject(DistanceQuery<O> distanceQuery, double maxradius, int flags)Get a range query object for the given distance query and k.RKNNSearcher<DBIDRef>rkNNByDBID(DistanceQuery<O> distanceQuery, int maxk, int flags)Get a RKNN query object for the given distance query and k.RKNNSearcher<O>rkNNByObject(DistanceQuery<O> distanceQuery, int maxk, int flags)Get a RKNN query object for the given distance query and k.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger
-
inner
Index inner
Inner index.
-
proj
Projection<O,I> proj
Projection.
-
norefine
boolean norefine
Refinement disable flag.
-
kmulti
double kmulti
Multiplier for k.
-
refinements
final Counter refinements
Count the number of distance refinements computed.
-
-
Constructor Detail
-
ProjectedIndex
public ProjectedIndex(Relation<? extends O> relation, Projection<O,I> proj, Relation<I> view, Index inner, boolean norefine, double kmulti)
Constructor.- Parameters:
relation- Relation to index.proj- Projection to use.view- View to use.inner- Index to wrap.norefine- Refinement disable flag.kmulti- Multiplicator for k
-
-
Method Detail
-
countRefinement
private void countRefinement()
Count a single distance refinement.
-
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
-
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
-
kNNByObject
public KNNSearcher<O> kNNByObject(DistanceQuery<O> 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<O>- Parameters:
distanceQuery- Distance querymaxk- Maximum value of kflags- Hints for the optimizer- Returns:
- KNN Query object or
null
-
kNNByDBID
public KNNSearcher<DBIDRef> kNNByDBID(DistanceQuery<O> 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!
-
rangeByObject
public RangeSearcher<O> rangeByObject(DistanceQuery<O> 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<O>- Parameters:
distanceQuery- Distance querymaxradius- Maximum rangeflags- Hints for the optimizer- Returns:
- KNN Query object or
null
-
rangeByDBID
public RangeSearcher<DBIDRef> rangeByDBID(DistanceQuery<O> 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:
rangeByDBIDin interfaceRangeIndex<O>- Parameters:
distanceQuery- Distance querymaxradius- Maximum rangeflags- Hints for the optimizer- Returns:
- KNN Query object or
null
-
rkNNByObject
public RKNNSearcher<O> rkNNByObject(DistanceQuery<O> distanceQuery, int maxk, int flags)
Description copied from interface:RKNNIndexGet a RKNN query object for the given distance query and k.This function MAY return null, when the given distance is not supported!
- Specified by:
rkNNByObjectin interfaceRKNNIndex<O>- Parameters:
distanceQuery- Distance querymaxk- Maximum k for RkNN queryflags- Hints for the optimizer- Returns:
- RKNN Query object or
null
-
rkNNByDBID
public RKNNSearcher<DBIDRef> rkNNByDBID(DistanceQuery<O> distanceQuery, int maxk, int flags)
Description copied from interface:RKNNIndexGet a RKNN query object for the given distance query and k.This function MAY return null, when the given distance is not supported!
- Specified by:
rkNNByDBIDin interfaceRKNNIndex<O>- Parameters:
distanceQuery- Distance querymaxk- Maximum k for RkNN queryflags- Hints for the optimizer- Returns:
- RKNN Query object or
null
-
-