The HPFOREST Procedure

PROC HPFOREST Statement

  • PROC HPFOREST <options>;

The PROC HPFOREST statement invokes the procedure. You can specify one or more of the following optional arguments.

DATA=<libref.>SAS-data-set

names the SAS data set to be used by PROC HPFOREST for training the model. The default is the most recently created data set.

If the data are already distributed, the procedure reads the data alongside the distributed database. See the section Processing Modes for the various execution modes and the section Alongside-the-Database Execution for the alongside-the-database model. Data from all the computer grid nodes are combined into a structure that is optimized for model training and redistributed to the nodes. The different nodes then proceed independently with identical data to create decision trees.

ALPHA=number

specifies a threshold p-value for the significance level of a test of association of a candidate variable with the target. If no association meets this threshold, the node is not split. The default value is 1.

BALANCE=YES | NO

specifies whether to modify the splitting criterion for a nominal target so that the number of observations in each target class are effectively equal. A weight is applied to the count of observations in a class. The weight is different in different nodes. You can specify the following values:

YES

modifies the splitting criterion so that the number of observations in each target class are effectively equal. Setting BALANCE=YES can improve prediction when the class sizes are very different.

NO

does not modify the splitting criterion.

By default, BALANCE=NO.

CATBINS=k

specifies the maximum number of categories of a nominal candidate variable to use in the association test. k refers only to the categories that are present in the training data in the node and that satisfy the MINCATSIZE= option. The categories are counted independently in each node. If more than k categories are present, then the least frequent categories are removed from the association test. Many infrequent categories can dilute a strong predictive ability of common categories. The search for a splitting rule uses all categories that satisfy the MINCATSIZE= options. The value of k must be a positive integer. The default value is 30.

EXHAUSTIVE=number

specifies the maximum number of splits to examine in a complete enumeration of all possible splits when the input variable is nominal and the target has more than two nominal categories. The exhaustive method of searching for a split examines all possible splits. If the number of possible splits is greater than number, then a heuristic search is done instead of an exhaustive search. The default value of number is 5,000.

GRIDCLASSSIZE=n

specifies the minimum number of observations of any value of a binary or nominal target to exist on a grid node when GRIDCOPY=MINIMAL is specified. Observations are copied between grid nodes as necessary to meet this minimum. This option is ignored unless PROC HPFOREST is running in distributed mode. The default value is 10,000.

GRIDCOPY=ALL | MINIMAL | NONE | TRAINING

specifies how many observations to copy between grid nodes when PROC HPFOREST runs in distributed mode. PROC HPFOREST creates a decision tree on a single grid node without using data on other nodes unless observations are copied from other nodes before any tree is created. Generally, the more observations on a node, the larger the tree can grow and the more accurate the forest. The disadvantage is time, because the core processors have more work to do. You can specify the following values:

ALL

copies all training and validation data.

MINIMAL

copies enough training data to achieve a minimum on each node. This option uses the GRIDCLASSSIZE= and GRIDNODESIZE= option values to determine the minimum number of observations required on each grid node.

NONE

does not copy any observations.

TRAINING

copies all training data.

By default, GRIDCOPY=MINIMAL.

GRIDNODESIZE=n

specifies the minimum number of observations to use on a grid node when PROC HPFOREST runs in distributed mode and GRIDCOPY=MINIMAL is specified. If the number of observations on a node is less than n, then observations are copied from other nodes to achieve n. The default value is 100,000.

IMPORTANCE=YES | NO

specifies whether to compute variable importance. You can specify the following values:

YES

computes loss reduction variable importance.

NO

does not computes loss reduction variable importance. If you save the model (by specifying the SAVE statement) and subsequently input it to PROC HP4SCORE, then PROC HP4SCORE cannot compute variable importance either.

By default, IMPORTANCE=YES.

INBAGFRACTION=f

specifies the fraction of training observations to train a tree with, where f can be any number greater than 0 and at most 1. Using less than all the available data often improves the generalization error. A different in-bag sample is taken for each tree. The default value of f is 0.6. PROC HPFOREST uses at least four observations in the in-bag data regardless of how small f is (assuming four observations exist). If an observation is available for training but is not an in-bag datum, then it is either out-of-bag or a pruning datum. If f is too small to accommodate the LEAFSIZE=, LEAFFRACTION=, and SPLITSIZE options then no tree is made. The INBAGN= option accepts an absolute number instead of a fraction to specify the same quantity. Specifying both the INBAGN= and INBAGFRACTION= options is an error.

