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

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


  @Test
  public void testDMDocs() throws Exception {
    getSampleData(DOCS);
    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(sampleData.get(0)),
                                                   1.0,
                                                   15,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(10);
View Full Code Here


  @Test
  public void testDMDocs2() throws Exception {
    getSampleData(DOCS2);
    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(sampleData.get(0)),
                                                   1.0,
                                                   15,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(10);
View Full Code Here

  @Test
  public void testDirichlet3() throws Exception {
    Path output = getTestTempDirPath("output");
    NamedVector prototype = (NamedVector) sampleData.get(0).get();
    AbstractVectorModelDistribution modelDistribution = new DistanceMeasureClusterDistribution(new VectorWritable(prototype));
    Configuration conf = new Configuration();
    DirichletDriver.run(conf, getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, true, true, 0, true);
    // run ClusterDumper
    ClusterDumper clusterDumper = new ClusterDumper(finalClusterPath(conf, output, 10), new Path(output, "clusteredPoints"));
    clusterDumper.printClusters(termDictionary);
View Full Code Here

    assertSame("prototype", dist.getModelPrototype().getClass(), dist1.getModelPrototype().getClass());
  }

  @Test
  public void testDMClusterDistribution() {
    DistanceMeasureClusterDistribution dist =
        new DistanceMeasureClusterDistribution(new VectorWritable(new DenseVector(2)));
    String json = dist.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(ModelDistribution.class, new JsonModelDistributionAdapter());
    builder.registerTypeAdapter(DistanceMeasure.class, new JsonDistanceMeasureAdapter());
    Gson gson = builder.create();
    DistanceMeasureClusterDistribution dist1 = (DistanceMeasureClusterDistribution) gson
        .fromJson(json, AbstractVectorModelDistribution.MODEL_DISTRIBUTION_TYPE);
    assertSame("prototype", dist.getModelPrototype().getClass(), dist1.getModelPrototype().getClass());
    assertSame("measure", dist.getMeasure().getClass(), dist1.getMeasure().getClass());
  }
View Full Code Here

    assertSame("measure", dist.getMeasure().getClass(), dist1.getMeasure().getClass());
  }

  @Test
  public void testDMClusterDistribution2() {
    DistanceMeasureClusterDistribution dist =
        new DistanceMeasureClusterDistribution(new VectorWritable(new DenseVector(2)), new EuclideanDistanceMeasure());
    String json = dist.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(ModelDistribution.class, new JsonModelDistributionAdapter());
    builder.registerTypeAdapter(DistanceMeasure.class, new JsonDistanceMeasureAdapter());
    Gson gson = builder.create();
    DistanceMeasureClusterDistribution dist1 = (DistanceMeasureClusterDistribution) gson
        .fromJson(json, AbstractVectorModelDistribution.MODEL_DISTRIBUTION_TYPE);
    assertSame("prototype", dist.getModelPrototype().getClass(), dist1.getModelPrototype().getClass());
    assertSame("measure", dist.getMeasure().getClass(), dist1.getMeasure().getClass());
  }
View Full Code Here

    generateSamples(40, 1, 1, 3);
    generateSamples(30, 1, 0, 0.1);
    generateSamples(30, 0, 1, 0.1);

    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(new VectorWritable(new DenseVector(2))),
                                                   1.0,
                                                   10,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(30);
View Full Code Here

    generateSamples(40, 1, 1, 3);
    generateSamples(30, 1, 0, 0.1);
    generateSamples(30, 0, 1, 0.1);

    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(new VectorWritable(new DenseVector(2))),
                                                   1.0,
                                                   10,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(30);
View Full Code Here

  @Test
  public void testDMDocs() throws Exception {
    getSampleData(DOCS);
    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(sampleData.get(0)),
                                                   1.0,
                                                   15,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(10);
View Full Code Here

  @Test
  public void testDMDocs2() throws Exception {
    getSampleData(DOCS2);
    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(sampleData.get(0)),
                                                   1.0,
                                                   15,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(10);
View Full Code Here

  @Test
  public void testDMDocs() throws Exception {
    getSampleData(DOCS);
    DirichletClusterer dc = new DirichletClusterer(sampleData,
                                                   new DistanceMeasureClusterDistribution(sampleData.get(0)),
                                                   1.0,
                                                   15,
                                                   1,
                                                   0);
    List<Cluster[]> result = dc.cluster(10);
View Full Code Here

TOP

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

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.