Package org.apache.mahout.matrix

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


    }
    Vector result = new DenseVector(doubles.size());
    int index = 0;
    for (Double d : doubles)
      result.set(index++, d);
    output.collect(null, new Text(result.asFormatString()));
  }

}
View Full Code Here


      OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
    String foo = values.toString();
    int ix = foo.indexOf(']');
    Canopy canopy = Canopy.decodeCanopy(foo.substring(0, ix + 1));
    Vector point = AbstractVector.decodeVector(foo.substring(ix + 3));
    output.collect(new Text(canopy.getIdentifier()), new Text(point
        .asFormatString()));
  }

}
View Full Code Here

      OutputCollector<Text, Text> output, Reporter reporter) throws IOException {
    String foo = values.toString();
    int ix = foo.indexOf(']');
    Cluster canopy = Cluster.decodeCluster(foo.substring(0, ix + 1));
    Vector point = AbstractVector.decodeVector(foo.substring(ix + 3));
    output.collect(new Text(canopy.getIdentifier()), new Text(point
        .asFormatString()));
  }

}
View Full Code Here

          Vector vector = iterator.next();
          if (printKey){
            writer.write(iterator.key().toString());
            writer.write("\t");
          }
          writer.write(vector.asFormatString());
          writer.write(LINE_SEP);
          i++;
        }
        System.err.println("Dumped " + i + " Vectors");
        if (cmdLine.hasOption(outputOpt)) {
View Full Code Here

          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 = center.asFormatString();
            writer.append(String.valueOf(value.getId())).append(":").append("name:")
                    .append(center.getName()).append(":").append(fmtStr.substring(0, Math.min(sub, fmtStr.length()))).append(LINE_SEP);
           
            if (dictionary != null) {
              String topTerms = getTopFeatures(center, dictionary, 10);
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.