Library: | xclust |
See also: | cartsplitclass cartsplitregr |
Quantlet: | cartleafnum | |
Description: | returns number of terminal (leaf) nodes in the tree. |
Usage: | LeafNum = cartleafnum(Tree) | |
Input: | ||
Tree | Complex tree structure, list of different parameters Tree can be generated using CartClassificationSplit or CartRegressionSplit commands | |
Output: | ||
LeafNumber | integer, number of terminal (leaf) nodes in the tree. |
library("xclust"); x = #(1,2,3,4,40,50,60,80,90, 100, 110, 300, 500)~#(10,0,40,60,100,1,-91,20,20,34, 1, 3, -5); y = #(1,1,1,1,2,1,1,2,3,2, 3, 3, 3) // create tree tr = cartsplitclass(x, y, 0, 1) // return number of leaf nodes in the constructed tree NumberOfNodes = cartleafnum(tr); NumberOfNodes
Contents of NumberOfNodes [1,] 6