0

I have created a decision tree in Weka. I now want to calculate a prediction (with this model) in matlab and visualize the result nicely in the tree. But I haven't been able to find a good way to draw the tree and the results from the instance on it.

Should I draw it as a flow chart? is there an out of the box way to do this? Could I calculate C4.5 in Matlab and would it already draw the tree?

Atilla Ozgur
  • 14,339
  • 3
  • 49
  • 69
dorien
  • 5,265
  • 10
  • 57
  • 116
  • You can use this implementation of tree data structure, which includes plotting: http://tinevez.github.io/matlab-tree/ – Itamar Katz May 23 '16 at 10:31

1 Answers1

0

You can visualize the tree directly from Weka: Visualizing Weka classification tree

Then, you can ask Weka to print the tree and you can copy and parse the structure elsewhere. Think of the structure as some kind of nested if/then/elses, will be something like this:

FeatureLabel-hasPRP <= 0
|   FeatureAnimal-Class <= 0.636364
|   |   FeatureLabel-hasNNP <= 0
|   |   |   v-subject-g-talk <= 0.285714
|   |   |   |   FeatureLabel-hasNN <= 0
|   |   |   |   |   FeatureLabel-hasPOS <= 0
|   |   |   |   |   |   FeatureLabel-dep_head_det_the <= 0: NONACTOR (130.03/6.27)
|   |   |   |   |   |   FeatureLabel-dep_head_det_the > 0: ACTOR (16.19/6.27)
|   |   |   |   |   FeatureLabel-hasPOS > 0: ACTOR (21.41/2.09)
|   |   |   |   FeatureLabel-hasNN > 0
|   |   |   |   |   FeatureVehicle-Class <= 0.487179

...

Community
  • 1
  • 1
Josep Valls
  • 5,483
  • 2
  • 33
  • 67