INBAGN=n

specifies how many observations to use to train each tree. The observations are counted without regard to the variable specified in the FREQ statement. Using less than all the available data often improves the generalization error. A different in-bag sample is taken for each tree. n can be any positive integer. If n is greater than the number of observations in the data set specified in the DATA= option, then all the available data are used. n must be at least 3 and large enough to accommodate the values of the LEAFSIZE=, LEAFFRACTION=, and SPLITSIZE options. The default value is 0.6 times the number of available observations in DATA= data set. The INBAGFRACTION= option accepts a fraction instead of an absolute number to specify the same quantity as the INBAGN= option. Specifying both the INBAGN= and INBAGFRACTION= is an error.

INTERVALBINS=k

specifies the number of equally spaced bins into which variables are divided when the PRESELECT=BINNEDSEARCH algorithm is executed. The default value is 100.

LEAFFRACTION=f

specifies the smallest number of training observations that a new branch can have, expressed as the fraction of the number N of available observations in the DATA= data set. N might be less than the total number of observations in the data set because observations with a missing target value or non positive value of the variable specified in the FREQ statement are excluded from N. If you specify a number in the LEAFSIZE= option that implies a larger number than that specified in the LEAFFRACTION= option, f is ignored. The value f must be larger than 0 and less than 1. The default value is 0.00001.

LEAFSIZE=n

specifies the smallest number of training observations a new branch can have. If you specify a value for the LEAFFRACTION= option that implies a larger value than n, the LEAFSIZE= option is ignored. The default value is 1.

MAXDEPTH=d

specifies the maximum depth of a node in any tree that PROC HPFOREST creates. The depth of a node equals the number of splitting rules needed to define the node. The root node has depth 0. The children of the root have depth 1, the children of those children have depth 2, and so on. The smallest acceptable value of d is 1. The default value of d is 20 (implying a maximum of 1,048,576 leaves).

MAXTREES=n

specifies the number of trees in the forest. n is a positive integer. The number of trees in the resulting forest can be less than n when the HPFOREST procedure fails to split the training data for a tree. Up to two times n trees are attempted. If the procedure fails to split the training data for more than n trees, then less than n trees are created. The ALPHA=, LEAFSIZE=, and MINCATSIZE= options constrain the split search to form trees that are more likely to predict well using new data. Setting all of these options to 1 generally frees the search algorithm to find a split and train a tree, although the tree might not help the forest predict well. The default value of n is 100.

MINCATSIZE=n

specifies the minimum number of observations that a given nominal input category must have in order to use the category in a split search. Categorical values that appear in fewer than n observations are handled as if they were missing. The categories that occur in fewer than n observations are merged into the pseudo category for missing values for the purpose of finding a split. The policy for assigning such observations to a branch is the same as the policy for assigning missing values to a branch. The default value of n is 5.

MINUSEINSEARCH=n

specifies a threshold for utilizing missing values in the split search when MISSING=USEINSEARCH is specified as the missing value policy. If the number of observations in which the splitting variable has missing values in a node is greater than or equal to n, then PROC HPFOREST initiates the USEINSEARCH policy for missing values. See the section Handling Missing Values for a more complete explanation. The default value of n is 1.

MISSING=USEINSEARCH | BIGBRANCH

specifies how the training procedure handles an observation with missing values. If MISSING=USEINSEARCH and the number of training observations in the node is more than n, where n is the value of the MINUSEINSEARCH= option, then the missing value is used as a separate, legitimate value in the test of association and the split search. If MISSING=BIGBRANCH, observations with a missing value of the candidate variable are omitted from the test of association and split search in that node. A splitting rule will assign such an observation to the branch containing the most observations among those used in the split search. See the section Handling Missing Values for a more complete explanation. By default, MISSING=USEINSEARCH.

NODESIZE=n | ALL

specifies the number of training observations to use for association tests and split searches. NODESIZE=ALL requests to use all the observations. The acceptable range is from two to two billion on most machines. The default value of n is 100,000.

