使用R语言使用C5.0构建决策树时出错

问题描述 投票:0回答:1

这里,我根据玻璃的化学含量来预测玻璃的类型。输入化学含量的数字类型(Ri,Na等),输出玻璃的类型(Typec),这是因子。使用C5建立模型后.0我遇到错误像

“错误:仅树模型”

这是我的代码:

train=datax[sample(nrow(datax),80,replace=F),]

test=datax[!(1:nrow(datax))%in%as.numeric(row.names(train)),]

model=C5.0(Typec~.,data=train,rules=T, ntree= 50)

plot(model) 

运行绘图指令后出现提示错误。

r decision-tree c5.0
1个回答
0
投票
model=C5.0(Typec~.,data=train,rules=T, ntree= 50)

删除“ rules = T”参数,然后就可以绘制图形了

© www.soinside.com 2019 - 2024. All rights reserved.