Q:

Weka GUI tool output in a Java snippet

I am using the Weka tool for SMO in machine learning. How could I generate the predictions in a Java snippet? I get the following output when I use the GUI tool with "buildLogisticModels" set to true. Which method in the Evaluation class generates the output? Please see below the sample where col1 - instance #; col2 = actual; col3 = predicted; col4 = error; col5 = prediction:
 1        1:1        1:1       0.781
 2        1:1        1:1       0.644 
 3        1:1        1:1       0.742 
 4        1:1        1:1       0.748 
 5        1:1        1:1       0.810 
 6        2:0        1:1   +   0.864 
 7        2:0        1:1   +   0.845 
 8        2:0        1:1   +   0.722 

Also, is there any way to generate the binary SMO output in Java? E.g.:

1      * <0.307692 0.588235 0 0.333333 > * X]
1      * <0.461538 0.529412 0.5 0 > * X]
1      * <0.384615 0.588235 0.25 0.333333 > * X]
1      * <0.230769 0.705882 0.25 0.666667 > * X]
1      * <0.615385 0.764706 0.25 0.333333 > * X]

Thanks in advance.

A:

There is definitely a way to do it using the Weka API in a java program. You just add a reference to the weka.jar file and establish the right object then explore the API to find the necessary methods. Have a look here to get started with it. IMO I would go the API route just because command line seems rather hackish..
http://weka.wikispaces.com/Use+Weka+in+your+Java+code

