1
votes

I'm trying to run the following weka AdaBoostM1 classifier to boost a J48 tree that is configured for pruning below:

java -classpath ./bin/weka.jar weka.classifiers.meta.AdaBoostM1 -P 100 -S 1 -I 10 -W weka.classifiers.trees.J48 -- -C 0.25 -M 2 \ -t ./data/inputfile.arff > ./results/output.txt &

The configuration string was copied directly from the weka gui and in fact runs there without any problems. However if I try to run that same configuration string on the command-line, weka throws the following error:

Weka exception: No training file and no object input file given.

General options:

-h or -help Output help information. -synopsis or -info Output synopsis for classifier (use in conjunction with -h) -t Sets training file. -T Sets test file. If missing, ...

If I remove the parameters that follow the J48 tree classifer i.e. the string " -- -C 0.25 -M 2" then it works without any problems:

java -classpath ./bin/weka.jar weka.classifiers.meta.AdaBoostM1 -P 100 -S 1 -I 10 -W weka.classifiers.trees.J48 \ -t ./data/inputfile.arff > ./results/output.txt &

Any assistance would be appreciated.

2

2 Answers

0
votes

Take a look at this post: "You've fallen into the usual meta-classifier trap. Meta-classifiers that take "enhance" a single base classifier let you specify the classname (but not the options!) with the -W option."

TL;DR: "The easiest way is to insert the general options right after the classname of the first classifier, the one that is run from the commandline."

0
votes

(Note to self)

As SO User Marcelo Vinicius says, you can call it this way:

java -classpath ./bin/weka.jar weka.classifiers.meta.AdaBoostM1 \ 
 -t ./data/inputfile.arff -P 100 -S 1 -I 10 \
 -W weka.classifiers.trees.J48 -- -C 0.25 -M 2  > ./results/output.txt &

Put the -t Inputfile option after the AdaBoostM1