Package org.apache.mahout.df.node

Examples of org.apache.mahout.df.node.Node


      if (isOobEstimate() && !isNoOutput()) {
        callback = new SingleTreePredictions(data.size());
        predictions = callback.getPredictions();
      }
     
      Node tree = bagging.build(treeId, rng, callback);
     
      key.set(partition, firstTreeId + treeId);
     
      if (!isNoOutput()) {
        MapredOutput emOut = new MapredOutput(tree, predictions);
View Full Code Here


    log.debug("Bagging...");
    Arrays.fill(sampled, false);
    Data bag = data.bagging(rng, sampled);
   
    log.debug("Building...");
    Node tree = treeBuilder.build(rng, bag);
   
    // predict the label for the out-of-bag elements
    if (callback != null) {
      log.debug("Oob error estimation");
      for (int index = 0; index < data.size(); index++) {
        if (sampled[index] == false) {
          int prediction = tree.classify(data.get(index));
          callback.prediction(treeId, index, prediction);
        }
      }
    }
   
View Full Code Here

    if (data.isEmpty()) {
      return; // nothing to classify
    }
   
    for (int treeId = 0; treeId < trees.size(); treeId++) {
      Node tree = trees.get(treeId);
     
      for (int index = 0; index < data.size(); index++) {
        int prediction = tree.classify(data.get(index));
        callback.prediction(treeId, index, prediction);
      }
    }
  }
View Full Code Here

    if (alreadySelected) {
      // attribute already selected
      log.warn("attribute {} already selected in a parent node", best.attr);
    }
   
    Node childNode;
    if (data.getDataset().isNumerical(best.attr)) {
      Data loSubset = data.subset(Condition.lesser(best.attr, best.split));
      Node loChild = build(rng, loSubset);
     
      Data hiSubset = data.subset(Condition.greaterOrEquals(best.attr, best.split));
      Node hiChild = build(rng, hiSubset);
     
      childNode = new NumericalNode(best.attr, best.split, loChild, hiChild);
    } else { // CATEGORICAL attribute
      selected[best.attr] = true;
     
View Full Code Here

    }
   
    initRandom((InMemInputSplit) context.getInputSplit());
   
    log.debug("Building...");
    Node tree = bagging.build(key.get(), rng, callback);
   
    if (!isNoOutput()) {
      log.debug("Outputing...");
      MapredOutput mrOut = new MapredOutput(tree, predictions);
     
View Full Code Here

    }
   
    initRandom(split);
   
    log.debug("Building...");
    Node tree = bagging.build(key.get(), rng, callback);
   
    if (!isNoOutput()) {
      log.debug("Outputing...");
      MapredOutput mrOut = new MapredOutput(tree, predictions);
     
View Full Code Here

      if (isOobEstimate() && !isNoOutput()) {
        callback = new SingleTreePredictions(data.size());
        predictions = callback.getPredictions();
      }
     
      Node tree = bagging.build(treeId, rng, callback);
     
      key.set(partition, firstTreeId + treeId);
     
      if (!isNoOutput()) {
        MapredOutput emOut = new MapredOutput(tree, predictions);
View Full Code Here

      partitions.add(partition);

      int nbTrees = Step1Mapper.nbTrees(numMaps, numTrees, partition);

      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++;
View Full Code Here

    }
   
    initRandom((InMemInputSplit) context.getInputSplit());
   
    log.debug("Building...");
    Node tree = bagging.build(key.get(), rng, callback);
   
    if (!isNoOutput()) {
      log.debug("Outputing...");
      MapredOutput mrOut = new MapredOutput(tree, predictions);
     
View Full Code Here

    log.debug("Bagging...");
    Arrays.fill(sampled, false);
    Data bag = data.bagging(rng, sampled);
   
    log.debug("Building...");
    Node tree = treeBuilder.build(rng, bag);
   
    // predict the label for the out-of-bag elements
    if (callback != null) {
      log.debug("Oob error estimation");
      for (int index = 0; index < data.size(); index++) {
        if (!sampled[index]) {
          int prediction = tree.classify(data.get(index));
          callback.prediction(treeId, index, prediction);
        }
      }
    }
   
View Full Code Here

TOP

Related Classes of org.apache.mahout.df.node.Node

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.