## org.apache.mahout.classifier.df.builder
Class DefaultTreeBuilder

    java.lang.Object
      org.apache.mahout.classifier.df.builder.DefaultTreeBuilder

All Implemented Interfaces:
  TreeBuilder

    public class DefaultTreeBuilder

extends Object
implements TreeBuilder

Builds a Decision Tree
Based on the algorithm described in the "Decision Trees" tutorials by Andrew W. Moore, available at:
http://www.cs.cmu.edu/~awm/tutorials
This class can be used when the criterion variable is the categorical attribute.

Constructor Summary
`DefaultTreeBuilder()`

Method Summary
`Node` `build(Random rng, Data data)` Builds a Decision tree using the training data
`protected static int[]` `randomAttributes(Random rng, boolean[] selected, int m)` Randomly selects m attributes to consider for split, excludes IGNORED and LABEL attributes
`void` `setM(int m)`

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

Constructor Detail

### DefaultTreeBuilder

    public DefaultTreeBuilder()

Method Detail

### setM

    public void setM(int m)

### build

    public Node build(Random rng,
                      Data data)

  Description copied from interface: `TreeBuilder`
  Builds a Decision tree using the training data

  Specified by:
    `build` in interface `TreeBuilder`
  Parameters:
    `rng` - random-numbers generator
    `data` - training data
  Returns:
    root Node

### randomAttributes

    protected static int[] randomAttributes(Random rng,
                                            boolean[] selected,
                                            int m)

  Randomly selects m attributes to consider for split, excludes IGNORED and LABEL attributes

  Parameters:
    `rng` - random-numbers generator
    `selected` - attributes' state (selected or not)
    `m` - number of attributes to choose
  Returns:
    list of selected attributes' indices, or null if all attributes have already been selected

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