source: orange/Orange/testing/regression/tests_20/modules_tree3.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 665 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.