The procedure counts the number of training observations in a node without adjusting the number with the values of the variable specified in the FREQ statement. If the count is larger than n, then the split search for that node is based on a random sample of size n. For categorical targets, the sample uses as many observations with less frequent target values as possible. The calculations for the association measures and split worth adjust the category counts to the category proportions in the node before sampling.

PRESELECT=BINNEDSEARCH | LOH | HOTHORN

specifies the method for selecting the variable to split with. You can specify the following values:

BINNEDSEARCH

selects the variable that produces the rule that has the largest worth. This option searches for a splitting rule for each candidate variable. Values of an interval variable are binned before the search. This option preferentially selects nominal variables that have many categories. But if such variables do not exist or if all the variables have a similar number of categories, then this option potentially selects better variables than the other methods. This option usually takes longer because searching for a splitting rule is more complex. For more information, see the section Binned Search.

HOTHORN

selects the variable that produces the rule that has the highest association with the target. For more information, see the section Hothorn, Hornik, and Zeileis.

LOH

selects the variable that has the smallest p-value of a chi-square test of association in a contingency table. For more information, see the section Loh and GUIDE.

If no nominal variables have more than five categories, then PRESELECT=BINNEDSEARCH by default. Otherwise, if some variables are not nominal or if any nominal variable has five categories more than another nominal variable, then PRESELECT=LOH by default.

PRUNEFRACTION=g

specifies the fraction of training observations that are available for pruning a split. The value of g can be any number from 0 and to 1, although a number close to 1 would leave little to grow the tree. The default value of g is 0; the default action is to not prune.

PRUNETHRESHOLD=t

specifies the lower limit of allowable shrinkage when the distance of the child node from the parent is measured by the pruning data instead of the in-bag data. For more information, see the section Pruning. The value of t must be between 0 and 1. The default value of t is 0.1.

SCOREPROLE=DEFAULT | INBAG | OOB | VALID

specifies which observations are used for the prediction of a new observation in the SCORE statement. Predictions are based on average values of observations that have the same role in leaves. All the observations included in an average have a single role: in-bag, out-of-bag, or validation. The SCOREPROLE= option does not affect the "Fit Statistics" output table. The HP4SCORE procedure outputs the same predictions as the HPFOREST procedure.

You can specify the following values:

DEFAULT

selects the default value as if the option was not specified.

INBAG

outputs predictions that are based on in-bag observations.

OOB

outputs predictions that are based on out-of-bag observations. If out-of-bag observations are not present, then the in-bag observations in the leaf are used.

VALID

outputs predictions that are based on validation observations. If validation observations are not present in a leaf node, the out-of-bag observations in that leaf are used. If out-of-bag observations are not present, then the in-bag observations in the leaf are used.

By default, SCOREPROLE=INBAG.

SEED=n

specifies the seed for generating random numbers. The HPFOREST procedure uses random numbers to select training observations for each tree and to select candidate variables in each node to split on. n is a nonnegative integer. Set n to 0 to use the internal default. The default value of the seed is 8,976,153.

SKIP_SEQ_ROWS=n

specifies the number of rows to skip in the "Fit Statistics" table in distributed mode. After every n trees that are trained on a grid node, the fit statistics on the node are updated, consolidated with statistics from other nodes, and eventually output in the "Fit Statistics" table. Each row in the table contains statistics for a specific number of trees in a forest. The table has gaps of up to n rows. The gap is smaller if fewer than n trees are made on a grid node, and no gap appears if only one tree is made on a node. The SKIP_SEQ_ROWS= option has no affect in single-machine mode. By default, SKIP_SEQ_ROWS=5.

SPLITSIZE=n

specifies the requisite number of training observations a node must have for the HPFOREST procedure to consider splitting it. By default, n is twice the value of the LEAFSIZE= option (or n is the value implied by LEAFFRACTION= option if the procedure ignores the LEAFSIZE= option). The procedure counts the number of observations in a node without adjusting the number with the values of the variable specified in the FREQ statement when it interprets the value specified in the LEAFFRACTION=, LEAFSIZE=, MINCATSIZE=, and SPLITSIZE= options.

VARS_TO_TRY=m | ALL

specifies the number of input variables to consider splitting on in a node. m ranges from 1 to the number of input variables, v. The default value of m is . Specify VARS_TO_TRY=ALL to use all the inputs as candidates in a node.