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

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


    generateSamples(100, 0, 0, 1);
    generateSamples(100, 2, 0, 1);
    generateSamples(100, 0, 2, 1);
    generateSamples(100, 2, 2, 1);
    DirichletState<Vector> state = new DirichletState<Vector>(
        new SampledNormalDistribution(), 20, 1.0, 1, 0);

    List<Model<Vector>[]> models = new ArrayList<Model<Vector>[]>();

    for (int iteration = 0; iteration < 10; iteration++) {
      DirichletMapper mapper = new DirichletMapper();
View Full Code Here


    assertEquals("models", model.toString(), model2.toString());
  }

  @SuppressWarnings("unchecked")
  public void testSampledNormalDistributionSerialization() {
    SampledNormalDistribution dist = new SampledNormalDistribution();
    Model[] models = dist.sampleFromPrior(20);
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Vector.class, new JsonVectorAdapter());
    Gson gson = builder.create();
    String jsonString = gson.toJson(models);
    Model[] models2 = gson.fromJson(jsonString, SampledNormalModel[].class);
View Full Code Here

  public void testStateSerialization() {
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(DirichletState.class,
        new JsonDirichletStateAdapter());
    Gson gson = builder.create();
    DirichletState state = new DirichletState(new SampledNormalDistribution(),
        20, 1, 1, 0);
    String format = gson.toJson(state);
    System.out.println(format);
    DirichletState state2 = gson.fromJson(format, DirichletState.class);
    assertNotNull("State2 null", state2);
View Full Code Here

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

    DirichletClusterer<Vector> dc = new DirichletClusterer<Vector>(sampleData,
        new SampledNormalDistribution(), 1.0, 10, 1, 0);
    List<Model<Vector>[]> result = dc.cluster(30);
    printResults(result, 2);
    assertNotNull(result);
  }
View Full Code Here

    generateSamples(400, 1, 1, 3);
    generateSamples(300, 1, 0, 0.1);
    generateSamples(300, 0, 1, 0.1);

    DirichletClusterer<Vector> dc = new DirichletClusterer<Vector>(sampleData,
        new SampledNormalDistribution(), 1.0, 10, 1, 0);
    List<Model<Vector>[]> result = dc.cluster(30);
    printResults(result, 20);
    assertNotNull(result);
  }
View Full Code Here

    generateSamples(4000, 1, 1, 3);
    generateSamples(3000, 1, 0, 0.1);
    generateSamples(3000, 0, 1, 0.1);

    DirichletClusterer<Vector> dc = new DirichletClusterer<Vector>(sampleData,
        new SampledNormalDistribution(), 1.0, 10, 1, 0);
    List<Model<Vector>[]> result = dc.cluster(30);
    printResults(result, 200);
    assertNotNull(result);
  }
View Full Code Here

    generateSamples(100, 0, 0, 1);
    generateSamples(100, 2, 0, 1);
    generateSamples(100, 0, 2, 1);
    generateSamples(100, 2, 2, 1);
    DirichletState<Vector> state = new DirichletState<Vector>(
        new SampledNormalDistribution(), 20, 1, 1, 0);
    DirichletMapper mapper = new DirichletMapper();
    mapper.configure(state);

    DummyOutputCollector<Text, Vector> mapCollector = new DummyOutputCollector<Text, Vector>();
    for (Vector v : sampleData) {
View Full Code Here

    generateSamples(100, 0, 0, 1);
    generateSamples(100, 2, 0, 1);
    generateSamples(100, 0, 2, 1);
    generateSamples(100, 2, 2, 1);
    DirichletState<Vector> state = new DirichletState<Vector>(
        new SampledNormalDistribution(), 20, 1.0, 1, 0);

    List<Model<Vector>[]> models = new ArrayList<Model<Vector>[]>();

    for (int iteration = 0; iteration < 10; iteration++) {
      DirichletMapper mapper = new DirichletMapper();
View Full Code Here

    assertEquals("models", model.toString(), model2.toString());
  }

  @SuppressWarnings("unchecked")
  public void testSampledNormalDistributionSerialization() {
    SampledNormalDistribution dist = new SampledNormalDistribution();
    Model[] models = dist.sampleFromPrior(20);
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Vector.class, new JsonVectorAdapter());
    Gson gson = builder.create();
    String jsonString = gson.toJson(models);
    Model[] models2 = gson.fromJson(jsonString, SampledNormalModel[].class);
View Full Code Here

  public void testStateSerialization() {
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(DirichletState.class,
        new JsonDirichletStateAdapter());
    Gson gson = builder.create();
    DirichletState state = new DirichletState(new SampledNormalDistribution(),
        20, 1, 1, 0);
    String format = gson.toJson(state);
    System.out.println(format);
    DirichletState state2 = gson.fromJson(format, DirichletState.class);
    assertNotNull("State2 null", state2);
View Full Code Here

TOP

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

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.