Orange Forum • View topic - Setting Different 'Attributes' for RandomForestLearner

Setting Different 'Attributes' for RandomForestLearner

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

Setting Different 'Attributes' for RandomForestLearner

Postby suraj_amo » Tue Aug 21, 2007 19:36

Hello ,

I was trying to use Random Forests with different parameters for the 'Randomly Selected Features'.

However, I could not use this feature in an appropriate way.

I tried this

# data
data_wine = orange.ExampleTable('')

# forest1
forest1 = orngEnsemble.RandomForestLearner()
forest1.attributes = 1
forest1_instance = forest1(data)

# forest2
forest2 = orngEnsemble.RandomForestLearner()
forest2.attributes = 15
forest2_instance = forest2(data)

I observed that the trees created were exactly the same. I tried using some other attributes values and used a different dataset too - but found that the forests were exactly the same.

I also used the tools of orngTest and orngStats for RF by setting different attributes for the RF - they gave me the exact same statistics.

Is there some reason for the same ?

Thanks !

Postby marko » Wed Aug 22, 2007 9:44

To set the number of attributes used in each split (Breiman's parameter F), you should specify the number of attributes in constructor, as in:
Code: Select all
forest1 = orngEnsemble.RandomForestLearner(attributes=5)

or alternatively:
Code: Select all
forest1 = orngEnsemble.RandomForestLearner()
self.learner.split.attributes = 5

But even if you had used commands listed above it wouldn't work. Therefore I thank you for reporting a nasty bug. I tried setting number of attributes for the wine data set and got the same results as you did.

I have also tried some other data sets. On data sets with only discrete attributes everything seems to work, but on every data set with continuous attributes I've tried the generated trees are always the same.

We will post a note here when we fix the bug.

Postby marko » Mon Sep 03, 2007 10:38

We believe the problem is solved. Try with the newest snapshot.

Return to Questions & Support