source: orange/orange/doc/Orange/rst/code/tree3.py @ 7713:d27afc892c9c

Revision 7713:d27afc892c9c, 686 bytes checked in by markotoplak, 3 years ago (diff)

Tree documentation update.

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