Examples of asFormatString()


Examples of org.apache.mahout.clustering.canopy.Canopy.asFormatString()

  @Test
  public void testCanopyAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Cluster cluster = new Canopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    assertEquals("C-123{n=0 c=[1.100, 2.200, 3.300] r=[]}", formatString);
  }

  @Test
  public void testCanopyAsFormatStringSparse() {
View Full Code Here

Examples of org.apache.mahout.clustering.canopy.Canopy.asFormatString()

  public void testCanopyAsFormatStringSparse() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new Canopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    assertEquals("C-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }

  @Test
  public void testCanopyAsFormatStringWithBindings() {
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

  public void testDirichletNormalModelClusterAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    NormalModel model = new NormalModel(5, m, 0.75);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String format = cluster.asFormatString(null);
    assertEquals("format", "C-5: nm{n=0 m=[1.100, 2.200, 3.300] sd=0.75}", format);
  }

  @Test
  public void testDirichletNormalModelClusterAsJsonString() {
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

    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));
  }

  @Test
  public void testDirichletAsymmetricSampledNormalModelClusterAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

  public void testDirichletAsymmetricSampledNormalModelClusterAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    AsymmetricSampledNormalModel model = new AsymmetricSampledNormalModel(5, m, m);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String format = cluster.asFormatString(null);
    assertEquals("format", "C-5: asnm{n=0 m=[1.100, 2.200, 3.300] sd=[1.100, 2.200, 3.300]}", format);
  }

  @Test
  public void testDirichletAsymmetricSampledNormalModelClusterAsJsonString() {
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

    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));
  }

  @Test
  public void testDirichletL1ModelClusterAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

  public void testDirichletL1ModelClusterAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    L1Model model = new L1Model(5, m);
    Cluster cluster = new DirichletCluster(model, 35.0);
    String format = cluster.asFormatString(null);
    assertEquals("format", "C-5: l1m{n=0 c=[1.100, 2.200, 3.300]}", format);
  }

  @Test
  public void testDirichletL1ModelClusterAsJsonString() {
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.DirichletCluster.asFormatString()

    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));
  }

  @Test
  public void testCanopyAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.models.AsymmetricSampledNormalModel.asFormatString()

  public void testDirichletASNormalModel() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Printable model = new AsymmetricSampledNormalModel(m, m);
    String format = model.asFormatString(null);
    assertEquals("format", "asnm{n=0 m=[1.100, 2.200, 3.300] sd=[1.100, 2.200, 3.300]}", format);
    String json = model.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Model.class, new JsonModelAdapter());
    Gson gson = builder.create();
View Full Code Here

Examples of org.apache.mahout.clustering.dirichlet.models.AsymmetricSampledNormalModel.asFormatString()

    String json = model.asJsonString();
    GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Model.class, new JsonModelAdapter());
    Gson gson = builder.create();
    AsymmetricSampledNormalModel model2 = gson.fromJson(json, modelType);
    assertEquals("Json", format, model2.asFormatString(null));
  }

  public void testDirichletL1Model() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.