Package org.apache.mahout.clustering.dirichlet.models

Examples of org.apache.mahout.clustering.dirichlet.models.DistributionDescription


  @Test
  public void testDirichlet3() throws Exception {
    Path output = getTestTempDirPath("output");
    NamedVector prototype = (NamedVector) sampleData.get(0).get();
    DistributionDescription description =
        new DistributionDescription(DistanceMeasureClusterDistribution.class.getName(),
                                    RandomAccessSparseVector.class.getName(),
                                    ManhattanDistanceMeasure.class.getName(),
                                    prototype.getDelegate().size());
    Configuration conf = new Configuration();
    DirichletDriver.run(conf, getTestTempDirPath("testdata"), output, description, 15, 10, 1.0, true, true, 0, true);
View Full Code Here


    boolean runClustering = hasOption(DefaultOptionCreator.CLUSTERING_OPTION);
    boolean runSequential =
        getOption(DefaultOptionCreator.METHOD_OPTION).equalsIgnoreCase(DefaultOptionCreator.SEQUENTIAL_METHOD);
    int prototypeSize = readPrototypeSize(input);

    DistributionDescription description =
        new DistributionDescription(modelFactory, modelPrototype, distanceMeasure, prototypeSize);

    run(getConf(),
        input,
        output,
        description,
View Full Code Here

    String statePath = conf.get(DirichletDriver.STATE_IN_KEY);
    String descriptionString = conf.get(DirichletDriver.MODEL_DISTRIBUTION_KEY);
    String numClusters = conf.get(DirichletDriver.NUM_CLUSTERS_KEY);
    String alpha0 = conf.get(DirichletDriver.ALPHA_0_KEY);

    DistributionDescription description = DistributionDescription.fromString(descriptionString);
    return loadState(conf, statePath, description, Double.parseDouble(alpha0), Integer.parseInt(numClusters));
  }
View Full Code Here

  }
 
  @Test
  public void testDocs() throws Exception {
    getSampleData(DOCS);
    DistributionDescription description = new DistributionDescription(GaussianClusterDistribution.class.getName(),
        RandomAccessSparseVector.class.getName(), ManhattanDistanceMeasure.class.getName(), sampleData.get(0).size());
   
    List<Cluster> models = Lists.newArrayList();
    ModelDistribution<VectorWritable> modelDist = description.createModelDistribution(new Configuration());
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(15)) {
      models.add((Cluster) cluster);
    }
   
    ClusterIterator iterator = new ClusterIterator();
View Full Code Here

 
  @Test
  public void testDMDocs() throws Exception {
   
    getSampleData(DOCS);
    DistributionDescription description = new DistributionDescription(
        DistanceMeasureClusterDistribution.class.getName(), RandomAccessSparseVector.class.getName(),
        CosineDistanceMeasure.class.getName(), sampleData.get(0).size());
   
    List<Cluster> models = Lists.newArrayList();
    ModelDistribution<VectorWritable> modelDist = description.createModelDistribution(new Configuration());
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(15)) {
      models.add((Cluster) cluster);
    }
   
    ClusterIterator iterator = new ClusterIterator();
View Full Code Here

  }
 
  @Test
  public void testDocs2() throws Exception {
    getSampleData(DOCS2);
    DistributionDescription description = new DistributionDescription(GaussianClusterDistribution.class.getName(),
        RandomAccessSparseVector.class.getName(), ManhattanDistanceMeasure.class.getName(), sampleData.get(0).size());
   
    List<Cluster> models = Lists.newArrayList();
    ModelDistribution<VectorWritable> modelDist = description.createModelDistribution(new Configuration());
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(15)) {
      models.add((Cluster) cluster);
    }
   
    ClusterIterator iterator = new ClusterIterator();
View Full Code Here

 
  @Test
  public void testDMDocs2() throws Exception {
   
    getSampleData(DOCS);
    DistributionDescription description = new DistributionDescription(
        DistanceMeasureClusterDistribution.class.getName(), RandomAccessSparseVector.class.getName(),
        CosineDistanceMeasure.class.getName(), sampleData.get(0).size());
   
    List<Cluster> models = Lists.newArrayList();
    ModelDistribution<VectorWritable> modelDist = description.createModelDistribution(new Configuration());
    for (Model<VectorWritable> cluster : modelDist.sampleFromPrior(15)) {
      models.add((Cluster) cluster);
    }
   
    ClusterIterator iterator = new ClusterIterator();
View Full Code Here

 
  @Test
  public void testDirichlet2() throws Exception {
    Path output = getTestTempDirPath("output");
    NamedVector prototype = (NamedVector) sampleData.get(0).get();
    DistributionDescription description = new DistributionDescription(
        GaussianClusterDistribution.class.getName(),
        RandomAccessSparseVector.class.getName(), null, prototype.getDelegate()
            .size());
    Configuration conf = new Configuration();
    DirichletDriver.run(conf, getTestTempDirPath("testdata"), output,
View Full Code Here

 
  @Test
  public void testDirichlet3() throws Exception {
    Path output = getTestTempDirPath("output");
    NamedVector prototype = (NamedVector) sampleData.get(0).get();
    DistributionDescription description = new DistributionDescription(
        DistanceMeasureClusterDistribution.class.getName(),
        RandomAccessSparseVector.class.getName(),
        ManhattanDistanceMeasure.class.getName(), prototype.getDelegate()
            .size());
    Configuration conf = new Configuration();
View Full Code Here

  }
 
  @Test
  public void testDirichlet() throws Exception {
    ClusteringTestUtils.writePointsToFile(sampleData, new Path(testdata, "file1"), fs, conf);
    DistributionDescription description = new DistributionDescription(GaussianClusterDistribution.class.getName(),
        DenseVector.class.getName(), null, 2);
    DirichletDriver.run(new Configuration(), testdata, output, description, 15, 5, 1.0, true, true, (double) 0, true);
    int numIterations = 10;
    Configuration conf = new Configuration();
    Path clustersIn = new Path(output, "clusters-5-final");
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.dirichlet.models.DistributionDescription

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.