Examples of MapredOutput


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

      for (int treeId = 0; treeId < nbTrees; treeId++) {
        Node tree = new Leaf(rng.nextInt(100));

        keys[index] = new TreeID(partition, treeId);
        values[index] = new MapredOutput(tree, nextIntArray(rng, numInstances));

        index++;
      }
     
      firstIds[p] = firstId;
View Full Code Here

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

    Path[] outfiles = DFUtils.listOutputFiles(fs, outputPath);

    // import the InMemOutputs
    IntWritable key = new IntWritable();
    MapredOutput value = new MapredOutput();

    for (Path path : outfiles) {
      Reader reader = new Reader(fs, path, conf);

      try {
        while (reader.next(key, value)) {
          output.put(key.get(), value.clone());
        }
      } finally {
        reader.close();
      }
    }
View Full Code Here

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

  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

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

 
  @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

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

    Path[] outfiles = DFUtils.listOutputFiles(fs, outputPath);

    // read all the outputs
    TreeID key = new TreeID();
    MapredOutput value = new MapredOutput();
   
    int index = 0;
    for (Path path : outfiles) {
      Reader reader = new Reader(fs, path, conf);

      try {
        while (reader.next(key, value)) {
          if (keys != null) {
            keys[index] = key.clone();
          }
         
          if (trees != null) {
            trees[index] = value.getTree();
          }
         
          processOutput(firstIds, key, value, callback);
         
          index++;
View Full Code Here

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

    log.debug("Building...");
    Node tree = bagging.build(key.get(), rng, callback);

    if (!isNoOutput()) {
      log.debug("Outputing...");
      MapredOutput mrOut = new MapredOutput(tree, predictions);

      context.write(key, mrOut);
    }
  }
View Full Code Here

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

  @Override
  public void close() throws IOException {
    for (int index = 0; index < keys.length; index++) {
      TreeID key = new TreeID(partition, keys[index].treeId());
      output.collect(key, new MapredOutput(callbacks[index].getPredictions()));
    }
  }
View Full Code Here

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

    Path[] outfiles = DFUtils.listOutputFiles(fs, outputPath);

    // read all the outputs
    TreeID key = new TreeID();
    MapredOutput value = new MapredOutput();
   
    int index = 0;
    for (Path path : outfiles) {
      Reader reader = new Reader(fs, path, job);

      try {
        while (reader.next(key, value)) {
          if (keys != null) {
            keys[index] = key.clone();
          }
         
          if (trees != null) {
            trees[index] = value.getTree();
          }
         
          processOutput(firstIds, key, value, callback);
         
          index++;
View Full Code Here

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

    log.debug("Building...");
    Node tree = bagging.build(key.get(), rng, callback);

    if (!isNoOutput()) {
      log.debug("Outputing...");
      MapredOutput mrOut = new MapredOutput(tree, predictions);

      output.collect(key, mrOut);
    }
  }
View Full Code Here

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

      Node tree = bagging.build(treeId, rng, callback);

      key.set(partition, firstTreeId + treeId);

      if (!isNoOutput()) {
        MapredOutput emOut = new MapredOutput(tree, predictions);
        output.collect(key, emOut);
      }
    }
  }
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.