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

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

Made XPM version of the icon 32x32.

Line 
1# Author:      J Zabkar
2# Version:     1.0
3# Description: Grow classification tree with a self-defined stopping criteria
4# Category:    modelling
5# Uses:        iris.tab
6# Referenced:   orngTree.htm
7
8import orange, orngTree
9from random import randint, seed
10seed(0)
11
12data = orange.ExampleTable("iris.tab")
13
14print "SOME RANDOMNESS IN STOPING:"
15defStop = orange.TreeStopCriteria()
16f = lambda examples, weightID, contingency: defStop(examples, weightID, contingency) or randint(1, 5)==1
17l = orngTree.TreeLearner(data, stop=f)
18orngTree.printTxt(l)
19
20print "\nRANDOM STOPING:"
21f = lambda x,y,z: randint(1, 5)==1
22l = orngTree.TreeLearner(data, stop=f)
23orngTree.printTxt(l)
Note: See TracBrowser for help on using the repository browser.