Show as output trees and plain text when running from command line

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

Show as output trees and plain text when running from command line

neve2390
Hello everybody,

I am quite new to Weka but what I have two questions:

1) I'am trying to do is run Weka from command line on my train and test data
and obtain as output both the tree and the plain text.

This is my basic code:

java -classpath CLASSPATH:weka.jar weka.classifiers,trees.J48 -C 0.25 -M 2 \
-t Matrix70.arff \
-T Matrix30.arff

So, I obtain the classic output of the command line. I tried to add
-classification weka.classifier.evaluation.output.prediction.PlainText but I
obtained an error that the parameter is wrong.

java -classpath CLASSPATH:weka.jar weka.classifiers,trees.J48 -C 0.25 -M 2 \
-t Matrix70.arff \
-T Matrix30.arff \
-classification weka.classifier.evaluation.output.prediction.PlainText

I tried to search everywhere but there is no reference about how to obtain
ALSO the plain text in the output.

2) How can I show in the tree output also the ENTROPY values? I tried with
-S ENTROPY but doesn't work.

Thanks!





--
Sent from: http://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit 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: Show as output trees and plain text when running from command line

Eibe Frank-2
Administrator
There are a few typos:

“,trees” -> “.trees”

“-classification” -> “-classifications”

“classifier.evaluation” -> “.classifiers.evaluation”

If you are working with WEKA 3.8/3.9, use weka.Run to make things easier. Rather than

  java weka.classifiers.trees.J48 -C 0.25 -M 2 -t ~/datasets/UCI/iris.arff -classifications weka.classifiers.evaluation.output.prediction.PlainText

we can use

  java weka.Run .J48 -C 0.25 -M 2 -t ~/datasets/UCI/iris.arff -classifications .PlainText

This works as long as the suffixes match the corresponding class names uniquely.

There is no option to simultaneously output the model and the predictions. You can serialise the model to a file though, so you can do something like this:

  java weka.Run .J48 -C 0.25 -M 2 -t ~/datasets/UCI/iris.arff -T ~/datasets/UCI/iris.arff -d j48Model.model

to get the model and performance stats, followed by

  java weka.Run .J48 -T ~/datasets/UCI/iris.arff -l j48Model.model -classifications .PlainText

to get the predictions. (Due to laziness, I’m using the same data for training and testing here.)

Output of entropy values is not supported. You would have to modify the code.

Cheers,
Eibe

> On 21/01/2019, at 11:36 PM, neve2390 <[hidden email]> wrote:
>
> Hello everybody,
>
> I am quite new to Weka but what I have two questions:
>
> 1) I'am trying to do is run Weka from command line on my train and test data
> and obtain as output both the tree and the plain text.
>
> This is my basic code:
>
> java -classpath CLASSPATH:weka.jar weka.classifiers,trees.J48 -C 0.25 -M 2 \
> -t Matrix70.arff \
> -T Matrix30.arff
>
> So, I obtain the classic output of the command line. I tried to add
> -classification weka.classifier.evaluation.output.prediction.PlainText but I
> obtained an error that the parameter is wrong.
>
> java -classpath CLASSPATH:weka.jar weka.classifiers,trees.J48 -C 0.25 -M 2 \
> -t Matrix70.arff \
> -T Matrix30.arff \
> -classification weka.classifier.evaluation.output.prediction.PlainText
>
> I tried to search everywhere but there is no reference about how to obtain
> ALSO the plain text in the output.
>
> 2) How can I show in the tree output also the ENTROPY values? I tried with
> -S ENTROPY but doesn't work.
>
> Thanks!
>
>
>
>
>
> --
> Sent from: http://weka.8497.n7.nabble.com/
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> To subscribe, unsubscribe, etc., visit 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]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html