0
votes

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.

1
You'll have to be more specific I suppose. Are you utilizing Weka in java already? IF you are, then just browse the weka API documentation specifically about how to display results. You didn't even say which learner you are attempting to use or anything. I don't know what SMO output is. Do you mean SOM? as in a self-organizing map? - RutledgePaulV
Hey Paul, I am really sorry about that! I was using the Support Vector Machines (Sequential Minimal Optimization (SMO). The kernel I used was the RBF Kernel. This output was generated by the GUI, but I was trying to import the Weka classes into a Java program to get the same. However, it is easier to use the command line options. I used -d option for the information statistics (including the output posted above), and the -p option using a separate command to get the predictions (as the -p option only writes the predictions). - acc_so

1 Answers

0
votes

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