public final class CoverTree<V extends Vec> extends Object implements IncrementalCollection<V>
Modifier and Type | Class and Description |
---|---|
static class |
CoverTree.CoverTreeFactory<V extends Vec> |
Constructor and Description |
---|
CoverTree(CoverTree<V> toCopy) |
CoverTree(DistanceMetric dm) |
CoverTree(List<V> source,
DistanceMetric dm) |
CoverTree(List<V> source,
DistanceMetric dm,
ExecutorService threadpool) |
CoverTree(List<V> source,
DistanceMetric dm,
ExecutorService threadpool,
boolean looseBounds) |
Modifier and Type | Method and Description |
---|---|
CoverTree<V> |
clone() |
void |
insert(V x)
Incrementally adds the given datapoint into the collection
|
List<? extends VecPaired<V,Double>> |
search(Vec query,
double range)
Searches the space for all vectors that are within a given range of the query vector.
|
List<? extends VecPaired<V,Double>> |
search(Vec query,
int neighbors)
Searches the space for the k neighbors that are closest to the given query vector
|
void |
setLooseBounds(boolean looseBounds) |
protected jsat.linear.vectorcollection.CoverTree.TreeNode |
simpleInsert_(jsat.linear.vectorcollection.CoverTree.TreeNode p,
int x_indx)
prerequisites: d(p,x) ≤ covdist(p)
|
protected jsat.linear.vectorcollection.CoverTree.TreeNode |
simpleInsert(jsat.linear.vectorcollection.CoverTree.TreeNode p,
int x_indx) |
protected void |
simpleInsert(V x) |
int |
size()
Returns the number of vectors stored in the collection
|
public CoverTree(DistanceMetric dm)
public CoverTree(List<V> source, DistanceMetric dm)
public CoverTree(List<V> source, DistanceMetric dm, ExecutorService threadpool)
public CoverTree(List<V> source, DistanceMetric dm, ExecutorService threadpool, boolean looseBounds)
public void setLooseBounds(boolean looseBounds)
public List<? extends VecPaired<V,Double>> search(Vec query, double range)
VectorCollection
search
in interface VectorCollection<V extends Vec>
query
- the vector we want to find others nearrange
- the search range around our querypublic List<? extends VecPaired<V,Double>> search(Vec query, int neighbors)
VectorCollection
search
in interface VectorCollection<V extends Vec>
query
- the vector we want to find neighbors ofneighbors
- the maximum number of neighbors to returnpublic int size()
VectorCollection
size
in interface VectorCollection<V extends Vec>
public CoverTree<V> clone()
clone
in interface IncrementalCollection<V extends Vec>
clone
in interface VectorCollection<V extends Vec>
clone
in class Object
protected void simpleInsert(V x)
protected jsat.linear.vectorcollection.CoverTree.TreeNode simpleInsert(jsat.linear.vectorcollection.CoverTree.TreeNode p, int x_indx)
protected jsat.linear.vectorcollection.CoverTree.TreeNode simpleInsert_(jsat.linear.vectorcollection.CoverTree.TreeNode p, int x_indx)
p
- x_indx
- public void insert(V x)
IncrementalCollection
insert
in interface IncrementalCollection<V extends Vec>
x
- the vector to add to the collectionCopyright © 2017. All rights reserved.