Package org.apache.mahout.common.distance

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


    clusterDumper.printClusters(termDictionary);
  }

  @Test
  public void testMeanShift() throws Exception {
    DistanceMeasure measure = new CosineDistanceMeasure();
    Path output = getTestTempDirPath("output");
    Configuration conf = new Configuration();
    new MeanShiftCanopyDriver().run(conf, getTestTempDirPath("testdata"), output, measure, 0.5, 0.01, 0.05, 10, false, true, false);
    // run ClusterDumper
    ClusterDumper clusterDumper = new ClusterDumper(finalClusterPath(conf, output, 10), new Path(output, "clusteredPoints"));
View Full Code Here


    clusterDumper.printClusters(termDictionary);
  }
 
  @Test
  public void testMeanShift() throws Exception {
    DistanceMeasure measure = new CosineDistanceMeasure();
    IKernelProfile kernelProfile = new TriangularKernelProfile();
    Path output = getTestTempDirPath("output");
    Configuration conf = new Configuration();
    MeanShiftCanopyDriver.run(conf, getTestTempDirPath("testdata"), output,
        measure, kernelProfile, 0.5, 0.01, 0.05, 10, false, true, true);
View Full Code Here

      mark.incrementalCreateBenchmark();
      mark.cloneBenchmark();
      mark.dotBenchmark();
      mark.serializeBenchmark();
      mark.deserializeBenchmark();
      mark.distanceMeasureBenchmark(new CosineDistanceMeasure());
      mark.distanceMeasureBenchmark(new SquaredEuclideanDistanceMeasure());
      mark.distanceMeasureBenchmark(new EuclideanDistanceMeasure());
      mark.distanceMeasureBenchmark(new ManhattanDistanceMeasure());
      mark.distanceMeasureBenchmark(new TanimotoDistanceMeasure());
     
View Full Code Here

    return new ClusterClassifier(models, new KMeansClusteringPolicy());
  }
 
  private static ClusterClassifier newCosineKlusterClassifier() {
    List<Cluster> models = Lists.newArrayList();
    DistanceMeasure measure = new CosineDistanceMeasure();
    models.add(new org.apache.mahout.clustering.kmeans.Kluster(new DenseVector(2).assign(1), 0, measure));
    models.add(new org.apache.mahout.clustering.kmeans.Kluster(new DenseVector(2), 1, measure));
    models.add(new org.apache.mahout.clustering.kmeans.Kluster(new DenseVector(2).assign(-1), 2, measure));
    return new ClusterClassifier(models, new KMeansClusteringPolicy());
  }
