summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python/tests/tree.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-03-31 16:38:03 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-03-31 16:38:03 +0100
commit10b808156bff157d401b5b999a215d16715a1018 (patch)
tree6206ed1b0debae934f9f45a04910dd57f1694225 /src/gallium/state_trackers/python/tests/tree.py
parent6dd0a5f3d69bc84d4a57123dc890365f59b4a3aa (diff)
python/test: Dump a classification tree of the results when finished testing.
Diffstat (limited to 'src/gallium/state_trackers/python/tests/tree.py')
-rw-r--r--src/gallium/state_trackers/python/tests/tree.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/python/tests/tree.py b/src/gallium/state_trackers/python/tests/tree.py
new file mode 100644
index 0000000000..14b3599c6d
--- /dev/null
+++ b/src/gallium/state_trackers/python/tests/tree.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+#
+# See also:
+# http://www.ailab.si/orange/doc/ofb/c_otherclass.htm
+
+import os.path
+import sys
+
+import orange
+import orngTree
+
+for arg in sys.argv[1:]:
+ name, ext = os.path.splitext(arg)
+
+ data = orange.ExampleTable(arg)
+
+ tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
+
+ orngTree.printTxt(tree)
+
+ orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box')