Command line arguments for WEKA classifier

I am running ubuntu 14.10 and I have created and saved the model via the GUI. Now I have some test data that I would like to run from the command line. This works great as long as I don't try to pass in any special classifier parameters. When I do this, I get an "invalid option" message.

For example, the following works:

java -Xmx1g -cp /usr/share/java/weka.jar weka.classifiers.lazy.IBk -l ibk1-full.model -T testdata.arff

      

However, the following:

java -Xmx1g -cp /usr/share/java/weka.jar weka.classifiers.lazy.IBk -l ibk1-full.model -T testdata.arff -K 3


Weka exception: Illegal options: -K 3

General options:

-h or -help
    Output help information.
-synopsis or -info
...

      

How do I pass command line arguments to the classifier?

Additional question: are the default arguments used when creating the model saved along with the model, so that when someone uses '-l foo.model' to load from the command line, there is no need to specify the rest of the arguments on the command line? The documentation for the Weka CLI guide is unclear.

Note. I know IBk is not really a model, but an illustration of every classifier I try to do.

+3


source to share


1 answer


The -K option doesn't work when the classifier is loading, but rather when you train the model from the command line. This is probably due to the fact that the kNN model has already been trained, say k = 1, so changing k will change the model that has already been generated.

If you use the -K, -t and -T options, you should be able to generate a new model with the desired k in the nominated training set and evaluate against the test data.

I don't believe the issue is with the command line arguments (you are doing it right!), But rather that the argument is not valid in your particular situation.



Additional question . The parameters of the trained model are unlikely to be required as they were used for training, which were performed before they were saved. Other parameters will still be needed (for example, test data for evaluation).

Hope it helps!

+2


source







All Articles