## org.apache.mahout.df
Class DecisionForest

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

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

    public class DecisionForest

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

Represents a forest of decision trees.

Constructor Summary
`protected` `DecisionForest()`
`` `DecisionForest(java.util.List<Node> trees)`

Method Summary
`void` `classify(Data data, PredictionCallback callback)` Classifies the data and calls callback for each classification
`int` `classify(java.util.Random rng, Instance instance)` predicts the label for the instance
`boolean` `equals(java.lang.Object obj)`
`java.util.List<Node>` `getTrees()`
`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()` Mean maximum depth per tree
`long` `meanNbNodes()` Mean number of nodes per tree
`long` `nbNodes()` Total number of nodes in all the trees
`static DecisionForest` `read(java.io.DataInput dataInput)`
`void` `readFields(java.io.DataInput dataInput)` Reads the trees from the input and adds them to the existing trees
`void` `write(java.io.DataOutput dataOutput)`

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

Constructor Detail

### DecisionForest

    protected DecisionForest()

### DecisionForest

    public DecisionForest(java.util.List<Node> trees)

Method Detail

### getTrees

    public java.util.List<Node> getTrees()

### classify

    public void classify(Data data,
                         PredictionCallback callback)

  Classifies the data and calls callback for each classification

### classify

    public int classify(java.util.Random rng,
                        Instance instance)

  predicts the label for the instance

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

### meanNbNodes

    public long meanNbNodes()

  Mean number of nodes per tree

### nbNodes

    public long nbNodes()

  Total number of nodes in all the trees

### meanMaxDepth

    public long meanMaxDepth()

  Mean maximum depth per tree

### equals

    public boolean equals(java.lang.Object obj)

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `java.lang.Object`

### write

    public void write(java.io.DataOutput dataOutput)
               throws java.io.IOException

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

### readFields

    public void readFields(java.io.DataInput dataInput)
                    throws java.io.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:
    `java.io.IOException`

### read

    public static DecisionForest read(java.io.DataInput dataInput)
                               throws java.io.IOException

  Throws:
    `java.io.IOException`

### load

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

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

  Throws:
    `java.io.IOException`

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.