Orange Forum • View topic - So I have the tree now, how do I get its logic?

So I have the tree now, how do I get its logic?

A place to ask questions about methods in Orange and how they are used and other general support.

So I have the tree now, how do I get its logic?

Postby shushang » Tue Dec 18, 2012 9:57

Just a basic question, eg.

# Description: Learn decision tree from data and output class probabilities for first few instances
# Category: modelling
# Uses: voting.tab
# Classes: orngTree.TreeLearner
# Referenced: c_otherclass.htm

import orange, orngTree
data = orange.ExampleTable("voting")

tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
print "Possible classes:", data.domain.classVar.values
print "Probabilities for democrats:"
for i in range(5):
p = tree(data[i], orange.GetProbabilities)
print "%d: %5.3f (originally %s)" % (i+1, p[1], data[i].getclass())

print
orngTree.printTxt(tree)
orngTree.printDot(tree, fileName='tree.dot', internalNodeShape="ellipse", leafShape="box")



however if I wish to apply this tree onto a new data, to test its power, or to output the result data table as a reference, how could i do so?

Return to Questions & Support