Tree-Growing Directives

For C&R Tree, CHAID, and QUEST models, tree directives specify conditions for growing the tree, one level at a time. Directives are applied each time the interactive tree builder is launched from the node.

  • Directives are most safely used as a way to regenerate a tree created during a previous interactive session. See the topic Updating Tree Directives for more information. You can also edit directives manually, but this should be done with care.
  • Directives are highly specific to the structure of the tree they describe. Thus, any change to the underlying data or modeling options may cause a previously valid set of directives to fail. For example, if the CHAID algorithm changes a two-way split to a three-way split based on updated data, any directives based on the previous two-way split would fail.

Note: If you choose to generate a model directly (without using the tree builder), any tree directives are ignored.

Editing Directives

  1. To view or edit saved directives, open the tree-building node and select the Objective panel of the Build Options tab.
  2. Select Launch interactive session to enable the controls, select Use tree directives, and click Directives.

Directive Syntax

Directives specify conditions for growing the tree, starting with the root node. For example to grow the tree one level:

Grow Node Index 0 Children 1 2

Since no predictor is specified, the algorithm chooses the best split.

Note that the first split must always be on the root node (Index 0) and the index values for both children must be specified (1 and 2 in this case). It is invalid to specify Grow Node Index 2 Children 3 4 unless you first grew the root that created Node 2.

To grow the tree:

Grow Tree

To grow and prune the tree (C&R Tree only):

Grow_And_Prune Tree

To specify a custom split for a continuous predictor:

Grow Node Index 0 Children 1 2 Spliton 
  ( "EDUCATE", Interval ( NegativeInfinity, 12.5)
     Interval ( 12.5, Infinity ))

To split on a nominal predictor with two values:

Grow Node Index 2 Children 3 4 Spliton 
  ( "GENDER", Group( "0.0" )Group( "1.0" ))

To split on a nominal predictor with multiple values:

Grow Node Index 6 Children 7 8 Spliton 
   ( "ORGS", Group( "2.0","4.0" )
             Group( "0.0","1.0","3.0","6.0" ))

To split on an ordinal predictor:

Grow Node Index 4 Children 5 6 Spliton 
  ( "CHILDS", Interval ( NegativeInfinity, 1.0)
              Interval ( 1.0, Infinity ))

Note: When specifying custom splits, field names and values (EDUCATE, GENDER, CHILDS, etc.) are case sensitive.

Directives for CHAID Trees

Directives for CHAID trees are particularly sensitive to changes in the data or model because--unlike C&R Tree and QUEST--they are not constrained to use binary splits. For example, the following syntax looks perfectly valid but would fail if the algorithm splits the root node into more than two children:

Grow Node Index 0 Children 1 2
Grow Node Index 1 Children 3 4

With CHAID, it is possible that Node 0 will have 3 or 4 children, which would cause the second line of syntax to fail.

Using Directives in Scripts

Directives can also be embedded in scripts using triple quotation marks.