Examples of asFormatString()


Examples of org.apache.mahout.clustering.AbstractCluster.asFormatString()

      int maxIter = 10;
      List<List<Cluster>> clustersList = KMeansClusterer.clusterPoints(points, clusters, measure, maxIter, 0.001);
      clusters = clustersList.get(clustersList.size() - 1);
      for (int c = 0; c < clusters.size(); c++) {
        AbstractCluster cluster = clusters.get(c);
        System.out.println(cluster.asFormatString(null));
        assertEquals("Cluster " + c + " test " + (k + 1), EXPECTED_NUM_POINTS[k][c], cluster.getNumPoints());
      }
    }
  }
View Full Code Here

Examples of org.apache.mahout.clustering.Cluster.asFormatString()

    for (Cluster[] r : result) {
      models.append("sample[").append(row++).append("]= ");
      for (int k = 0; k < r.length; k++) {
        Cluster model = r[k];
        if (model.count() > significant) {
          models.append('m').append(k).append(model.asFormatString(null)).append(", ");
        }
      }
      models.append('\n');
    }
    models.append('\n');
View Full Code Here

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

  public void testCanopyAsFormatString() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Printable cluster = new Canopy(m, 123);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C123: [1.100, 2.200, 3.300]", formatString);
  }

  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);
    Printable cluster = new Canopy(m, 123);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C123: [0:1.100, 2:3.300]", formatString);
  }

  public void testCanopyAsFormatStringWithBindings() {
View Full Code Here

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

  public void testCanopyAsFormatStringWithBindings() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Printable cluster = new Canopy(m, 123);
    String[] bindings = { "fee", null, null };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "C123: [fee:1.100, 1:2.200, 2:3.300]", formatString);
  }

  public void testCanopyAsFormatStringSparseWithBindings() {
View Full Code Here

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

  public void testCanopyAsFormatStringSparseWithBindings() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Printable cluster = new Canopy(m, 123);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C123: [0:1.100, 2:3.300]", formatString);
  }

  public void testClusterAsFormatString() {
View Full Code Here

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);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[1.100, 2.200, 3.300] r=[]}", formatString);
  }

  @Test
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);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }

  @Test
View Full Code Here

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

  public void testCanopyAsFormatStringWithBindings() {
    double[] d = { 1.1, 2.2, 3.3 };
    Vector m = new DenseVector(d);
    Cluster cluster = new Canopy(m, 123, measure);
    String[] bindings = { "fee", null, null };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[fee:1.100, 1:2.200, 2:3.300] r=[]}", formatString);
  }

  @Test
View Full Code Here

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

  public void testCanopyAsFormatStringSparseWithBindings() {
    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);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }

  @Test
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.