Orange Forum • View topic - Question about boosting and bagging

Question about boosting and bagging

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

Question about boosting and bagging

Postby Barbara » Mon Nov 05, 2007 15:17


I've been boosting and bagging a set of data using the learners from orngEnsemble. I have also used the Bagging and AdaBoostM1 classifiers in WEKA. In Weka it is possible to print out a Classifier model. Is that an option in Orange too? If yes, what code do I use?

Thank you in advance.



Postby Blaz » Sun Nov 18, 2007 17:43

Bagging in boosting, as implemented in orngEnsemble, both store classifiers. Using an example from, you could take, and, for instance, a its bagged tree learner defined as:

bg = orngEnsemble.BaggedLearner(tree, name="bagged tree")

you may build a bag of classifiers with

bc = bg(data)

and then have the access to each of them through bc.classifiers. Few examples:

Code: Select all
>>> len(bc.classifiers)
>>> orngTree.countNodes(bc.classifiers[0])
>>> orngTree.printTree(bc.classifiers[0])
lym_dimin=3: 4 (100.00%)
|    changes_node=1
|    |    exclusion=1: 1 (100.00%)


Postby Barbara » Thu Nov 22, 2007 10:32

Thank you, it works fine for the bagged learner. But if I try the same with the boosted learner

bs = orngEnsemble.BoostedLearner(tree, name="boosted tree")

bc = bs(data)

it prints out the length 1, but it can't print out the tree. I get and AttributeError: 'list' object has no attribute 'classVar'. Should I have done this differently?

Return to Questions & Support