Package org.apache.mahout.classifier.df

Examples of org.apache.mahout.classifier.df.DecisionForest


    forestBuilder.setOutputDirName(outputPath.getName());
   
    log.info("Building the forest...");
    long time = System.currentTimeMillis();
   
    DecisionForest forest = forestBuilder.build(nbTrees);
   
    time = System.currentTimeMillis() - time;
    log.info("Build Time: {}", DFUtils.elapsedTime(time));
    log.info("Forest num Nodes: {}", forest.nbNodes());
    log.info("Forest mean num Nodes: {}", forest.meanNbNodes());
    log.info("Forest mean max Depth: {}", forest.meanMaxDepth());

    // store the decision forest in the output path
    Path forestPath = new Path(outputPath, "forest.seq");
    log.info("Storing the forest in: {}", forestPath);
    DFUtils.storeWritable(getConf(), forestPath, forest);
View Full Code Here


    for (int index = 0; index < keys.length; index++) {
      MapredOutput value = values[index];
      trees.add(value.getTree());
    }
   
    return new DecisionForest(trees);
  }
View Full Code Here

    for (Map.Entry<Integer,MapredOutput> entry : output.entrySet()) {
      MapredOutput value = entry.getValue();
      trees.add(value.getTree());
    }
   
    return new DecisionForest(trees);
  }
View Full Code Here

   * @param attrNames
   *          attribute names
   */
  public static String toString(String forestPath, String datasetPath, String[] attrNames) throws IOException {
    Configuration conf = new Configuration();
    DecisionForest forest = DecisionForest.load(conf, new Path(forestPath));
    Dataset dataset = Dataset.load(conf, new Path(datasetPath));
    return toString(forest, dataset, attrNames);
  }
View Full Code Here

    TreeID[] keys = new TreeID[numTrees];
    Node[] trees = new Node[numTrees];
       
    processOutput(job, outputPath, keys, trees);
   
    return new DecisionForest(Arrays.asList(trees));
  }
View Full Code Here

    for (int treeId = 0; treeId < nbTrees; treeId++) {
      trees.add(bagging.build(rng));
      logProgress(((float) treeId + 1) / nbTrees);
    }
   
    return new DecisionForest(trees);
  }
View Full Code Here

      return null;
    }
   
    if (isOutput(conf)) {
      log.debug("Parsing the output...");
      DecisionForest forest = parseOutput(job);
      HadoopUtil.delete(conf, outputPath);
      return forest;
    }
   
    return null;
View Full Code Here

  }

  private void sequential() throws IOException {

    log.info("Loading the forest...");
    DecisionForest forest = DecisionForest.load(getConf(), modelPath);

    if (forest == null) {
      log.error("No Decision Forest found!");
      return;
    }
View Full Code Here

            new Leaf(0)}));
    List<Node> trees = Lists.newArrayList();
    trees.add(root);
   
    // Forest
    DecisionForest forest = new DecisionForest(trees);
    assertEquals("Tree[1]:\n2 < 90 : yes\n2 >= 90\n"
            + "|   0 = rainy\n|   |   1 < 71 : yes\n|   |   1 >= 71 : no\n"
            + "|   0 = sunny : no\n" + "|   0 = overcast : yes\n", ForestVisualizer.toString(forest, data.getDataset(), null));

    assertEquals("Tree[1]:\nhumidity < 90 : yes\nhumidity >= 90\n"
View Full Code Here

    forestBuilder.setOutputDirName(outputPath.getName());
   
    log.info("Building the forest...");
    long time = System.currentTimeMillis();
   
    DecisionForest forest = forestBuilder.build(nbTrees);
   
    time = System.currentTimeMillis() - time;
    log.info("Build Time: {}", DFUtils.elapsedTime(time));
    log.info("Forest num Nodes: {}", forest.nbNodes());
    log.info("Forest mean num Nodes: {}", forest.meanNbNodes());
    log.info("Forest mean max Depth: {}", forest.meanMaxDepth());

    // store the decision forest in the output path
    Path forestPath = new Path(outputPath, "forest.seq");
    log.info("Storing the forest in: {}", forestPath);
    DFUtils.storeWritable(getConf(), forestPath, forest);
View Full Code Here

TOP

Related Classes of org.apache.mahout.classifier.df.DecisionForest

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.