1

I have an output tree in weka but can't view it (right click ...). Is there a tool to generate the resulting tree in an understandable way from the copy of the log (figures)?

tree results log

2 Answers2

1

The above textual representation cannot be converted into other formats, unless you write your own parser.

However, if you use the -g option on the command-line, the tree will get output on stdout in dot-notation. You can then take this output and convert it into other formats, like PNG or PDF using the GraphViz software.

fracpete
  • 2,448
  • 2
  • 12
  • 17
  • Thank you for your answer! The command "-g" on which prompt do you mean? I am using the weka explorer tool, to make a prediction using multiple instance learning specifically the TLC algorithm. – Andrea D'Aguanno May 13 '21 at 22:02
  • You can use the SimpleCLI if you're not.comfortablr with using the terminal/command prompt. – fracpete May 14 '21 at 10:25
0

You can run Weka from the command line if you have java installed. On my Windows machine from the Weka-3-9-5 directory:

C:\Weka-3-9-5> java -cp weka.jar weka.classifiers.trees.J48 -C 0.25 -M 2 -t .\data\iris.arff

This gives you the output that you current have with the trees. However:

C:\Weka-3-9-5> java -cp weka.jar weka.classifiers.trees.J48 -C 0.25 -M 2 -t .\data\iris.arff -g

gives you a different format:

digraph J48Tree { N0 [label="petalwidth" ] ... } and you can feed this to GraphViz to get a nice printed tree. I put the digraph output into a tree.txt file and then generated a png image file through GraphViz:

C:\GraphViz> dot -Tpng tree.txt > tree.png

Kirt Undercoffer
  • 591
  • 4
  • 11