Question

I am able to successfully export classifier errors in the GUI, but unable to do so in the command line. Is there any way to accomplish this on the command line?

I am using Weka 3.6.x. Here you can right-click your model, choose "Visualize classifier errors" and Save the data (including the prediction) from there. I want to do the same thing on the command line.

I dont really care about the file format (arff or csv is OK), but its important that I get the error value of each & every instance of the test data.

I have asked this previously in [this question]. (Weka Predictions to CSV)

No correct solution

OTHER TIPS

You can get the predictions, probabilities, etc. in the command line by using the following options available in every classifier:

-classifications "weka.classifiers.evaluation.output.prediction.AbstractOutput + options"
        Uses the specified class for generating the classification output.
        E.g.: weka.classifiers.evaluation.output.prediction.PlainText
-p range
        Outputs predictions for test instances (or the train instances if
        no test instances provided and -no-cv is used), along with the
        attributes in the specified range (and nothing else).
        Use '-p 0' if no attributes are desired.
        Deprecated: use "-classifications ..." instead.
-distribution
        Outputs the distribution instead of only the prediction
        in conjunction with the '-p' option (only nominal classes).
        Deprecated: use "-classifications ..." instead.

For instance, using NaiveBayes over the weather dataset:

$ java weka.classifiers.bayes.NaiveBayes -t weather.nominal.arff -classifications weka.classifiers.evaluation.output.prediction.PlainText

=== Predictions under cross-validation ===

 inst#     actual  predicted error prediction
     1       2:no      1:yes   +   0.926
     2      1:yes      1:yes       0.825
     1       2:no      1:yes   +   0.636
     2      1:yes      1:yes       0.808
     1       2:no       2:no       0.718
     2      1:yes       2:no   +   0.656
     1       2:no      1:yes   +   0.579
     2      1:yes      1:yes       0.541
     1       2:no      1:yes   +   0.515
     1      1:yes       2:no   +   0.632
     1      1:yes      1:yes       0.84
     1      1:yes      1:yes       0.554
     1      1:yes      1:yes       0.757
     1      1:yes      1:yes       0.778

The output is tab-separated.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top