@Priority(value=200) public class SimplifiedCoverTree<O> extends AbstractCoverTree<O> implements RangeIndex<O>, KNNIndex<O>
This version does not store the distance to the parent, so it needs only
about 40% of the memory of CoverTree
but does more distance
computations for search.
Reference:
A. Beygelzimer, S. Kakade, J. Langford
Cover trees for nearest neighbor
In Proc. 23rd International Conference on Machine Learning (ICML).
TODO: allow insertions and removals, as in the original publication.
Modifier and Type | Class and Description |
---|---|
class |
SimplifiedCoverTree.CoverTreeKNNQuery
KNN Query class.
|
class |
SimplifiedCoverTree.CoverTreeRangeQuery
Range query class.
|
static class |
SimplifiedCoverTree.Factory<O>
Index factory.
|
private static class |
SimplifiedCoverTree.Node
Node object.
|
Modifier and Type | Field and Description |
---|---|
private static Logging |
LOG
Class logger.
|
private SimplifiedCoverTree.Node |
root
Tree root.
|
distanceFunction, distComputations, expansion, invLogExpansion, scaleBottom, truncate
relation
Constructor and Description |
---|
SimplifiedCoverTree(Relation<O> relation,
DistanceFunction<? super O> distanceFunction,
double expansion,
int truncate)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected SimplifiedCoverTree.Node |
bulkConstruct(DBIDRef cur,
int maxScale,
ModifiableDoubleDBIDList elems)
Bulk-load the cover tree.
|
void |
bulkLoad(DBIDs ids)
Bulk-load the index.
|
private void |
checkCoverTree(SimplifiedCoverTree.Node cur,
int[] counts,
int depth)
Collect some statistics on the tree.
|
KNNQuery<O> |
getKNNQuery(DistanceQuery<O> distanceQuery,
java.lang.Object... hints)
Get a KNN query object for the given distance query and k.
|
protected Logging |
getLogger()
Get the class logger.
|
RangeQuery<O> |
getRangeQuery(DistanceQuery<O> distanceQuery,
java.lang.Object... hints)
Get a range query object for the given distance query and k.
|
void |
initialize()
Initialize the index.
|
collectByCover, distance, distance, distToScale, excludeNotCovered, getLongName, getShortName, logStatistics, maxDistance, scaleToDist
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
logStatistics
getLongName, getShortName
private static final Logging LOG
private SimplifiedCoverTree.Node root
public SimplifiedCoverTree(Relation<O> relation, DistanceFunction<? super O> distanceFunction, double expansion, int truncate)
relation
- data relationdistanceFunction
- distance functionexpansion
- Expansion ratetruncate
- Truncate branches with less than this number of instances.public void initialize()
Index
initialize
in interface Index
public void bulkLoad(DBIDs ids)
ids
- IDs to loadprotected SimplifiedCoverTree.Node bulkConstruct(DBIDRef cur, int maxScale, ModifiableDoubleDBIDList elems)
This bulk-load is slightly simpler than the one used in the original cover-tree source: We do not look back into the "far" set of candidates.
cur
- Current routing objectmaxScale
- Maximum scaleelems
- Candidatesprivate void checkCoverTree(SimplifiedCoverTree.Node cur, int[] counts, int depth)
cur
- Current nodecounts
- Counter setdepth
- Current depthpublic RangeQuery<O> getRangeQuery(DistanceQuery<O> distanceQuery, java.lang.Object... hints)
RangeIndex
getRangeQuery
in interface RangeIndex<O>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
public KNNQuery<O> getKNNQuery(DistanceQuery<O> distanceQuery, java.lang.Object... hints)
KNNIndex
getKNNQuery
in interface KNNIndex<O>
distanceQuery
- Distance queryhints
- Hints for the optimizernull
protected Logging getLogger()
AbstractCoverTree
getLogger
in class AbstractCoverTree<O>
Copyright © 2019 ELKI Development Team. License information.