【发布时间】:2017-11-18 03:04:53
【问题描述】:
如果我通过以下方式构建 J48 树:
library(RWeka)
fit <- J48(Species~., data=iris)
我得到以下结果:
> fit
J48 pruned tree
------------------
Petal.Width <= 0.6: setosa (50.0)
Petal.Width > 0.6
| Petal.Width <= 1.7
| | Petal.Length <= 4.9: versicolor (48.0/1.0)
| | Petal.Length > 4.9
| | | Petal.Width <= 1.5: virginica (3.0)
| | | Petal.Width > 1.5: versicolor (3.0/1.0)
| Petal.Width > 1.7: virginica (46.0/1.0)
Number of Leaves : 5
Size of the tree : 9
我想将Number of Leaves 放入变量N(因此N 将获得5)并将Size of the tree 转换为S(因此S 将获得9)。
有没有办法直接从 J48 树中获取这些信息?
【问题讨论】:
-
这也可能适用于数据科学 SO 或交叉验证,因为可能有比“机械”更好的选择