Examples of WeightedPropertyVectorWritable


Examples of org.apache.mahout.clustering.WeightedPropertyVectorWritable

      writer.write("\tWeight : [props - optional]:  Point:\n\t");
      for (Iterator<WeightedVectorWritable> iterator = points.iterator(); iterator.hasNext(); ) {
        WeightedVectorWritable point = iterator.next();
        writer.write(String.valueOf(point.getWeight()));
        if (point instanceof WeightedPropertyVectorWritable) {
          WeightedPropertyVectorWritable tmp = (WeightedPropertyVectorWritable) point;
          Map<Text, Text> map = tmp.getProperties();
          writer.write(" : [");
          for (Map.Entry<Text, Text> entry : map.entrySet()) {
            writer.write(entry.getKey().toString());
            writer.write("=");
            writer.write(entry.getValue().toString());
View Full Code Here

Examples of org.apache.mahout.clustering.WeightedPropertyVectorWritable

        nearestDistance = distance;
      }
    }
    Map<Text, Text> props = new HashMap<Text, Text>();
    props.put(new Text("distance"), new Text(String.valueOf(nearestDistance)));
    context.write(new IntWritable(nearestCluster.getId()), new WeightedPropertyVectorWritable(1, vector, props));
  }
View Full Code Here

Examples of org.apache.mahout.clustering.classify.WeightedPropertyVectorWritable

      writer.write("\tWeight : [props - optional]:  Point:\n\t");
      for (Iterator<WeightedVectorWritable> iterator = points.iterator(); iterator.hasNext();) {
        WeightedVectorWritable point = iterator.next();
        writer.write(String.valueOf(point.getWeight()));
        if (point instanceof WeightedPropertyVectorWritable) {
          WeightedPropertyVectorWritable tmp = (WeightedPropertyVectorWritable) point;
          Map<Text,Text> map = tmp.getProperties();
          // map can be null since empty maps when written are returned as null
          writer.write(" : [");
          if (map != null) {
            for (Map.Entry<Text,Text> entry : map.entrySet()) {
              writer.write(entry.getKey().toString());
View Full Code Here

Examples of org.apache.mahout.clustering.classify.WeightedPropertyVectorWritable

    Map<Integer,List<WeightedPropertyVectorWritable>> clusterIdToPoints = getClusterIdToPoints();
    List<WeightedPropertyVectorWritable> points = clusterIdToPoints.get(clusterWritable.getValue().getId());
    if (points != null) {
      writer.write("\tWeight : [props - optional]:  Point:\n\t");
      for (Iterator<WeightedPropertyVectorWritable> iterator = points.iterator(); iterator.hasNext();) {
        WeightedPropertyVectorWritable point = iterator.next();
        writer.write(String.valueOf(point.getWeight()));
        Map<Text,Text> map = point.getProperties();
        // map can be null since empty maps when written are returned as null
        writer.write(" : [");
        if (map != null) {
          for (Map.Entry<Text,Text> entry : map.entrySet()) {
            writer.write(entry.getKey().toString());
            writer.write("=");
            writer.write(entry.getValue().toString());
          }
        }
        writer.write("]");
       
        writer.write(": ");
       
        writer.write(AbstractCluster.formatVector(point.getVector(), dictionary));
        if (iterator.hasNext()) {
          writer.write("\n\t");
        }
      }
      writer.write('\n');
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.