E
- the type of data objects in the hash table.public class MPLSH<E> extends LSH<E>
By default, the query object (reference equality) is excluded from the neighborhood.
LSH
,
Serialized FormConstructor and Description |
---|
MPLSH(int d,
int L,
int k,
double w)
Constructor.
|
MPLSH(int d,
int L,
int k,
double w,
int H)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
fit(RNNSearch<double[],double[]> range,
double[][] samples,
double radius)
Fits the posteriori multiple probe algorithm.
|
void |
fit(RNNSearch<double[],double[]> range,
double[][] samples,
double radius,
int Nz)
Fits the posteriori multiple probe algorithm.
|
void |
fit(RNNSearch<double[],double[]> range,
double[][] samples,
double radius,
int Nz,
double sigma)
Train the posteriori multiple probe algorithm.
|
protected void |
initHashTable(int d,
int L,
int k,
double w,
int H)
Initialize the hash tables.
|
Neighbor<double[],E>[] |
knn(double[] q,
int k)
Search the k nearest neighbors to the query.
|
Neighbor<double[],E>[] |
knn(double[] q,
int k,
double recall,
int T)
Returns the approximate k-nearest neighbors.
|
Neighbor<double[],E> |
nearest(double[] q)
Search the nearest neighbor to the given sample.
|
Neighbor<double[],E> |
nearest(double[] q,
double recall,
int T)
Returns the approximate nearest neighbor.
|
void |
range(double[] q,
double radius,
java.util.List<Neighbor<double[],E>> neighbors)
Search the neighbors in the given radius of query object, i.e.
|
void |
range(double[] q,
double radius,
java.util.List<Neighbor<double[],E>> neighbors,
double recall,
int T)
Search the neighbors in the given radius of query object, i.e.
|
java.lang.String |
toString() |
public MPLSH(int d, int L, int k, double w)
d
- the dimensionality of data.L
- the number of hash tables.k
- the number of random projection hash functions, which is usually
set to log(N) where N is the dataset size.w
- the width of random projections. It should be sufficiently
away from 0. But we should not choose an w value that is too large, which
will increase the query time.public MPLSH(int d, int L, int k, double w, int H)
d
- the dimensionality of data.L
- the number of hash tables.k
- the number of random projection hash functions, which is usually
set to log(N) where N is the dataset size.w
- the width of random projections. It should be sufficiently
away from 0. But we should not choose an r value that is too large, which
will increase the query time.H
- the number of buckets of hash tables.protected void initHashTable(int d, int L, int k, double w, int H)
LSH
initHashTable
in class LSH<E>
public void fit(RNNSearch<double[],double[]> range, double[][] samples, double radius)
range
- the neighborhood search data structure.radius
- the radius for range search.samples
- the training samples.public void fit(RNNSearch<double[],double[]> range, double[][] samples, double radius, int Nz)
range
- the neighborhood search data structure.radius
- the radius for range search.Nz
- the number of quantized values.public void fit(RNNSearch<double[],double[]> range, double[][] samples, double radius, int Nz, double sigma)
range
- the neighborhood search data structure.radius
- the radius for range search.Nz
- the number of quantized values.sigma
- the Parzen window width.public Neighbor<double[],E> nearest(double[] q)
NearestNeighborSearch
public Neighbor<double[],E> nearest(double[] q, double recall, int T)
q
- the query object.recall
- the expected recall rate.T
- the maximum number of probes.public Neighbor<double[],E>[] knn(double[] q, int k)
KNNSearch
public Neighbor<double[],E>[] knn(double[] q, int k, double recall, int T)
q
- the query object.k
- the number of nearest neighbors to search for.recall
- the expected recall rate.T
- the maximum number of probes.public void range(double[] q, double radius, java.util.List<Neighbor<double[],E>> neighbors)
RNNSearch
public void range(double[] q, double radius, java.util.List<Neighbor<double[],E>> neighbors, double recall, int T)
q
- the query object.radius
- the radius of search range.neighbors
- the list to store found neighbors in the given range on output.recall
- the expected recall rate.T
- the maximum number of probes.