Package org.apache.mahout.clustering.iterator

Examples of org.apache.mahout.clustering.iterator.DirichletClusteringPolicy


    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(15)) {
      models.add((Cluster) cluster);
    }
   
    ClusterIterator iterator = new ClusterIterator();
    ClusterClassifier classifier = new ClusterClassifier(models, new DirichletClusteringPolicy(15, 1.0));
    ClusterClassifier posterior = iterator.iterate(sampleData, classifier, 10);
   
    printClusters(posterior.getModels(), DOCS2);
  }
View Full Code Here


    List<Cluster> models = Lists.newArrayList();
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(numClusters)) {
      models.add((Cluster) cluster);
    }
   
    ClusterClassifier prior = new ClusterClassifier(models, new DirichletClusteringPolicy(numClusters, alpha0));
    prior.writeToSeqFiles(clustersIn);
   
    if (runSequential) {
      new ClusterIterator().iterateSeq(conf, input, clustersIn, output, maxIterations);
    } else {
View Full Code Here

   *          execute sequentially if true
   */
  public static void clusterData(Configuration conf, Path input, Path stateIn, Path output, double alpha0,
      int numModels, boolean emitMostLikely, double threshold, boolean runSequential) throws IOException,
      InterruptedException, ClassNotFoundException {
    ClusterClassifier.writePolicy(new DirichletClusteringPolicy(numModels, alpha0), stateIn);
    ClusterClassificationDriver.run(conf, input, output, new Path(output, CLUSTERED_POINTS_DIRECTORY), threshold,
        emitMostLikely, runSequential);
  }
View Full Code Here

      throws IOException {
    List<Cluster> models = Lists.newArrayList();
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(numClusters)) {
      models.add((Cluster) cluster);
    }
    ClusterClassifier prior = new ClusterClassifier(models, new DirichletClusteringPolicy(numClusters, alpha0));
    Path priorPath = new Path(output, Cluster.INITIAL_CLUSTERS_DIR);
    prior.writeToSeqFiles(priorPath);
    Configuration conf = new Configuration();
    new ClusterIterator().iterateSeq(conf, input, priorPath, output, numIterations);
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.iterator.DirichletClusteringPolicy

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.