Examples of asFormatString()


Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

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

  public void testMSCanopyAsFormatStringSparseWithBindings() {
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Printable cluster = new MeanShiftCanopy(m, 123);
    String[] bindings = { "fee", null, "foo" };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "C123: [fee:1.100, foo:3.300]", formatString);
  }

}
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

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

  @Test
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

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

  @Test
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

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

  @Test
View Full Code Here

Examples of org.apache.mahout.clustering.meanshift.MeanShiftCanopy.asFormatString()

    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new MeanShiftCanopy(m, 123, measure);
    String[] bindings = { "fee", null, "foo" };
    String formatString = cluster.asFormatString(bindings);
    System.out.println(formatString);
    assertEquals("format", "MSC-123{n=0 c=[fee:1.100, foo:3.300] r=[]}", formatString);
  }

}
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.asFormatString()

      g2.setStroke(new BasicStroke(i == 0 ? 3 : 1));
      g2.setColor(colors[Math.min(DisplayDirichlet.colors.length - 1, i--)]);
      for (Cluster cluster : cls) {
        // if (true || cluster.getNumPoints() > sampleData.size() * 0.05) {
        dv.assign(cluster.getStd() * 3);
        System.out.println(cluster.getCenter().asFormatString() + ' ' + dv.asFormatString());
        DisplayDirichlet.plotEllipse(g2, cluster.getCenter(), dv);
        // }
      }
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.Vector.asFormatString()

      g2.setStroke(new BasicStroke(i == 0 ? 3 : 1));
      g2.setColor(colors[Math.min(DisplayDirichlet.colors.length - 1, i--)]);
      for (Cluster cluster : cls) {
        // if (true || cluster.getNumPoints() > sampleData.size() * 0.05) {
        dv.assign(cluster.getStd() * 3);
        System.out.println(cluster.getCenter().asFormatString() + ' ' + dv.asFormatString());
        DisplayDirichlet.plotEllipse(g2, cluster.getCenter(), dv);
        // }
      }
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.Vector.asFormatString()

          Vector vector = iterator.next();
          if (printKey) {
            writer.write(iterator.key().toString());
            writer.write("\t");
          }
          String fmtStr = useJSON ? vector.asFormatString() : VectorHelper.vectorToString(vector, dictionary);
          writer.write(fmtStr);
          writer.write('\n');
          i++;
        }
        writer.flush();
View Full Code Here

Examples of org.apache.mahout.math.Vector.asFormatString()

      SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
      Writable key = (Writable) reader.getKeyClass().newInstance();
      ClusterBase value = (ClusterBase) reader.getValueClass().newInstance();
      while (reader.next(key, value)) {
        Vector center = value.getCenter();
        String fmtStr = useJSON ? center.asFormatString() : VectorHelper.vectorToString(center, dictionary);
        writer.append("Id: ").append(String.valueOf(value.getId())).append(":");
        writer.append("name:").append(center.getName());
        if (subString > 0) {
          writer.append(":").append(fmtStr.substring(0, Math.min(subString, fmtStr.length())));
        }
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.