简体   繁体   中英

WEKA classifier arguments from the command line

I'm running ubuntu 14.10, and I've created and saved a model through the GUI. Now I have some test data I'd like to run from the command line. This works fine, as long as I don't try and pass any classifier specific options. When I do, I receive a "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 does not:

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 does one pass command line arguments to the classifier?

Additional question: are the default arguments used when generating the model saved with the model, so that when someone uses '-l foo.model' to load it from the command line, one does not need to specify the rest of the arguments on the command line? The weka CLI primer documentation is unclear on this.

Note: I know IBk isn't exactly a model, per-se, but its illustrative of every classifier I try.

The -K parameter does not appear to work when a classifier is being loaded, but rather when training the model from the command prompt. This is likely due to the fact that the kNN model is already trained with, say, k=1, so changing k would change the model that has already been generated.

If you use the parameters -K, -t and -T, you should be able to generate a new model with the desired k on a nominated training set and evaluated on given testing data.

I don't believe the issue you have is with the command line arguments (you're doing it right!), but rather that the argument is invalid in your given situation.

Additional Question : The parameters of the model that was trained are not likely required as they were used for training, which was completed before being saved. Other parameters will still be required (like testing data for evaluation).

Hope this Helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM