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

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

Tests moved and renamed from orange 20.

Line 
1import orange, orngTree
2reload(orngTree)
3
4data = orange.ExampleTable("iris")
5tree = orngTree.TreeLearner(data, maxDepth=3)
6
7formats = ["", "%V (%M out of %N)", "%V (%^MbA%, %^MbP%)",
8           '%C="Iris-versicolor" (%^c="Iris-versicolor"% of node, %^CbA="Iris-versicolor"% of versicolors)',
9           "%D", "%.2d"]
10
11for format in formats:
12    print '\n\n*** FORMAT: "%s"\n' % format
13    orngTree.printTree(tree, leafStr=format)
14
15formats2 = [("%V", "."), ('%^.1CbA="Iris-virginica"% (%^.1CbP="Iris-virginica"%)', '.'), ("%V   %D %.2DbP %.2dbP", "%D %.2DbP %.2dbP")]
16for fl, fn in formats2:
17    orngTree.printTree(tree, leafStr=fl, nodeStr=fn)
18
19
20data = orange.ExampleTable("housing")
21tree = orngTree.TreeLearner(data, maxDepth=3)
22formats = ["", "%V"]
23for format in formats:
24    print '\n\n*** FORMAT: "%s"\n' % format
25    orngTree.printTree(tree, leafStr=format)
26
27formats2 = [("[SE: %E]\t %V %I(90)", "[SE: %E]"), ("%C<22 (%cbP<22)", "."), ("%C![20,22] (%^cbP![20,22]%)", ".")]
28for fl, fn in formats2:
29    orngTree.printTree(tree, leafStr=fl, nodeStr=fn)
Note: See TracBrowser for help on using the repository browser.