View Full Code Here

    clusterDumper.printClusters(termDictionary);
  }
 
  @Test
  public void testMeanShift() throws Exception {
    DistanceMeasure measure = new CosineDistanceMeasure();
    IKernelProfile kernelProfile = new TriangularKernelProfile();
    Path output = getTestTempDirPath("output");
    Configuration conf = new Configuration();
    MeanShiftCanopyDriver.run(conf, getTestTempDirPath("testdata"), output,
        measure, kernelProfile, 0.5, 0.01, 0.05, 10, false, true, true);
View Full Code Here

    new MinusBenchmark(mark).benchmark();
    new TimesBenchmark(mark).benchmark();
    new SerializationBenchmark(mark).benchmark();

    DistanceBenchmark distanceBenchmark = new DistanceBenchmark(mark);
    distanceBenchmark.benchmark(new CosineDistanceMeasure());
    distanceBenchmark.benchmark(new SquaredEuclideanDistanceMeasure());
    distanceBenchmark.benchmark(new EuclideanDistanceMeasure());
    distanceBenchmark.benchmark(new ManhattanDistanceMeasure());
    distanceBenchmark.benchmark(new TanimotoDistanceMeasure());
    distanceBenchmark.benchmark(new ChebyshevDistanceMeasure());
    distanceBenchmark.benchmark(new MinkowskiDistanceMeasure());

    if (mark.numClusters > 0) {
      ClosestCentroidBenchmark centroidBenchmark = new ClosestCentroidBenchmark(mark);
      centroidBenchmark.benchmark(new CosineDistanceMeasure());
      centroidBenchmark.benchmark(new SquaredEuclideanDistanceMeasure());
      centroidBenchmark.benchmark(new EuclideanDistanceMeasure());
      centroidBenchmark.benchmark(new ManhattanDistanceMeasure());
      centroidBenchmark.benchmark(new TanimotoDistanceMeasure());
      centroidBenchmark.benchmark(new ChebyshevDistanceMeasure());
View Full Code Here

  public static List<Object[]> generateData() {
    RandomUtils.useTestSeed();
    Matrix dataPoints = LumpyData.lumpyRandomData(NUM_DATA_POINTS, NUM_DIMENSIONS);
    Matrix queries = LumpyData.lumpyRandomData(NUM_QUERIES, NUM_DIMENSIONS);

    DistanceMeasure distanceMeasure = new CosineDistanceMeasure();

    Searcher bruteSearcher = new BruteSearch(distanceMeasure);
    bruteSearcher.addAll(dataPoints);
    Pair<List<List<WeightedThing<Vector>>>, Long> reference = getResultsAndRuntime(bruteSearcher, queries);
View Full Code Here

      mark.incrementalCreateBenchmark();
      mark.cloneBenchmark();
      mark.dotBenchmark();
      mark.serializeBenchmark();
      mark.deserializeBenchmark();
      mark.distanceMeasureBenchmark(new CosineDistanceMeasure());
      mark.distanceMeasureBenchmark(new SquaredEuclideanDistanceMeasure());
      mark.distanceMeasureBenchmark(new EuclideanDistanceMeasure());
      mark.distanceMeasureBenchmark(new ManhattanDistanceMeasure());
      mark.distanceMeasureBenchmark(new TanimotoDistanceMeasure());
     
      mark.closestCentroidBenchmark(new CosineDistanceMeasure());
      mark.closestCentroidBenchmark(new SquaredEuclideanDistanceMeasure());
      mark.closestCentroidBenchmark(new EuclideanDistanceMeasure());
      mark.closestCentroidBenchmark(new ManhattanDistanceMeasure());
      mark.closestCentroidBenchmark(new TanimotoDistanceMeasure());
     
View Full Code Here

    clusterDumper.printClusters(termDictionary);
  }

  @Test
  public void testMeanShift() throws Exception {
    DistanceMeasure measure = new CosineDistanceMeasure();
    Path output = getTestTempDirPath("output");
    Configuration conf = new Configuration();
    new MeanShiftCanopyDriver().run(conf, getTestTempDirPath("testdata"), output, measure, 0.5, 0.01, 0.05, 10, false, true, true);
    // run ClusterDumper
    ClusterDumper clusterDumper = new ClusterDumper(finalClusterPath(conf, output, 10), new Path(output, "clusteredPoints"));
View Full Code Here

  public static List<Object[]> generateData() {
    RandomUtils.useTestSeed();
    Matrix dataPoints = LumpyData.lumpyRandomData(NUM_DATA_POINTS, NUM_DIMENSIONS);
    Matrix queries = LumpyData.lumpyRandomData(NUM_QUERIES, NUM_DIMENSIONS);

    DistanceMeasure distanceMeasure = new CosineDistanceMeasure();

    Searcher bruteSearcher = new BruteSearch(distanceMeasure);
    bruteSearcher.addAll(dataPoints);
    Pair<List<List<WeightedThing<Vector>>>, Long> reference = getResultsAndRuntime(bruteSearcher, queries);
View Full Code Here

TOP

Related Classes of org.apache.mahout.common.distance.CosineDistanceMeasure

Copyright © 2018 www.massapicom. 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.