source: orange/orange/doc/ofb/tree.py @ 6538:a5f65d7f0b2c

Revision 6538:a5f65d7f0b2c, 707 bytes checked in by Mitar <Mitar@…>, 4 years ago (diff)

Made XPM version of the icon 32x32.

Line 
1# Description: Learn decision tree from data and output class probabilities for first few instances
2# Category:    modelling
3# Uses:        voting.tab
4# Classes:     orngTree.TreeLearner
5# Referenced:  c_otherclass.htm
6
7import orange, orngTree
8data = orange.ExampleTable("voting")
9
10tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
11print "Possible classes:", data.domain.classVar.values
12print "Probabilities for democrats:"
13for i in range(5):
14    p = tree(data[i], orange.GetProbabilities)
15    print "%d: %5.3f (originally %s)" % (i+1, p[1], data[i].getclass())
16
17print
18orngTree.printTxt(tree)
19orngTree.printDot(tree, fileName='tree.dot', internalNodeShape="ellipse", leafShape="box")
20
Note: See TracBrowser for help on using the repository browser.