Orange Forum • View topic - Boosted Decision Stump

Boosted Decision Stump

A place to ask questions about methods in Orange and how they are used and other general support.

Boosted Decision Stump

Postby Fred » Thu Feb 08, 2007 18:33

Hi,

I want to build a simple boosted decision stump.
I have found the BoostedLearner class and now I need that
the TreeLearner returns a tree with only the root node.
I've set maxDepth=0, but it still returns the full tree.
I see that there is an attribute "nodeClassifier", but I don't
understand how to use it.

Could you help me with some example code in building the
decision stump clasiffier?

Thank you,
Fred

Postby Blaz » Wed Feb 21, 2007 23:45

Fred, maxDepth should work. Here is an example code:

Code: Select all
import orange, orngTree
data = orange.ExampleTable("voting")
for md in range(3):
    print '==== maxDepth=%d ====' % md
    tree = orngTree.TreeLearner(data, maxDepth=md)
    orngTree.printTree(tree)


the output it produces (you get the voting data set with orange distribution, or check http://www.ailab.si/orange/datasets.asp) is:

Code: Select all
==== maxDepth=0 ====
democrat (61.38%)
==== maxDepth=1 ====
physician-fee-freeze=y: republican (90.45%)
physician-fee-freeze=n: democrat (98.52%)

==== maxDepth=2 ====
physician-fee-freeze=y
|    synfuels-corporation-cutback=n: republican (97.25%)
|    synfuels-corporation-cutback=y: republican (62.84%)
physician-fee-freeze=n
|    adoption-of-the-budget-resolution=n: democrat (91.52%)
|    adoption-of-the-budget-resolution=y: democrat (99.31%)

Postby edymtt » Tue May 27, 2008 14:24

Balz, could you update the orngTree documentation adding maxDepth to the parameters of TreeLearner constructor? I thought that maxDepth was't exposed to Python unless I searched the forum.


Return to Questions & Support



cron