Package org.apache.mahout.df.mapreduce

Examples of org.apache.mahout.df.mapreduce.MapredOutput


    // read all the outputs
    int index = 0;
    for (Path path : outfiles) {
      for (Pair<TreeID,MapredOutput> record : new SequenceFileIterable<TreeID, MapredOutput>(path, conf)) {
        TreeID key = record.getFirst();
        MapredOutput value = record.getSecond();
        if (keys != null) {
          keys[index] = key;
        }
        if (trees != null) {
          trees[index] = value.getTree();
        }
        processOutput(firstIds, key, value, callback);
        index++;
      }
    }
View Full Code Here


 
  @Override
  protected void cleanup(Context context) throws IOException, InterruptedException {
    for (int index = 0; index < keys.length; index++) {
      TreeID key = new TreeID(partition, keys[index].treeId());
      context.write(key, new MapredOutput(callbacks[index].getPredictions()));
    }
  }
View Full Code Here

   */
  private static DecisionForest processOutput(Map<Integer,MapredOutput> output, PredictionCallback callback) {
    List<Node> trees = new ArrayList<Node>();
   
    for (Map.Entry<Integer,MapredOutput> entry : output.entrySet()) {
      MapredOutput value = entry.getValue();
     
      trees.add(value.getTree());
     
      if (callback != null) {
        int[] predictions = value.getPredictions();
        for (int index = 0; index < predictions.length; index++) {
          callback.prediction(entry.getKey(), index, predictions[index]);
        }
      }
    }
View Full Code Here

  protected DecisionForest processOutput(TreeID[] keys, MapredOutput[] values, PredictionCallback callback) {
    List<Node> trees = new ArrayList<Node>();

    for (int index = 0; index < keys.length; index++) {
      TreeID key = keys[index];
      MapredOutput value = values[index];

      trees.add(value.getTree());

      int[] predictions = value.getPredictions();
      for (int id = 0; id < predictions.length; id++) {
        callback.prediction(key.treeId(), firstIds[key.partition()] + id,
            predictions[id]);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.df.mapreduce.MapredOutput

Copyright © 2018 www.massapicom. 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.