|
||||||||||
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.LocalitySensitiveHashSearch
public class LocalitySensitiveHashSearch
Implements a Searcher that uses locality sensitivity hash as a first pass approximation to estimate distance without floating point math. The clever bit about this implementation is that it does an adaptive cutoff for the cutoff on the bitwise distance. Making this cutoff adaptive means that we only needs to make a single pass through the data.
Field Summary |
---|
Fields inherited from class org.apache.mahout.math.neighborhood.Searcher |
---|
distanceMeasure |
Constructor Summary | |
---|---|
LocalitySensitiveHashSearch(DistanceMeasure distanceMeasure,
int searchSize)
|
Method Summary | |
---|---|
void |
add(Vector vector)
Add a new Vector to the Searcher that will be checked when getting the nearest neighbors. |
void |
clear()
|
int |
getSearchSize()
|
Iterator<Vector> |
iterator()
|
boolean |
remove(Vector v,
double epsilon)
|
protected static WeightedThing<Vector> |
removeHash(WeightedThing<Vector> input)
|
int |
resetEvaluationCount()
This is only for testing. |
List<WeightedThing<Vector>> |
search(Vector query,
int limit)
When querying the Searcher for the closest vectors, a list of WeightedThing |
WeightedThing<Vector> |
searchFirst(Vector query,
boolean differentThanQuery)
Returns the closest vector to the query. |
void |
setRaiseHashLimitStrategy(double strategy)
|
void |
setSearchSize(int size)
|
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 LocalitySensitiveHashSearch(DistanceMeasure distanceMeasure, int searchSize)
Method Detail |
---|
public List<WeightedThing<Vector>> search(Vector query, int limit)
Searcher
search
in class Searcher
query
- the vector to search forlimit
- the number of results to return
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).
protected static WeightedThing<Vector> removeHash(WeightedThing<Vector> input)
public void add(Vector vector)
Searcher
add
in class Searcher
public int size()
Searcher
size
in class Searcher
public int getSearchSize()
public void setSearchSize(int size)
public void setRaiseHashLimitStrategy(double strategy)
public int resetEvaluationCount()
public Iterator<Vector> iterator()
public boolean remove(Vector v, 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 |