Library: | xclust |
See also: | cartsplitregr |
Quantlet: | cartsplitclass | |
Description: | builds the classification tree. |
Usage: | Tree = cartsplitclass(VarMatrix,ClassVector,SplitRule,MinSize) | |
Input: | ||
VarMatrix | n x m matrix, variables | |
ClassVector | n x 1 vector, classes | |
SplitRule | scalar, splitting rule either 0 (Ginni) or 1 (Twoing) | |
MinSize | scalar, stop condition, minimum number of observations in terminal node | |
Output: | ||
Tree | list, composed of following elements: Variable - number of variable of the split questions SplitValue - critical value of the question Class - dominating class of the current node (class with maximum number of observations) Impurity - missclassification error for each node (between 0 and 1) NumberOfPoints - total number of points (all classes) in current node ParentNode - records of parent node Index - used for transformation from XploRe to dll and back DrawIndex - used for drawing trees in XploRe |
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) tr = cartsplitclass(x,y,0,1) cartdisptree(tr)
Generates data structure tr representing a binary tree.