1. Home
  2. BCONSTRUCT procedure

BCONSTRUCT procedure

Constructs a tree (R.W. Payne).

Option

PRINT = string token Whether to print monitoring information (monitoring); default * i.e. none

Parameters

TREE = trees Saves the trees that have been constructed
DATA = identifiers Data available for constructing the trees

Description

BCONSTRUCT is a utility procedure that is used by the tree procedures like BCLASSIFICATION, BKEY and BREGRESSION to construct trees. It calls a procedure BSELECT to determine the test to be performed at each node of the tree. Customized versions of this procedure are available for each type of tree, and are accessed automatically along with the top-level procedure for the type of tree concerned. BCONSTRUCT is thus completely general – and can be used for other types of tree simply by providing an appropriate version of BSELECT.

The DATA parameter of BCONSTRUCT supplies a pointer containing the information required to construct the tree. (This is then passed through to BSELECT, together with information about the node for which a test is to be selected.) The TREE parameter saves the tree that has been constructed, and the PRINT option can be set to monitoring to produce monitoring information during construction.

Option: PRINT.

Parameters: TREE, DATA.

Method

BCONSTRUCT calls a procedure BSELECT to decide which test to use at each node of the tree. This must be customized according to the type of tree that is required. BSELECT has no options. Its parameters are as follows.

    DATA = pointer Data for constructing the tree (as provided by the DATA parameter of BCONSTRUCT)
    TESTS = pointer Tests already made between the root and the current node
    BRANCHES = variate Branches taken at each previous node
    LABEL = text Returns a label to put onto the node
    NEWTEST = scalar or expression New test to be done at the node (expression), or identification made at the node (scalar) if no new test selected
    NBRANCH = scalar Returns the number of branches to insert below the node
    ADDITIONAL = pointer Other information to store at the node
    LADDITIONAL = text Labels for the other information

After BSELECT has selected a test, the tree is extended by the BGROW directive, function BTERMINAL is used to find the next terminal node, and functions BPATH and BBRANCHES are used to ascertain the nodes and branches between that node and the root.

Action with RESTRICT

The use of any restrictions will depend on the BSELECT procedure, called by BCONSTRUCT.

See also

Directives: BASSESS, TREE.

Procedures: BCLASSIFICATION, BKEY, BREGRESSION.

Commands for: Calculations and manipulation.

Example

CAPTION !t(\
'Use of tree utility procedure BCONSTRUCT is shown in procedures BKEY',\
'BCLASSIFICATION & BREGRESSION, whose source code can be accessed by e.g.'),\
'  LIBEXAMPLE ''BCLASSIFICATION''; SOURCE=SourceBclass'
Updated on March 8, 2019

Was this article helpful?