List of usage examples for org.apache.mahout.classifier.df.mapreduce Builder setOutputDirName
public void setOutputDirName(String name)
From source file:bigimp.BuildForest.java
License:Apache License
private void buildForest() throws IOException, ClassNotFoundException, InterruptedException { // make sure the output path does not exist FileSystem ofs = outputPath.getFileSystem(getConf()); if (ofs.exists(outputPath)) { log.error("Output path already exists"); return;/*w w w. j a va2s .c om*/ } DecisionTreeBuilder treeBuilder = new DecisionTreeBuilder(); if (m != null) { treeBuilder.setM(m); } treeBuilder.setComplemented(complemented); if (minSplitNum != null) { treeBuilder.setMinSplitNum(minSplitNum); } if (minVarianceProportion != null) { treeBuilder.setMinVarianceProportion(minVarianceProportion); } Builder forestBuilder; if (isPartial) { log.info("Partial Mapred implementation"); forestBuilder = new PartialBuilder(treeBuilder, dataPath, datasetPath, seed, getConf()); } else { log.info("InMem Mapred implementation"); forestBuilder = new InMemBuilder(treeBuilder, dataPath, datasetPath, seed, getConf()); } 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); }