|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.math.neighborhood.Searcher
public abstract class Searcher
Describes how to search a bunch of vectors. The vectors can be of any type (weighted, sparse, ...) but only the values of the vector matter when searching (weights, indices, ...) will not. When iterating through a Searcher, the Vectors added to it are returned.
Field Summary | |
---|---|
protected DistanceMeasure |
distanceMeasure
|
Constructor Summary | |
---|---|
protected |
Searcher(DistanceMeasure distanceMeasure)
|
Method Summary | |
---|---|
abstract void |
add(Vector vector)
Add a new Vector to the Searcher that will be checked when getting the nearest neighbors. |
void |
addAll(Iterable<? extends Vector> data)
Adds all the data elements in the Searcher. |
void |
addAllMatrixSlices(Iterable<MatrixSlice> data)
Adds all the data elements in the Searcher. |
void |
addAllMatrixSlicesAsWeightedVectors(Iterable<MatrixSlice> data)
|
void |
clear()
|
static org.apache.lucene.util.PriorityQueue<WeightedThing<Vector>> |
getCandidateQueue(int limit)
Returns a bounded size priority queue, in reverse order that keeps track of the best nearest neighbor vectors. |
DistanceMeasure |
getDistanceMeasure()
|
boolean |
remove(Vector v,
double epsilon)
|
List<List<WeightedThing<Vector>>> |
search(Iterable<? extends Vector> queries,
int limit)
|
abstract List<WeightedThing<Vector>> |
search(Vector query,
int limit)
When querying the Searcher for the closest vectors, a list of WeightedThing |
List<WeightedThing<Vector>> |
searchFirst(Iterable<? extends Vector> queries,
boolean differentThanQuery)
|
abstract WeightedThing<Vector> |
searchFirst(Vector query,
boolean differentThanQuery)
Returns the closest vector to the query. |
abstract int |
size()
Returns the number of WeightedVectors being searched for nearest neighbors. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Field Detail |
---|
protected DistanceMeasure distanceMeasure
Constructor Detail |
---|
protected Searcher(DistanceMeasure distanceMeasure)
Method Detail |
---|
public DistanceMeasure getDistanceMeasure()
public abstract void add(Vector vector)
public abstract int size()
public abstract List<WeightedThing<Vector>> search(Vector query, int limit)
query
- the vector to search forlimit
- the number of results to return
public List<List<WeightedThing<Vector>>> search(Iterable<? extends Vector> queries, int limit)
public abstract WeightedThing<Vector> searchFirst(Vector query, boolean differentThanQuery)
query
- the vector to search fordifferentThanQuery
- if true, returns the closest vector different than the query (this
only matters if the query is among the searched vectors), otherwise,
returns the closest vector to the query (even the same vector).
public List<WeightedThing<Vector>> searchFirst(Iterable<? extends Vector> queries, boolean differentThanQuery)
public void addAll(Iterable<? extends Vector> data)
data
- an iterable of WeightedVectors to add.public void addAllMatrixSlices(Iterable<MatrixSlice> data)
data
- an iterable of MatrixSlices to add.public void addAllMatrixSlicesAsWeightedVectors(Iterable<MatrixSlice> data)
public boolean remove(Vector v, double epsilon)
public void clear()
public static org.apache.lucene.util.PriorityQueue<WeightedThing<Vector>> getCandidateQueue(int limit)
limit
- maximum size of the heap.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |