The TREESPLIT Procedure
PROC TREESPLIT Statement
PROC TREESPLIT <options>;
The PROC TREESPLIT statement invokes the procedure. Table 21.1 summarizes the options in the PROC TREESPLIT statement.
Table 21.1: PROC TREESPLIT Statement Options
Option | Description |
|---|---|
Basic Options | |
Specifies how to bin interval inputs prior to training | |
Requests a table of the results of the cost-complexity pruning based on cross validation | |
Specifies a saved tree model to use to score a new table | |
Specifies the number of bins to use for continuous variables | |
Suppresses ODS output | |
Specifies the number of surrogate rules to create | |
Specifies the data table to which the decision tree model is to be saved | |
Specifies options for plots | |
Create tables that contain information about columns in the output | |
Creates a table that contains the pruning information | |
Creates a variable importance table by using random branch assignment | |
Specifies the random number seed to use for autotuning | |
Calculates the importance of the specified types of variable interactions | |
Splitting Options | |
Specifies how to handle missing values in a predictor variable | |
Requests that an alternative method of determining splits be used | |
Specifies the maximum number of child nodes per parent node | |
Specifies the maximum tree depth | |
Specifies the minimum number of observations per child node | |
Specifies the minimum number of observations to use with the USEINSEARCH policy for handling missing values | |
Specifies that a variable can be used to split only once per branch | |
You can specify the following options:
- ASSIGNMISSING=BRANCH |NONE |MACSMALL |POPULAR |SIMILAR |USEINSEARCH
specifies how to handle missing values of predictor variables during training and how to handle missing values and unknown levels of predictor variables after all surrogate rules have been applied during scoring. An unknown level of a categorical predictor variable is a level that does not exist in the training data but is encountered during scoring. During scoring, unknown levels are treated as missing values.
Both this option and the NSURROGATES= option affect how missing values are handled in model training and scoring. For more information about how these rules are applied, see the section Primary and Surrogate Splitting Rules.
You can specify one of the following values:
- BRANCH
during the training phase, assigns any observation that has a missing value for the predictor variable to a specially created child node (branch). If all observations have nonmissing values for a predictor variable, then no branch is created to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no special branch was created to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
- NONE
during the training phase, excludes any observation that has a missing value for any predictor variable. In the scoring phase, if an observation has a missing value or an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
- MACSMALL
during the training phase, treats a missing value in a categorical predictor variable as a separate, legitimate value. If all observations have nonmissing values for a categorical predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a categorical predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
In both the training and the scoring phases, missing values in continuous predictor variables are treated as the smallest possible value.
- POPULAR
during the training phase, assigns any observation that has a missing value in the predictor variable to the child node that has the most training observations. In the scoring phase, if an observation has a missing value or an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
- SIMILAR
during the training phase, assigns any observation that has a missing value in the predictor variable to the child node whose observations are most similar to it. This similarity is determined using the chi-square criterion for categorical responses or the F-test criterion for continuous responses. If all observations have nonmissing values for a predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
- USEINSEARCH
during the training phase, treats a missing value in a predictor variable as a separate, legitimate value. If all observations have nonmissing values for a predictor variable, then no branch is selected to contain observations with missing values. In the scoring phase, if an observation has a missing value for a predictor variable and no branch is selected to contain observations with missing values, or if an observation has an unknown level for a predictor variable, then the observation is assigned to the child node that contains the most training observations.
By default, ASSIGNMISSING=USEINSEARCH.
- BINMETHOD=BUCKET |QUANTILE
specifies how to bin interval input variables prior to growing the decision tree. The number of bins that are created is determined by the NUMBIN= option.
You can specify one of the following values:
- BUCKET
bins interval input variables into fixed-width bins. The width of each bin for a particular variable is calculated by subtracting the smallest value among all observations from the largest value among all observations, and then dividing that result by the number of bins.
- QUANTILE
bins interval input variables into bins according to their quantile. The width of the bins for a particular variable is not fixed, but the number of observations in each bin is approximately equal.
By default, BINMETHOD=BUCKET.
- CLUSTERSPLIT
determines the splits at each node using clustering on each input variable, and then chooses the splitting variable on the basis of which variable and split optimize the criterion that is specified in the GROW statement.
-
CVCC
CVCOSTCOMPLEXITY requests a table of the results of cost-complexity pruning based on cross validation. For each penalty parameter in the cross validation, the table provides the penalty parameter, the minimum, the maximum, and the average error. The error is the misclassification rate when the response variable is categorical and is the average square error (ASE) when the response variable is continuous. You can use the PLOTS=CVCC option to request a plot of the information in this table.
- DATA=CAS-libref.data-table
names the input data table for PROC TREESPLIT to use. CAS-libref.data-table is a two-level name, where
- CAS-libref
refers to a collection of information that is defined in the LIBNAME statement and includes the
caslib, which includes a path to the data, and a session identifier, which defaults to the active session but which can be explicitly defined in the LIBNAME statement. For more information about CAS-libref, see the section Using CAS Sessions and CAS Engine Librefs.- data-table
specifies the name of the input data table.
- INMODEL=<CAS-libref.>data-table
specifies the data table that you have previously saved as a tree model by using the OUTMODEL= option in a previous run of PROC TREESPLIT. CAS-libref.data-table is a two-level name, where CAS-libref refers to the
casliband session identifier, and data-table specifies the name of the input data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.When you use the INMODEL= option, the OUTPUT statement is required and any other options in the PROC TREESPLIT statement, except for NOPRINT and PLOTS, are ignored.
The data table used in the INMODEL= option must include the attributes that are associated with the table produced by the OUTMODEL= option, or the TREESPLIT procedure will error.
- MAXBRANCH=b
specifies the maximum number of child nodes per parent node in the tree. PROC TREESPLIT tries to create this number of children unless it is impossible (for example, if a split variable does not have enough levels).
By default, MAXBRANCH=2.
- MAXDEPTH=number
specifies the maximum depth of the tree to be grown. The number of levels in a tree is equal to the depth plus one. The default is calculated by the following equation, where b is the value of the MAXBRANCH= option in the PROC TREESPLIT statement:
This value can be tuned with the AUTOTUNE statement.
- MINLEAFSIZE=number
specifies the minimum number of observations in the training data that each child of a split must contain in order for the split to be considered.
By default, MINLEAFSIZE=5.
- MINUSEINSEARCH=number
specifies a threshold for using missing values in the split search when ASSIGNMISSING=USEINSEARCH as the missing value policy. If the number of observations that have missing values for the splitting variable is greater than or equal to number, then PROC TREESPLIT uses the USEINSEARCH policy for missing values.
By default, MINUSERINSEARCH=1.
- NOPRINT
- NUMBIN=number
specifies the number of bins to use for binning interval predictor variables. PROC TREESPLIT bins continuous predictors to a fixed bin size. This option controls the number of bins and thereby also the size of the bins.
By default, NUMBIN=20. This value can be tuned with the AUTOTUNE statement.
- NSURROGATES=number
specifies the number of surrogate rules to create for each splitting rule, where number is an integer greater than 0. Surrogate rules are backup splitting rules that are used when the variable that corresponds to the primary splitting rule is missing.
Both this option and the ASSIGNMISSING= affect training and scoring. For more information, see the section Primary and Surrogate Splitting Rules.
By default, NSURROGATES=0.
- OUTMODEL=CAS-libref.data-table
specifies the data table to which to save the decision tree model. CAS-libref.data-table is a two-level name, where CAS-libref refers to the
casliband session identifier, and data-table specifies the name of the output data table. For more information about this two-level name, see the DATA= option and the section Using CAS Sessions and CAS Engine Librefs.The data table that results from this option contains information about each node in the decision tree model, including the splitting variables, the child nodes, the number of observations at each node, and the predicted response at each node. This table also has attributes attached that contain information about the input variables, the target variable, and the decision tree model.
-
PLOTS <(global-plot-option)> <= plot-request <(options)>>
PLOTS <(global-plot-option)> <= (plot-request <(options)> <…plot-request <(options)>>)> controls the plots that are produced through ODS Graphics. When you specify only one plot-request, you can omit the parentheses around it.
You can specify the following global-plot-option:
- ONLY
suppresses the default plots. Only plots that you specifically request are displayed.
You can specify the following plot-requests:
- ALL
produces all appropriate plots.
- CVCC
produces a plot that is used to determine the tuning parameter for cost-complexity pruning when k-fold cross validation is used. This plot displays the average misclassification rate when the response variable is a classification variable and displays the average square error (ASE) when the response variable is a continuous variable.
- NONE
suppresses the default plots. Only plots that you specifically request are displayed.
- PRUNEUNTIL
plots the metric that is used to select the final subtree.
This option is enabled by default except when you specify the OFF option in the PRUNE statement (which turns off pruning completely). Specifying the PRUNEUNTIL option has no effect if you also specify the OFF option in the prune statement.
- WHOLETREE <(whole-tree-options)>
produces a plot to visualize the entire finished (grown and pruned) tree. This option is enabled by default.
You can specify the following values:
- LINKSTYLE=CURVED |ORTHOGONAL |STRAIGHT
specifies the style of links between nodes and leaves in the tree. You can specify the following link-styles:
- CURVED
requests curved links between the nodes and their children.
- ORTHOGONAL
requests that links go straight down partway from a node to its children, create a horizontal line at the base of the vertical line, and then go straight down from that line to each child.
- STRAIGHT
requests that links go straight from the nodes to their children.
By default, LINKSTYLE=CURVED.
- LINKWIDTH=CONSTANT |PROPORTIONAL
specifies the width of links between nodes and leaves in the tree. You can specify the following values:
- CONSTANT
requests that all links have the same thickness.
- PROPORTIONAL
requests that links have a thickness proportional to the total number of observations that go between the node and each child.
By default, LINKWIDTH=PROPORTIONAL.
- NOLEGEND
turns off the legend.
- ZOOMEDTREE <(zoomed-tree-options)>
produces a plot to visualize a portion of the finished (grown and pruned) tree. This option is enabled by default.
You can specify the following values:
- DEPTH=depth
creates a plot down to depth for each node-id specified in the NODES= option.
By default, DEPTH=2.
- LINKSTYLE=CURVED |ORTHOGONAL |STRAIGHT
specifies the style of links between nodes and leaves in the tree. You can specify the following values:
- CURVED
requests curved links between the nodes and their children.
- ORTHOGONAL
requests that links go straight down partway from a node to its children, create a horizontal line at the base of the vertical line, and then go straight down from that line to each child.
- STRAIGHT
requests that links go straight from the nodes to their children.
By default, LINKSTYLE=CURVED.
- LINKWIDTH=CONSTANT |PROPORTIONAL
specifies the width of links between nodes and leaves in the tree. You can specify the following values:
- CONSTANT
requests that all links have the same thickness.
- PROPORTIONAL
requests that links have a thickness proportional to the total number of observations that go between the node and each child.
By default, LINKWIDTH=PROPORTIONAL.
- NOLEGEND
suppresses the display of the legend
- PRINTTARGET
outputs tables that indicate generated columns in the OUT= table from the OUTPUT statement. For a continuous response, PROC TREESPLIT generates an output table named PredName, which indicates the name of the predicted value column. For a categorical response, PROC TREESPLIT generates an output table named PredIntoName, which indicates the name of the predicted value column, and also an output table named PredProbName, which indicates the names of the predicted probability columns.
- PRUNINGTABLE
- RBAIMP
creates a variable importance table by using random branch assignment (RBA). This table is created in addition to the normal variable importance table that is calculated using the residual sum of squares (RSS) error. For more information about RBA and RSS variable importance, see the section Variable Importance.
- SEED=number
specifies the initial seed for random number generation for cross validation. The value of number must be an integer. By default, the seed is generated by reading the time of day from the computer’s clock.
- SPLITONCE
splits predictor variables only once on a branch. When you specify this option, a variable cannot be split more than once on the path from the root to any particular terminal node. However, a variable can be used more than once across branches.
-
VII=2 |3
INTERACTIONIMP=2 |3 calculates the variable interaction importance, which is described in the section Variable Interaction Importance. You can specify the following values:
- 2
calculates the importance of all two-way variable interactions.
- 3
calculates the importance of all three-way and all two-way variable interactions.
If you do not specify this option, then the variable interaction importance is not calculated.