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
LatLngAsECEFIndex
andLngLatAsECEFIndex
for 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 class
ProjectedIndex.Factory<O,I>
Index factory.(package private) class
ProjectedIndex.ProjectedKNNByDBID
Class to proxy kNN queries.(package private) class
ProjectedIndex.ProjectedKNNByObject
Class to proxy kNN queries.(package private) class
ProjectedIndex.ProjectedRangeByDBID
Class to proxy range queries.(package private) class
ProjectedIndex.ProjectedRangeByObject
Class to proxy range queries.(package private) class
ProjectedIndex.ProjectedRKNNByDBID
Class to proxy RkNN queries.(package private) class
ProjectedIndex.ProjectedRKNNByObject
Class to proxy RkNN queries.
-
Field Summary
Fields Modifier and Type Field Description (package private) Index
inner
Inner index.(package private) double
kmulti
Multiplier for k.private static Logging
LOG
Class logger(package private) boolean
norefine
Refinement disable flag.(package private) Projection<O,I>
proj
Projection.(package private) Counter
refinements
Count the number of distance refinements computed.(package private) Relation<? extends O>
relation
The relation we predend to index.(package private) Relation<I>
view
The 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 void
countRefinement()
Count a single distance refinement.void
initialize()
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.void
logStatistics()
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:Index
Initialize the index. For static indexes, this is the moment the index is bulk loaded.- Specified by:
initialize
in interfaceIndex
-
logStatistics
public void logStatistics()
Description copied from interface:Index
Send 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:
logStatistics
in interfaceIndex
-
kNNByObject
public KNNSearcher<O> kNNByObject(DistanceQuery<O> distanceQuery, int maxk, int flags)
Description copied from interface:KNNIndex
Get 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:
kNNByObject
in 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:KNNIndex
Get 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:RangeIndex
Get 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:
rangeByObject
in 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:RangeIndex
Get 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:
rangeByDBID
in 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:RKNNIndex
Get 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:
rkNNByObject
in 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:RKNNIndex
Get 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:
rkNNByDBID
in interfaceRKNNIndex<O>
- Parameters:
distanceQuery
- Distance querymaxk
- Maximum k for RkNN queryflags
- Hints for the optimizer- Returns:
- RKNN Query object or
null
-
-