org.apache.mahout.math.Vector.asFormatString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.apache.mahout.math.Vector.asFormatString()方法的一些代码示例,展示了Vector.asFormatString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.asFormatString()方法的具体详情如下:
包路径:org.apache.mahout.math.Vector
类名称:Vector
方法名:asFormatString

Vector.asFormatString介绍

暂无

代码示例

代码示例来源:origin: apache/mahout

@Override
public String asFormatString() {
 return delegate.asFormatString();
}

代码示例来源:origin: intel-hadoop/HiBench

LOG.info("Centroid :" + (iCentroids.get(i).asFormatString()));

代码示例来源:origin: org.apache.mahout/mahout-math

@Override
public String asFormatString() {
 return delegate.asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-utils

@Override
public void write(Vector vector) throws IOException {
 writer.write(vector.asFormatString());
 writer.write('\n');
}

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
public String toString() {
 StringBuilder buf = new StringBuilder();
 for (int x = 0; x < numTopics; x++) {
  String v = dictionary != null
    ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary)
    : topicTermCounts.viewRow(x).asFormatString();
  buf.append(v).append('\n');
 }
 return buf.toString();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public String asFormatString() {
 return this.getIdentifier() + ": "
   + this.computeCentroid().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-core

/**
 * Format the cluster for output
 * 
 * @param cluster
 *          the Cluster
 * @return the String representation of the Cluster
 */
public static String formatCluster(Kluster cluster) {
 return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public String toString() {
 StringBuilder buf = new StringBuilder();
 for (int x = 0; x < numTopics; x++) {
  String v = dictionary != null
    ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary)
    : topicTermCounts.viewRow(x).asFormatString();
  buf.append(v).append('\n');
 }
 return buf.toString();
}

代码示例来源:origin: org.apache.mahout/mahout-mr

/**
 * Format the cluster for output
 * 
 * @param cluster
 *          the Cluster
 * @return the String representation of the Cluster
 */
public static String formatCluster(Kluster cluster) {
 return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public String toString() {
 return getIdentifier() + ": " + getCenter().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
public String toString() {
 return getIdentifier() + ": " + getCenter().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
public String asFormatString() {
 return this.getIdentifier() + ": "
   + this.computeCentroid().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
public String toString() {
 StringBuilder buf = new StringBuilder();
 for (int x = 0; x < numTopics; x++) {
  String v = dictionary != null
    ? vectorToSortedString(topicTermCounts.viewRow(x).normalize(1), dictionary)
    : topicTermCounts.viewRow(x).asFormatString();
  buf.append(v).append('\n');
 }
 return buf.toString();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

/**
 * Format the cluster for output
 * 
 * @param cluster
 *          the Cluster
 * @return the String representation of the Cluster
 */
public static String formatCluster(Kluster cluster) {
 return cluster.getIdentifier() + ": " + cluster.computeCentroid().asFormatString();
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private void assertFirstClusterWithoutOutlierRemoval() {
 Assert.assertEquals(3, firstCluster.size());
 for (Vector vector : firstCluster) {
  Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:1.0,1:1.0}",
    "{0:2.0,1:1.0}", "{0:1.0,1:2.0}"}, vector.asFormatString()));
 }
}

代码示例来源:origin: tdunning/MiA

public static void main(String[] args) {
    List<Vector> sampleData = new ArrayList<Vector>();

    RandomPointsUtil.generateSamples(sampleData, 400, 1, 1, 2);
    RandomPointsUtil.generateSamples(sampleData, 300, 1, 0, 0.5);
    RandomPointsUtil.generateSamples(sampleData, 300, 0, 2, 0.1);

    List<Canopy> canopies = CanopyClusterer.createCanopies(sampleData,
        new EuclideanDistanceMeasure(), 3.0, 1.5);

    for (Canopy canopy : canopies) {
      System.out.println("Canopy id: " + canopy.getId() + " center: "
          + canopy.getCenter().asFormatString());
    }
  }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private void assertThirdClusterWithoutOutlierRemoval() {
 Assert.assertEquals(2, thirdCluster.size());
 for (Vector vector : thirdCluster) {
  Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:9.0,1:9.0}",
    "{0:8.0,1:8.0}"}, vector.asFormatString()));
 }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private void assertSecondClusterWithoutOutlierRemoval() {
 Assert.assertEquals(4, secondCluster.size());
 for (Vector vector : secondCluster) {
  Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:4.0,1:4.0}",
    "{0:5.0,1:4.0}", "{0:4.0,1:5.0}", "{0:5.0,1:5.0}"},
    vector.asFormatString()));
 }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private void assertPointsInFirstTopLevelCluster(Path clusterPath) throws IOException {
 List<Vector> vectorsInCluster = getVectorsInCluster(clusterPath);
 for (Vector vector : vectorsInCluster) {
  Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:1.0,1:1.0}", "{0:2.0,1:1.0}", "{0:1.0,1:2.0}"},
   vector.asFormatString()));
 }
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

private void assertPointsInSecondTopLevelCluster(Path clusterPath) throws IOException {
 List<Vector> vectorsInCluster = getVectorsInCluster(clusterPath);
 for (Vector vector : vectorsInCluster) {
  Assert.assertTrue(ArrayUtils.contains(new String[] {"{0:4.0,1:4.0}", "{0:5.0,1:4.0}", "{0:4.0,1:5.0}",
                            "{0:5.0,1:5.0}"}, vector.asFormatString()));
 }
}

相关文章