1 Apr 2009 03:23
Re: Question about the command line
Peter Reutemann <fracpete <at> gmail.com>
2009-04-01 01:23:30 GMT
2009-04-01 01:23:30 GMT
> I am writing my codes using some of the weka classes. I call my class from the command line. Suppose the
command includes:
>
> -W weka.classifiers.functions.SMO -K weka.classifiers.functions.supportVector.PolyKernel
>
> And I use the following codes to read the above command from the argument:
>
> String[] tmpOptions;
> String classname;
> tmpOptions = Utils.splitOptions(Utils.getOption("W", args));
> classname = tmpOptions[0];
> tmpOptions[0] = "";
> Classifier cls = (Classifier) Utils.forName(Classifier.class, classname, tmpOptions);
>
> So that it will get SMO as the classifier, and the parameters are shown in the tmpOptions, which here would
be "-K weka.classifiers.functions.supportVector.PolyKernel".
>
> However, if I want to add a parameter to PolyKernel, such as change the exponent from the default value 1.0
to 2.0, then the part of the command line would be like:
>
> -W weka.classifiers.functions.SMO -K weka.classifiers.functions.supportVector.PolyKernel
-- -E 2.0
>
> But using the codes above to analyze the command wouldn't work, because "--" cannot be recognized. My
question is, could you possibly provide me with the updated codes which can read the command which
includes a parameter adding to the sub-classifier. I thought about it for a while, but still could not
figure out how to modify the codes.
You have to use the Utils.partitionOptions(...) method to obtain the
options after the "--". See the setOptions(String[]) method of the
(Continue reading)
RSS Feed