Getting same output as explorer from Command Line

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

Getting same output as explorer from Command Line

Jeff Pattillo
I am automating various calls to Weka from a script.  If I run Weka from "Explorer", the classifier output section displays a text version of the model, along with statistics on its accuracy.  I want to get this same information from command line so I can > pipe it to a new file.  What command line option prints out the text version of the classifier?
 
For what its worth, the command line I am using is:
 
java weka.classifiers.functions.SimpleLogistic -I 0 -M 500 -H 50 -W 0.0 -t input.arff -classifications "weka.classifiers.evaluation.output.prediction.CSV -suppress -p 1,2 -distribution -file predictions.csv" -no-cv > model.txt
 
It correctly calls the classifier and spits out the predictions to "predictions.csv".  But the file "model.txt" is blank...
 
Jeff
 
 

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: http://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: Getting same output as explorer from Command Line

Juan Sebastián Casallas
Do you get any output on the command line if you remove "> model.txt" from the command? What "> model.txt" does is simply redirect all the console output to the model.txt file.

Juan Sebastian


On Wed, Aug 14, 2013 at 3:55 PM, Jeff Pattillo <[hidden email]> wrote:
I am automating various calls to Weka from a script.  If I run Weka from "Explorer", the classifier output section displays a text version of the model, along with statistics on its accuracy.  I want to get this same information from command line so I can > pipe it to a new file.  What command line option prints out the text version of the classifier?
 
For what its worth, the command line I am using is:
 
java weka.classifiers.functions.SimpleLogistic -I 0 -M 500 -H 50 -W 0.0 -t input.arff -classifications "weka.classifiers.evaluation.output.prediction.CSV -suppress -p 1,2 -distribution -file predictions.csv" -no-cv > model.txt
 
It correctly calls the classifier and spits out the predictions to "predictions.csv".  But the file "model.txt" is blank...
 
Jeff
 
 

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: http://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: http://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: Getting same output as explorer from Command Line

Jeff Pattillo
In reply to this post by Jeff Pattillo
I do not get any output to the console.  I completely agree with you that's what the pipe does. 
 
What I need is a command line option that prints out the text version of the model, as you would see in explorer, to the console.
 
Jeff

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: http://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: Getting same output as explorer from Command Line

Jeff Pattillo
In reply to this post by Jeff Pattillo
So apparently you can output the human-readable model in text format, or output the instances with their classifications, but not both.
 
If I run
 
java weka.classifiers.functions.SimpleLogistic -I 0 -M 500 -H 50 -W 0.0 -t input.arff > model.arff
 
the human-readable model, which would get outputted to the screen, gets piped to model.arff.
 
However, if I run
 
java weka.classifiers.functions.SimpleLogistic -I 0 -M 500 -H 50 -W 0.0 -t input.arff -classifications \"weka.classifiers.evaluation.output.prediction.CSV -suppress -p 1,2 -distribution -file predictions.arff\" -no-cv
 
the human-readable model never gets printed to the screen, and so trying to pipe it to another file (model.arff) is useless.
 
Is there any way to output both the model and the classifications?
 
Jeff

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: http://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: Getting same output as explorer from Command Line

S.J.West
Hi Jeff - I assume you have overcome this problem by now, but I'm including
this post for any future searches of this problem:

java weka.classifiers.functions.SimpleLogistic -I 0 -M 500 -H 50 -W 0.0 -t
input.arff -classifications
\"weka.classifiers.evaluation.output.prediction.CSV -suppress -p 1,2
-distribution -file predictions.arff\" -no-cv

The "-suppress" flag in your command is suppressing output to the console,
so please remove this flag to get the output you desire!

See:
http://weka.sourceforge.net/doc.dev/weka/classifiers/evaluation/output/prediction/CSV.html

Specifically:

-suppress
  In case the data gets stored in a file, then this flag can be used
  to suppress the regular output.
  (default: not suppressed)

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




--
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