changing attribute selection algorithm

View: New views
8 Messages — Rating Filter:   Alert me  

changing attribute selection algorithm

by shiloon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi forum,

as i know J48 algorithm selects extending node according Gain Ratio. i just wanted to change this algorithm, e.g randomize att. selection.
i think i have to change weka code, in GainRatioAttributeEval class?  am i right?

thanks
shilan

Re: changing attribute selection algorithm

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> as i know J48 algorithm selects extending node according Gain Ratio. i just
> wanted to change this algorithm, e.g randomize att. selection.
> i think i have to change weka code, in GainRatioAttributeEval class?  am i
> right?

No, that evaluation class is only for the attribute selection package.

J48 relevant classes are found in package weka.classifiers.trees.j48.
>From a quick look at the code, the C45Split class should be the one
that you're after (used by the C45ModelSelection class, which gets
instantiated in J48's buildClassifier method).

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: changing attribute selection algorithm

by shiloon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this means that by choosing j48 in classifier tab, selecting an attributeSelection like RandomOne  in preprocess tab would be useless?
Peter Reutemann-3 wrote:
> as i know J48 algorithm selects extending node according Gain Ratio. i just
> wanted to change this algorithm, e.g randomize att. selection.
> i think i have to change weka code, in GainRatioAttributeEval class?  am i
> right?

No, that evaluation class is only for the attribute selection package.

J48 relevant classes are found in package weka.classifiers.trees.j48.
>From a quick look at the code, the C45Split class should be the one
that you're after (used by the C45ModelSelection class, which gets
instantiated in J48's buildClassifier method).

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: changing attribute selection algorithm

by shiloon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



hi
i've found this line,
 minResult = currentModel[i].gainRatio(); at C45ModelSelection  line 162
i think this is the line that should be modified to gain new algorithm for spiliting a node, e.g infoGain() instead of gainRatio(). am i right?
but strangely when i use something like this getRandomDouble() instead of gainRatio(), and i repeat the test, i get same result for each try!! although i think it should be different each time!

any idea please?

Peter Reutemann-3 wrote:
> as i know J48 algorithm selects extending node according Gain Ratio. i just
> wanted to change this algorithm, e.g randomize att. selection.
> i think i have to change weka code, in GainRatioAttributeEval class?  am i
> right?

No, that evaluation class is only for the attribute selection package.

J48 relevant classes are found in package weka.classifiers.trees.j48.
>From a quick look at the code, the C45Split class should be the one
that you're after (used by the C45ModelSelection class, which gets
instantiated in J48's buildClassifier method).

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


Re: changing attribute selection algorithm

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please no top-posting, see mailing list etiquette why
(http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html).

> this means that by choosing j48 in classifier tab, selecting an
> attributeSelection like RandomOne  in preprocess tab would be useless?

Different tabs, different functionality. They're independent from each other.

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: changing attribute selection algorithm

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> i've found this line,
>>  minResult = currentModel[i].gainRatio(); at C45ModelSelection  line 162
>> i think this is the line that should be modified to gain new algorithm for
>> spiliting a node, e.g infoGain() instead of gainRatio(). am i right?
>> but strangely when i use something like this getRandomDouble() instead of
>> gainRatio(), and i repeat the test, i get same result for each try!!
>> although i think it should be different each time!
>>
>> any idea please?

Did you check with a debugger whether the modified code was actually
used and a different attribute chosen?

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: changing attribute selection algorithm

by shiloon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

it wasn't really top-posting. i just edited my previous post!
i checked the tree size, it changed with subsituing infoGain() ! but for getRandom(), weired! i don't get random result!
Peter Reutemann-3 wrote:
>> i've found this line,
>>  minResult = currentModel[i].gainRatio(); at C45ModelSelection  line 162
>> i think this is the line that should be modified to gain new algorithm for
>> spiliting a node, e.g infoGain() instead of gainRatio(). am i right?
>> but strangely when i use something like this getRandomDouble() instead of
>> gainRatio(), and i repeat the test, i get same result for each try!!
>> although i think it should be different each time!
>>
>> any idea please?

Did you check with a debugger whether the modified code was actually
used and a different attribute chosen?

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@list.scms.waikato.ac.nz
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

Re: changing attribute selection algorithm

by NightlordTW :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/11/2 shiloon <kalhor@...>

it wasn't really top-posting. i just edited my previous post!
i checked the tree size, it changed with subsituing infoGain() ! but for
getRandom(), weired! i don't get random result!

If I remember correct, Weka uses a random seed. With other words, if you dont alter the random seed each time you restart the main process, the random values you get will follow the same sequence.
 
 
Peter Reutemann-3 wrote:
>
>>> i've found this line,
>>>  minResult = currentModel[i].gainRatio(); at C45ModelSelection  line 162
>>> i think this is the line that should be modified to gain new algorithm
>>> for
>>> spiliting a node, e.g infoGain() instead of gainRatio(). am i right?
>>> but strangely when i use something like this getRandomDouble() instead
>>> of
>>> gainRatio(), and i repeat the test, i get same result for each try!!
>>> although i think it should be different each time!
>>>
>>> any idea please?
>
> Did you check with a debugger whether the modified code was actually
> used and a different attribute chosen?
>
> Cheers, Peter
> --
> Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
> http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: Wekalist@...
> List info and subscription status:
> https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette:
> http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
>

--
View this message in context: http://old.nabble.com/changing-attribute-selection-algorithm-tp26108569p26156042.html
Sent from the WEKA mailing list archive at Nabble.com.



_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html




--
Thomas Debray | Theoretical Epidemiology | Julius Center | Stratenum 6.131 | University Medical Center Utrecht  | P.O.Box 85500  | 3508 GA Utrecht | The Netherlands | www.juliuscenter.nl | www.thomasdebray.be | www.netstorm.be

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html