【发布时间】:2016-10-09 19:35:48
【问题描述】:
我了解选择 CP 值的常见做法是选择具有最小xerror 值的最低级别。但是,在我的以下情况下,使用 cp <- fit$cptable[which.min(fit$cptable[,"xerror"]),"CP"] 将给我 0.17647059,这将导致在使用此值修剪后不会拆分或只是 root。
> myFormula <- Kyphosis~Age+Number+Start
> set.seed(1)
> fit <- rpart(myFormula,data=data,method="class",control=rpart.control(minsplit=20,xval=10,cp=0.01))
> fit$cptable
CP nsplit rel error xerror xstd
1 0.17647059 0 1.0000000 1.000000 0.2155872
2 0.01960784 1 0.8235294 1.000000 0.2155872
3 0.01000000 4 0.7647059 1.058824 0.2200975
还有其他选择/好的做法来选择 CP 值吗?
【问题讨论】:
标签: r decision-tree rpart