Package org.apache.mahout.clustering.dirichlet

Examples of org.apache.mahout.clustering.dirichlet.JsonClusterModelAdapter


    Vector m = new DenseVector(d);
    NormalModel model = new NormalModel(5, m, 0.75);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String json = cluster.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Cluster.class, new JsonClusterModelAdapter());
    Gson gson = builder.create();
    DirichletCluster result = gson.fromJson(json, CLUSTER_TYPE);
    assertNotNull("result null", result);
    assertEquals("model", cluster.asFormatString(null), result.asFormatString(null));
  }
View Full Code Here


    AsymmetricSampledNormalModel model = new AsymmetricSampledNormalModel(5, m, m);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String json = cluster.asJsonString();

    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Cluster.class, new JsonClusterModelAdapter());
    Gson gson = builder.create();
    DirichletCluster result = gson.fromJson(json, CLUSTER_TYPE);
    assertNotNull("result null", result);
    assertEquals("model", cluster.asFormatString(null), result.asFormatString(null));
  }
View Full Code Here

    L1Model model = new L1Model(5, m);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String json = cluster.asJsonString();

    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Cluster.class, new JsonClusterModelAdapter());
    Gson gson = builder.create();
    DirichletCluster result = gson.fromJson(json, CLUSTER_TYPE);
    assertNotNull("result null", result);
    assertEquals("model", cluster.asFormatString(null), result.asFormatString(null));
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.dirichlet.JsonClusterModelAdapter

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.