## org.apache.mahout.classifier.df
Class DecisionForest

    java.lang.Object
      org.apache.mahout.classifier.df.DecisionForest

All Implemented Interfaces:
  org.apache.hadoop.io.Writable

    public class DecisionForest

extends Object
implements org.apache.hadoop.io.Writable

Represents a forest of decision trees.

Constructor Summary
`DecisionForest(List<Node> trees)`

Method Summary
`void` `classify(Data data, double[][] predictions)` Classifies the data and calls callback for each classification
`double` `classify(Dataset dataset, Random rng, Instance instance)` predicts the label for the instance
`boolean` `equals(Object obj)`
`int` `hashCode()`
`static DecisionForest` `load(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path forestPath)` Load the forest from a single file or a directory of files
`long` `meanMaxDepth()`
`long` `meanNbNodes()`
`long` `nbNodes()`
`void` `readFields(DataInput dataInput)` Reads the trees from the input and adds them to the existing trees
`void` `write(DataOutput dataOutput)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DecisionForest

    public DecisionForest(List<Node> trees)

Method Detail

### classify

    public void classify(Data data,
                         double[][] predictions)

  Classifies the data and calls callback for each classification

### classify

    public double classify(Dataset dataset,
                           Random rng,
                           Instance instance)

  predicts the label for the instance

  Parameters:
    `rng` - Random number generator, used to break ties randomly
  Returns:
    NaN if the label cannot be predicted

### meanNbNodes

    public long meanNbNodes()

  Returns:
    Mean number of nodes per tree

### nbNodes

    public long nbNodes()

  Returns:
    Total number of nodes in all the trees

### meanMaxDepth

    public long meanMaxDepth()

  Returns:
    Mean maximum depth per tree

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### write

    public void write(DataOutput dataOutput)
               throws IOException

  Specified by:
    `write` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput dataInput)
                    throws IOException

  Reads the trees from the input and adds them to the existing trees

  Specified by:
    `readFields` in interface `org.apache.hadoop.io.Writable`
  Throws:
    `IOException`

### load

    public static DecisionForest load(org.apache.hadoop.conf.Configuration conf,
                                      org.apache.hadoop.fs.Path forestPath)
                               throws IOException

  Load the forest from a single file or a directory of files

  Throws:
    `IOException`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.