0

在 Weka 中,如何从命令行显示分类/决策树?

4

1 回答 1

0

我不确定您是否正在寻找非常详细的东西,但基本上决策树是在您使用weka.classifiers.trees时打印的。在我的响应中有一个带有随机树的插图,但这是您J48在 iris 数据集上使用该算法会得到的结果:

~/weka/data$ weka weka.classifiers.trees.J48 -t iris.arff  -i

J48 pruned tree
------------------

petalwidth <= 0.6: Iris-setosa (50.0)
petalwidth > 0.6
|   petalwidth <= 1.7
|   |   petallength <= 4.9: Iris-versicolor (48.0/1.0)
|   |   petallength > 4.9
|   |   |   petalwidth <= 1.5: Iris-virginica (3.0)
|   |   |   petalwidth > 1.5: Iris-versicolor (3.0/1.0)
|   petalwidth > 1.7: Iris-virginica (46.0/1.0)

Number of Leaves  :     5

Size of the tree :  9


Time taken to build model: 0.08 seconds
Time taken to test model on training data: 0.01 seconds
于 2012-01-19T15:02:01.640 回答