Look into a model

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Look into a model

Thomas Pfau
Hi,

I have a model represented by a voter combination of multiple random
forests. I'm wondering, whether there is any way to actually have a look
at the individual random forests i.e. see what the forests are
doing/which decisions they make.

Best

Thomas

--
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: [hidden email]

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Look into a model

Mark Hall
If you are using Weka's Vote meta classifier then it will print the base models in the output. For RandomForest, you will need to set the printClassifiers option to true (-print if you are using the command line) in order to see the individual trees in the forest.

Cheers,
Mark.

On 13/06/17, 1:40 AM, "Thomas Pfau" <[hidden email] on behalf of [hidden email]> wrote:

    Hi,
   
    I have a model represented by a voter combination of multiple random
    forests. I'm wondering, whether there is any way to actually have a look
    at the individual random forests i.e. see what the forests are
    doing/which decisions they make.
   
    Best
   
    Thomas
   
    --
    Université du Luxembourg
    Faculté des Sciences, de la Technologie et de la Communication
    Campus Belval, Biotech II 115
    6 avenue du Swing
    L-4367 Belvaux
    Tel: (+352) 46 66 44 5309
    Email: [hidden email]
   
    _______________________________________________
    Wekalist mailing list
    Send posts to: [hidden email]
    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
   


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Look into a model

Thomas Pfau
Hi Mark,

I saw, that the option is an option of the classifier itself. Can this
also be done for an existing model? i.e. if I have a model created and
saved, can I load it and then display its contents somehow?
It would be sufficient, if I can do so programmatically (i.e. load the
model in a small java program to print the trees).

Best

Thomas


On 2017-06-13 15:50, Mark Hall wrote:

> If you are using Weka's Vote meta classifier then it will print the base models in the output. For RandomForest, you will need to set the printClassifiers option to true (-print if you are using the command line) in order to see the individual trees in the forest.
>
> Cheers,
> Mark.
>
> On 13/06/17, 1:40 AM, "Thomas Pfau" <[hidden email] on behalf of [hidden email]> wrote:
>
>     Hi,
>    
>     I have a model represented by a voter combination of multiple random
>     forests. I'm wondering, whether there is any way to actually have a look
>     at the individual random forests i.e. see what the forests are
>     doing/which decisions they make.
>    
>     Best
>    
>     Thomas
>    
>     --
>     Université du Luxembourg
>     Faculté des Sciences, de la Technologie et de la Communication
>     Campus Belval, Biotech II 115
>     6 avenue du Swing
>     L-4367 Belvaux
>     Tel: (+352) 46 66 44 5309
>     Email: [hidden email]
>    
>     _______________________________________________
>     Wekalist mailing list
>     Send posts to: [hidden email]
>     List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>     List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>    
>
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

--
Université du Luxembourg
Faculté des Sciences, de la Technologie et de la Communication
Campus Belval, Biotech II 115
6 avenue du Swing
L-4367 Belvaux
Tel: (+352) 46 66 44 5309
Email: [hidden email]

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Look into a model

Eibe Frank-2
Administrator
Yes, this can be done. However, if you have not configured the random forest classifier to print the individual trees, you will need to write a program.

Here is example code that can be executed in WEKA’s Groovy console (assuming the model is saved in “my_model_file.model”):

votedClassifier = (weka.classifiers.meta.Vote)weka.core.SerializationHelper.read("my_model_file.model")
ensembleMembers = votedClassifier.getClassifiers()
for (weka.classifiers.Classifier cl : ensembleMembers) {
  (weka.classifiers.trees.RandomForest)cl.setPrintClassifiers(true)
  print(cl)
}

If you have configured RandomForest to output the trees, you can just load the model into the Explorer and it will be printed (right-click in the Result list part of the Classify panel to load a model from a file).

Cheers,
Eibe

> On 14/06/2017, at 8:28 PM, Thomas Pfau <[hidden email]> wrote:
>
> Hi Mark,
>
> I saw, that the option is an option of the classifier itself. Can this
> also be done for an existing model? i.e. if I have a model created and
> saved, can I load it and then display its contents somehow?
> It would be sufficient, if I can do so programmatically (i.e. load the
> model in a small java program to print the trees).
>
> Best
>
> Thomas
>
>
> On 2017-06-13 15:50, Mark Hall wrote:
>> If you are using Weka's Vote meta classifier then it will print the base models in the output. For RandomForest, you will need to set the printClassifiers option to true (-print if you are using the command line) in order to see the individual trees in the forest.
>>
>> Cheers,
>> Mark.
>>
>> On 13/06/17, 1:40 AM, "Thomas Pfau" <[hidden email] on behalf of [hidden email]> wrote:
>>
>>    Hi,
>>
>>    I have a model represented by a voter combination of multiple random
>>    forests. I'm wondering, whether there is any way to actually have a look
>>    at the individual random forests i.e. see what the forests are
>>    doing/which decisions they make.
>>
>>    Best
>>
>>    Thomas
>>
>>    --
>>    Université du Luxembourg
>>    Faculté des Sciences, de la Technologie et de la Communication
>>    Campus Belval, Biotech II 115
>>    6 avenue du Swing
>>    L-4367 Belvaux
>>    Tel: (+352) 46 66 44 5309
>>    Email: [hidden email]
>>
>>    _______________________________________________
>>    Wekalist mailing list
>>    Send posts to: [hidden email]
>>    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>>    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>
>>
>>
>> _______________________________________________
>> Wekalist mailing list
>> Send posts to: [hidden email]
>> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
> --
> Université du Luxembourg
> Faculté des Sciences, de la Technologie et de la Communication
> Campus Belval, Biotech II 115
> 6 avenue du Swing
> L-4367 Belvaux
> Tel: (+352) 46 66 44 5309
> Email: [hidden email]
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

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