plot2d_dt {lazy.tree} | R Documentation |
Plot the Border Lines Calculated by the Decision Tree
plot2d_dt(y, X, obj, ngrid = 50, title = "border lines")
y |
The categorical criterion varialbe as factor |
X |
The bivariate numeric predictor matrix (data frame) |
obj |
The class DecTree or list of nodes. |
ngrid |
# of grid points to be used |
title |
The tile string |
http://lbm.ab.a.u-tokyo.ac.jp/~omori/kensyu/discriminant.htm
# eample 1 with sample data square
SQ2=matrix( square$class4, 4,, byrow=1 )
heatmap( SQ2, Rowv=NA, Colv=NA, reorderfun=NA, symm=1
, labRow=1:4, labCol=1:4 )
X=as.data.frame(cbind(square$c1,square$c2))
res1 <- DecTree( square$Class4, X, maxdepth=5, print=1 )
plot2d_dt( square$Class4, X, res1$node, ngrid=50, title="square" )
# example 2 with sample data rect
X=as.data.frame(cbind(rect$x1,rect$x2))
res2 <- DecTree( as.factor(rect$R), X, maxdepth=5, print=1, method=4 )
plot2d_dt( as.factor(rect$R), X, res2$node, title="square" )