@Test public void testNearest() { System.out.println("nearest"); int recall = 0; double error = 0.0; int hit = 0; for (int i = 0; i < testx.length; i++) { Neighbor neighbor = lsh.nearest(testx[i]); if (neighbor != null) { hit++; Neighbor truth = naive.nearest(testx[i]); if (neighbor.index == truth.index) { recall++; } else { error += Math.abs(neighbor.distance - truth.distance) / truth.distance; } } } error /= (hit - recall); assertEquals(1722, recall); assertEquals(2007, hit); assertEquals(0.0687, error, 1E-4); System.out.format("recall is %.2f%%%n", 100.0 * recall / testx.length); System.out.format("error when miss is %.2f%%%n", 100.0 * error); System.out.format("null rate is %.2f%%%n", 100.0 - 100.0 * hit / testx.length); }
@Override public Neighbor<double[], E> nearest(double[] q) { if (model == null) return super.nearest(q); return nearest(q, 0.95, 100); }
MPLSH extends LSH<E> { @Override public Neighbor<double[], E> nearest(double[] q) { if (model == null) return super.nearest(q); return nearest(q, 0.95, 100); } }
MPLSH extends LSH<E> { @Override public Neighbor<double[], E> nearest(double[] q) { if (model == null) return super.nearest(q); return nearest(q, 0.95, 100); } MPLSH(int d, int L, int k, double w);  MPLSH(int d, int L, int k, double w, int H); }
MPLSH extends LSH<E> { @Override public Neighbor<double[], E> nearest(double[] q) { if (model == null) return super.nearest(q); return nearest(q, 0.95, 100); } MPLSH(int d, int L, int k, double w);  MPLSH(int d, int L, int k, double w, int H); @Override String toString(); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz, double sigma); @Override Neighbor<double[], E> nearest(double[] q); Neighbor<double[], E> nearest(double[] q, double recall, int T); @Override Neighbor<double[], E>[] knn(double[] q, int k); @SuppressWarnings("unchecked") Neighbor<double[], E>[] knn(double[] q, int k, double recall, int T); @Override void range(double[] q, double radius, List<Neighbor<double[], E>> neighbors); void range(double[] q, double radius, List<Neighbor<double[], E>> neighbors, double recall, int T); }
MPLSH extends LSH<E> { @Override public Neighbor<double[], E> nearest(double[] q) { if (model == null) return super.nearest(q); return nearest(q, 0.95, 100); } MPLSH(int d, int L, int k, double w);  MPLSH(int d, int L, int k, double w, int H); @Override String toString(); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz); void fit(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz, double sigma); @Override Neighbor<double[], E> nearest(double[] q); Neighbor<double[], E> nearest(double[] q, double recall, int T); @Override Neighbor<double[], E>[] knn(double[] q, int k); @SuppressWarnings("unchecked") Neighbor<double[], E>[] knn(double[] q, int k, double recall, int T); @Override void range(double[] q, double radius, List<Neighbor<double[], E>> neighbors); void range(double[] q, double radius, List<Neighbor<double[], E>> neighbors, double recall, int T);  }