0

我正在尝试使用决策树对我的数据进行分类,问题是树没有分支,它只有根节点。我不明白这个错误。

所有变量都设置为因子(0/1)

谁能找到错误..我的代码如下

    dt3<-rpart(v33 ~v37+v15+v16+v36+v39+v40+v42+v44+v48+v50+v51+v52+v56+v57+v58+v59+v60+v62+v63+v66+v68+v69,method="class", na.action = na.pass, data = nd)

结果如下

    Call:
    rpart(formula = v33 ~ v37 + v15 + v16 + v36 + v39 + v40 + v42 + 
    v44 + v48 + v50 + v51 + v52 + v56 + v57 + v58 + v59 + v60 + 
    v62 + v63 + v66 + v68 + v69, data = nd, na.action = na.pass, 
    method = "class", control = rpart.control(usesurrogate = 1, 
    minsplit = 1, cp = 0.001))
    n= 43586 

    CP nsplit rel error xerror xstd
    1  0      0         1      0    0

    Node number 1: 43586 observations
    predicted class=0  expected loss=0.1944431698  P(node) =1
    class counts: 35111  8475
    probabilities: 0.806 0.194 
4

0 回答 0