source: orange/orange/doc/modules/tree8.py @ 6538:a5f65d7f0b2c

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

Made XPM version of the icon 32x32.

Line 
1# Description: Builds a classification tree, and prunes it using minimal error
2#              prunning with different values of parameter m. Prints
3#              out m and the size of the tree.
4#              a tree in text and dot format
5# Category:    modelling
6# Uses:        iris
7# Referenced:  orngTree.htm
8
9import orange, orngTree
10data = orange.ExampleTable("../datasets/adult_sample.tab")
11
12tree = orange.TreeLearner(data)
13prunner = orange.TreePruner_m()
14trees = [(0, tree.tree)]
15for m in [0.0, 0.1, 0.5, 1, 5, 10, 50, 100]:
16    prunner.m = m
17    trees.append((m, prunner(tree)))
18
19for m, t in trees:
20    print "m = %5.3f: %i nodes, %i leaves" % (m, t.treesize(), orngTree.countLeaves(t))
Note: See TracBrowser for help on using the repository browser.