|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.math.neighborhood.Searcher
org.apache.mahout.math.neighborhood.UpdatableSearcher
org.apache.mahout.math.neighborhood.BruteSearch
public class BruteSearch
Search for nearest neighbors using a complete search (i.e. looping through the references and comparing each vector to the query).
Field Summary |
---|
Fields inherited from class org.apache.mahout.math.neighborhood.Searcher |
---|
distanceMeasure |
Constructor Summary | |
---|---|
BruteSearch(DistanceMeasure distanceMeasure)
|
Method Summary | |
---|---|
void |
add(Vector vector)
Add a new Vector to the Searcher that will be checked when getting the nearest neighbors. |
void |
clear()
|
Iterator<Vector> |
iterator()
|
boolean |
remove(Vector query,
double epsilon)
|
List<List<WeightedThing<Vector>>> |
search(Iterable<WeightedVector> queries,
int limit,
int numThreads)
Searches with a list full of queries in a threaded fashion. |
List<WeightedThing<Vector>> |
search(Vector query,
int limit)
Scans the list of reference vectors one at a time for @limit neighbors of the query vector. |
WeightedThing<Vector> |
searchFirst(Vector query,
boolean differentThanQuery)
Returns the closest vector to the query. |
int |
size()
Returns the number of WeightedVectors being searched for nearest neighbors. |
Methods inherited from class org.apache.mahout.math.neighborhood.Searcher |
---|
addAll, addAllMatrixSlices, addAllMatrixSlicesAsWeightedVectors, getCandidateQueue, getDistanceMeasure, search, searchFirst |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BruteSearch(DistanceMeasure distanceMeasure)
Method Detail |
---|
public void add(Vector vector)
Searcher
add
in class Searcher
public int size()
Searcher
size
in class Searcher
public List<WeightedThing<Vector>> search(Vector query, int limit)
search
in class Searcher
query
- The query vector.limit
- The number of results to returned; must be at least 1.
public WeightedThing<Vector> searchFirst(Vector query, boolean differentThanQuery)
searchFirst
in class Searcher
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<List<WeightedThing<Vector>>> search(Iterable<WeightedVector> queries, int limit, int numThreads) throws InterruptedException
queries
- The queries to search for.limit
- The number of results to return.numThreads
- Number of threads to use in searching.
InterruptedException
public Iterator<Vector> iterator()
public boolean remove(Vector query, double epsilon)
remove
in class UpdatableSearcher
public void clear()
clear
in class UpdatableSearcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |