Package org.apache.mahout.common.distance

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


    RandomUtils.useTestSeed();
    generateSamples();
    writeSampleData(samples);
    //boolean b = true;
    //if (b) {
    CanopyDriver.buildClusters(new Configuration(), samples, output, new ManhattanDistanceMeasure(), T1, T2, true);
    loadClusters(output);
    //} else {
    //  List<Vector> points = new ArrayList<Vector>();
    //  for (VectorWritable sample : SAMPLE_DATA) {
    //    points.add(sample.get());
View Full Code Here


    plotSampleData((Graphics2D) g);
    plotClusters((Graphics2D) g);
  }

  public static void main(String[] args) throws Exception {
    DistanceMeasure measure = new ManhattanDistanceMeasure();

    Path samples = new Path("samples");
    Path output = new Path("output");
    HadoopUtil.overwriteOutput(samples);
    HadoopUtil.overwriteOutput(output);
View Full Code Here

    initialize();
    this.setTitle("k-Means Clusters (>" + (int) (significance * 100) + "% of population)");
  }

  public static void main(String[] args) throws Exception {
    DistanceMeasure measure = new ManhattanDistanceMeasure();
    Path samples = new Path("samples");
    Path output = new Path("output");
    HadoopUtil.overwriteOutput(samples);
    HadoopUtil.overwriteOutput(output);

View Full Code Here

    job.setMapOutputValueClass(VectorWritable.class);
    Path input = getTestTempFilePath("random-input");
    Path output = getTestTempDirPath("random-output");
    ClusteringTestUtils.writePointsToFile(points, input, fs, conf);
   
    RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure());

    int clusterCount = 0;
    Collection<Integer> set = new HashSet<Integer>();
    for (Cluster value :
         new SequenceFileValueIterable<Cluster>(new Path(output, "part-randomSeed"), true, conf)) {
View Full Code Here

    for (Entry<String,Path> topLevelCluster : postProcessedClusterDirectories.entrySet()) {
      String clusterId = topLevelCluster.getKey();
      Path topLevelclusterPath = topLevelCluster.getValue();
     
      Path bottomLevelCluster = PathDirectory.getBottomLevelClusterPath(outputPath, clusterId);
      CanopyDriver.run(conf, topLevelclusterPath, bottomLevelCluster, new ManhattanDistanceMeasure(), 2.1,
        2.0, true, true);
      assertBottomLevelCluster(bottomLevelCluster);
    }
  }
View Full Code Here

  }
 
  private void topLevelClustering(Path pointsPath, Configuration conf) throws IOException,
                                                                      InterruptedException,
                                                                      ClassNotFoundException {
    CanopyDriver.run(conf, pointsPath, outputPath, new ManhattanDistanceMeasure(), 3.1, 2.1, true, true);
  }
View Full Code Here

  public DistanceMeasureClusterDistribution() {
  }

  public DistanceMeasureClusterDistribution(VectorWritable modelPrototype) {
    super(modelPrototype);
    this.measure = new ManhattanDistanceMeasure();
  }
View Full Code Here

  }
 
  private void topLevelClustering(Path pointsPath, Configuration conf) throws IOException,
                                                                      InterruptedException,
                                                                      ClassNotFoundException {
    DistanceMeasure measure = new ManhattanDistanceMeasure();
    CanopyDriver.run(conf, pointsPath, outputPathForCanopy, measure, 4.0, 3.0, true, true);
    Path clustersIn = new Path(outputPathForCanopy, new Path(Cluster.CLUSTERS_DIR + '0'
                                                                   + Cluster.FINAL_ITERATION_SUFFIX));
    KMeansDriver.run(conf, pointsPath, clustersIn, outputPathForKMeans, measure, 1, 1, true, true);
  }
View Full Code Here

public final class TestClusterClassifier extends MahoutTestCase {
 
  private static ClusterClassifier newDMClassifier() {
    List<Cluster> models = Lists.newArrayList();
    DistanceMeasure measure = new ManhattanDistanceMeasure();
    models.add(new DistanceMeasureCluster(new DenseVector(2).assign(1), 0,
        measure));
    models.add(new DistanceMeasureCluster(new DenseVector(2), 1, measure));
    models.add(new DistanceMeasureCluster(new DenseVector(2).assign(-1), 2,
        measure));
View Full Code Here

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

TOP

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

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.