Displays a classification tree (R.W. Payne).
Option
PRINT = string tokens |
Controls printed output (summary, details, indented, bracketed, labelleddiagram, numbereddiagram, graph); default * i.e. none |
|---|
Parameter
TREE = tree |
Tree to be displayed |
|---|
Description
BCDISPLAY displays a classification tree, as constructed by the BCLASSIFICATION procedure. The tree can be saved from BCLASSIFICATION (using the TREE option of BCLASSIFICATION), and is specified using the TREE parameter of BCDISPLAY. The type of output is specified by the PRINT option, with settings:
summary |
prints a summary of the properties of the tree; |
|---|---|
details |
gives detailed information about the nodes of the tree; |
bracketed |
display as used to represent an identification key in “bracketed” form (printed node by node). |
indented |
display as used to represent an identification key in “indented” form (printed branch by branch); |
labelleddiagram |
diagrammatic display including the node labels; |
numbereddiagram |
diagrammatic display with the nodes labelled by their numbers; |
graph |
plots the tree using high-resolution graphics. |
Option: PRINT.
Parameter: TREE.
Method
BCDISPLAY displays the tree using procedures BPRINT and BGRAPH.
See also
Procedures: BCLASSIFICATION, BCIDENTIFY, BCKEEP.
Commands for: Multivariate and cluster analysis.
Example
CAPTION 'BCDISPLAY example',!t(\
'Calculator digit recognition problem as in Breiman et al.',\
'(1984, p.44). The assumption is that the digits of a calculator',\
'are made up of 7 lines (as shown below), which may be missing for',\
'any particular digit with probability 0.1:'); STYLE=meta,plain
SCALAR Chan
ENQUIRE Chan; FILETYPE=output; OUTSTYLE=Style
OUTPUT [STYLE=plain]
PRINT !t(' -1- ','| |','2 3','| |',' -4- ',\
'| |','5 6','| |',' -7- '); FIELD=20
OUTPUT [STYLE=#Style]
VARIATE xdefn[1...7]
READ [PRINT=error] xdefn[1...7]
0 0 1 0 0 1 0
1 0 1 1 1 0 1
1 0 1 1 0 1 1
0 1 1 1 0 1 0
1 1 0 1 0 1 1
1 1 0 1 1 1 1
1 0 1 0 0 1 0
1 1 1 1 1 1 1
1 1 1 1 0 1 1
1 1 1 0 1 1 1 :
"generate a set of random observations"
SCALAR nsamples,seed; VALUE=50,876083
VARIATE [NVALUES=nsamples] light[1...7],truelight[1...7],error[1...7],rdigit
CALC rdigit = MOD( INTEGER( URAND(seed; nsamples) * 10); 10) + 1
& truelight[] = ELEMENTS(xdefn[]; rdigit)
GRANDOM [DISTRIBUTION=binomial; PROBABILITY=0.1; NVALUES=nsamples]error[1...7]
CALC light[] = MOD(truelight[] + error[]; 2)
FACTOR [LEVELS=!(0...9)] digit; VALUES=MOD(rdigit; 10); DECIMALS=0
FACTOR [LEVELS=!(0,1)] x1,x2,x3,x4,x5,x6,x7; VALUES=light[]; DECIMALS=0
"form the classification tree"
BCLASSIFICATION [PRINT=*; GROUPS=digit; TREE=tree]\
x1,x2,x3,x4,x5,x6,x7
"prune the tree"
BPRUNE [PRINT=table] tree; NEWTREE=pruned
"use the 5th tree - renumber nodes"
BCUT [RENUMBER=yes] pruned[5]; NEWTREE=tree
"display the tree"
BCDISPLAY [PRINT=summary,details,indented,bracketed,labelleddiagram,\
numbereddiagram] tree