关于从命令行显示分类/决策树的方法?

时间:2012-01-18 02:55:40

标签: weka decision-tree

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

1 个答案:

答案 0 :(得分:0)

我不确定您是否正在寻找非常详细的内容,但是当您使用weka.classifiers.trees时,基本上会打印出决策树。在response of mine中有一个使用随机树的插图,但这是您在虹膜数据集上使用J48算法得到的结果:

~/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