Examples of EuclideanDistanceMeasure


Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  public void testNormal() {
    Matrix testData = new DenseMatrix(100000, 10);
    final Normal gen = new Normal();
    testData.assign(gen);

    final EuclideanDistanceMeasure distance = new EuclideanDistanceMeasure();
    BruteSearch ref = new BruteSearch(distance);
    ref.addAllMatrixSlicesAsWeightedVectors(testData);

    LocalitySensitiveHashSearch cut = new LocalitySensitiveHashSearch(distance, 10);
    cut.addAllMatrixSlicesAsWeightedVectors(testData);
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

    private static final int SEARCH_SIZE = 300;
    private static final int MAX_DEPTH = 100;

    @Override
    public UpdatableSearcher getSearch(int n) {
        return new ProjectionSearch(new EuclideanDistanceMeasure(), 4, 20);
    }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  @Test
  public void testEpsilon() {
    final int dataSize = 10000;
    final int querySize = 30;
    final DistanceMeasure metric = new EuclideanDistanceMeasure();

    // these determine the dimension for the test. Each scale is multiplied by each multiplier
    final List<Integer> scales = ImmutableList.of(10);
    final List<Integer> multipliers = ImmutableList.of(1, 2, 3, 5);
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

    }
  }

  @Override
  public UpdatableSearcher getSearch(int n) {
    return new FastProjectionSearch(new EuclideanDistanceMeasure(), 4, 20);
  }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

    return data;
  }

  @Override
  public UpdatableSearcher getSearch(int n) {
    return new BruteSearch(new EuclideanDistanceMeasure());
  }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  }

  @Test
  public void testMatrixSearch() {
    List<WeightedVector> referenceVectors = Lists.newArrayListWithExpectedSize(8);
    BruteSearch searcher = new BruteSearch(new EuclideanDistanceMeasure());
    for (int i = 0; i < 8; i++) {
      referenceVectors.add(new WeightedVector(
          new DenseVector(new double[]{0.125 * (i & 4), i & 2, i & 1}), 1, i));
      searcher.add(referenceVectors.get(referenceVectors.size() - 1));
    }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  }

  @Parameters
  public static List<Object[]> generateData() {
    return Arrays.asList(new Object[][] {
        {new ProjectionSearch(new EuclideanDistanceMeasure(), NUM_PROJECTIONS, SEARCH_SIZE), true},
        {new FastProjectionSearch(new EuclideanDistanceMeasure(), NUM_PROJECTIONS, SEARCH_SIZE),
            true},
        {new LocalitySensitiveHashSearch(new EuclideanDistanceMeasure(), SEARCH_SIZE), true},
        {new ProjectionSearch(new EuclideanDistanceMeasure(), NUM_PROJECTIONS, SEARCH_SIZE), false},
        {new FastProjectionSearch(new EuclideanDistanceMeasure(), NUM_PROJECTIONS, SEARCH_SIZE),
            false},
        {new LocalitySensitiveHashSearch(new EuclideanDistanceMeasure(), SEARCH_SIZE), false}
    }
    );
  }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

        searcher.getClass().getName(), clusterTime,
        clusterTime / syntheticData.getFirst().size() * 1e6);

    // verify that the total weight of the centroids near each corner is correct
    double[] cornerWeights = new double[1 << NUM_DIMENSIONS];
    Searcher trueFinder = new BruteSearch(new EuclideanDistanceMeasure());
    for (Vector trueCluster : syntheticData.getSecond()) {
      trueFinder.add(trueCluster);
    }
    for (Centroid centroid : clusterer.getCentroidsIterable()) {
      WeightedThing<Vector> closest = trueFinder.search(centroid, 1).get(0);
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  @Test
  public void testBasicClustering() {
    List<? extends WeightedVector> data = cubishTestData(1);

    BallKMeans r = new BallKMeans(new BruteSearch(new EuclideanDistanceMeasure()), 6, 20);
    r.cluster(data);
    for (Centroid centroid : r) {
      for (int i = 0; i < 10; i++) {
        System.out.printf("%10.4f", centroid.get(i));
      }
View Full Code Here

Examples of org.apache.mahout.common.distance.EuclideanDistanceMeasure

  public void testInitialization() {
    // start with super clusterable data
    List<? extends WeightedVector> data = cubishTestData(0.01);

    // just do initialization of ball k-means.  This should drop a point into each of the clusters
    BallKMeans r = new BallKMeans(new BruteSearch(new EuclideanDistanceMeasure()), 6, 20);
    r.cluster(data);

    // put the centroids into a matrix
    Matrix x = new DenseMatrix(6, 5);
    int row = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.