下面列出了怎么用weka.core.SelectedTag的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Set the metric type for ranking rules
*
* @param d the type of metric
*/
public void setMetricType(SelectedTag d) {
if (d.getTags() == TAGS_SELECTION) {
m_metricType = d.getSelectedTag().getID();
}
if (m_metricType == CONFIDENCE) {
setMinMetric(0.9);
}
if (m_metricType == LIFT || m_metricType == CONVICTION) {
setMinMetric(1.1);
}
if (m_metricType == LEVERAGE) {
setMinMetric(0.1);
}
}
/**
* Parses a given list of options. Valid options are:<p>
*
* -B num <br>
* Set the number of boosting iterations
* (default 10) <p>
*
* -E num <br>
* Set the nodes to expand: -3(all), -2(weight), -1(z_pure), >=0 seed for random walk
* (default -3) <p>
*
* -D <br>
* Save the instance data with the model <p>
*
* @param options the list of options as an array of strings
* @exception Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String bString = Utils.getOption('B', options);
if (bString.length() != 0) setNumOfBoostingIterations(Integer.parseInt(bString));
String eString = Utils.getOption('E', options);
if (eString.length() != 0) {
int value = Integer.parseInt(eString);
if (value >= 0) {
setSearchPath(new SelectedTag(SEARCHPATH_RANDOM, TAGS_SEARCHPATH));
setRandomSeed(value);
} else setSearchPath(new SelectedTag(value + 3, TAGS_SEARCHPATH));
}
setSaveInstanceData(Utils.getFlag('D', options));
Utils.checkForRemainingOptions(options);
}
/**
* Set the metric type to use.
*
* @param d the metric type
*/
public void setMetricType(SelectedTag d) {
int ordinal = d.getSelectedTag().getID();
for (DefaultAssociationRule.METRIC_TYPE m : DefaultAssociationRule.METRIC_TYPE.values()) {
if (m.ordinal() == ordinal) {
m_metric = m;
break;
}
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -P <start set>
* Specify a starting set of attributes.
* Eg. 1,3,5-7.</pre>
*
* <pre> -D <0 = backward | 1 = forward | 2 = bi-directional>
* Direction of search. (default = 1).</pre>
*
* <pre> -N <num>
* Number of non-improving nodes to
* consider before terminating search.</pre>
*
* <pre> -S <num>
* Size of lookup cache for evaluated subsets.
* Expressed as a multiple of the number of
* attributes in the data set. (default = 1)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*
**/
public void setOptions (String[] options)
throws Exception {
String optionString;
resetOptions();
optionString = Utils.getOption('P', options);
if (optionString.length() != 0) {
setStartSet(optionString);
}
optionString = Utils.getOption('D', options);
if (optionString.length() != 0) {
setDirection(new SelectedTag(Integer.parseInt(optionString),
TAGS_SELECTION));
} else {
setDirection(new SelectedTag(SELECTION_FORWARD, TAGS_SELECTION));
}
optionString = Utils.getOption('N', options);
if (optionString.length() != 0) {
setSearchTermination(Integer.parseInt(optionString));
}
optionString = Utils.getOption('S', options);
if (optionString.length() != 0) {
setLookupCacheSize(Integer.parseInt(optionString));
}
m_debug = Utils.getFlag('Z', options);
}
/**
* Gets the current settings of the filter.
*
* @return an array of strings suitable for passing to setOptions
*/
public String [] getOptions() {
String [] options = new String [10];
int current = 0;
//if (getUseGaussian()) {
// options[current++] = "-G";
//}
if (getReplaceMissingValues()) {
options[current++] = "-M";
}
if (getPercent() == 0) {
options[current++] = "-N";
options[current++] = "" + getNumberOfAttributes();
}
else {
options[current++] = "-P";
options[current++] = "" + getPercent();
}
options[current++] = "-R";
options[current++] = "" + getRandomSeed();
SelectedTag t = getDistribution();
options[current++] = "-D";
options[current++] = ""+t.getSelectedTag().getReadable();
while (current < options.length) {
options[current++] = "";
}
return options;
}
/**
* Parses a given list of options.
*
<!-- options-start -->
* Valid options are: <p>
*
* -Z <br>
* Specify the number of subsets to generate in the initial population.<p>
*
* -T <start set> <br>
* Specify the treshold used for considering when a subset is significant. <p>
*
* -R <br>
* Specify the kind of combiantion. <p>
*
* -S <br>
* Set the random number seed.
* (default = 1)
*
* -D <br>
* Verbose output for monitoring the search
* (default = false)
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @exception Exception if an option is not supported
*
**/
public void setOptions (String[] options)
throws Exception {
String optionString;
resetOptions();
optionString = Utils.getOption('Z', options);
if (optionString.length() != 0) {
setPopulationSize(Integer.parseInt(optionString));
}
optionString = Utils.getOption('T', options);
if (optionString.length() != 0) {
setThreshold(Double.parseDouble(optionString));
}
optionString = Utils.getOption('R', options);
if (optionString.length() != 0) {
setCombination(new SelectedTag(Integer.parseInt(optionString),
TAGS_SELECTION));
} else {
setCombination(new SelectedTag(COMBINATION_NOT_REDUCED, TAGS_SELECTION));
}
optionString = Utils.getOption('S', options);
if (optionString.length() != 0) {
setSeed(Integer.parseInt(optionString));
}
setDebug(Utils.getFlag('D', options));
}
/**
* Sets the method used to select attributes for use in the
* linear regression.
*
* @param method the attribute selection method to use.
*/
public void setAttributeSelectionMethod(SelectedTag method) {
if (method.getTags() == TAGS_SELECTION) {
m_AttributeSelection = method.getSelectedTag().getID();
}
}
/**
* Sets how the training data will be transformed. Should be one of
* FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.
*
* @param newType the new filtering mode
*/
public void setFilterType(SelectedTag newType) {
if (newType.getTags() == TAGS_FILTER) {
m_filterType = newType.getSelectedTag().getID();
}
}
/**
* Sets how the training data will be transformed. Should be one of
* FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.
*
* @param newType the new filtering mode
*/
public void setFilterType(SelectedTag newType) {
if (newType.getTags() == TAGS_FILTER) {
m_filterType = newType.getSelectedTag().getID();
}
}
/**
* Sets the estimator.
*
* @param estimator the new estimator
*/
public void setEstimator(SelectedTag estimator) {
if (estimator.getTags() == TAGS_ESTIMATOR) {
paceEstimator = estimator.getSelectedTag().getID();
}
}
/**
* Sets the source location of the cost matrix. Values other than
* MATRIX_ON_DEMAND or MATRIX_SUPPLIED will be ignored.
*
* @param newMethod the cost matrix location method.
*/
public void setCostMatrixSource(SelectedTag newMethod) {
if (newMethod.getTags() == TAGS_MATRIX_SOURCE) {
m_MatrixSource = newMethod.getSelectedTag().getID();
}
}
/**
* Sets the method to use for handling missing values. Values other than
* M_NORMAL, M_AVERAGE, M_MAXDIFF and M_DELETE will be ignored.
*
* @param newMode the method to use for handling missing values.
*/
public void setMissingMode(SelectedTag newMode) {
if (newMode.getTags() == TAGS_MISSING) {
m_MissingMode = newMode.getSelectedTag().getID();
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -B <num>
* Manual blend setting (default 20%)
* </pre>
*
* <pre> -E
* Enable entropic auto-blend setting (symbolic class only)
* </pre>
*
* <pre> -M <char>
* Specify the missing value treatment mode (default a)
* Valid options are: a(verage), d(elete), m(axdiff), n(ormal)
* </pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String debug = "(KStar.setOptions)";
String blendStr = Utils.getOption('B', options);
if (blendStr.length() != 0) {
setGlobalBlend(Integer.parseInt(blendStr));
}
setEntropicAutoBlend(Utils.getFlag('E', options));
String missingModeStr = Utils.getOption('M', options);
if (missingModeStr.length() != 0) {
switch ( missingModeStr.charAt(0) ) {
case 'a':
setMissingMode(new SelectedTag(M_AVERAGE, TAGS_MISSING));
break;
case 'd':
setMissingMode(new SelectedTag(M_DELETE, TAGS_MISSING));
break;
case 'm':
setMissingMode(new SelectedTag(M_MAXDIFF, TAGS_MISSING));
break;
case 'n':
setMissingMode(new SelectedTag(M_NORMAL, TAGS_MISSING));
break;
default:
setMissingMode(new SelectedTag(M_AVERAGE, TAGS_MISSING));
}
}
Utils.checkForRemainingOptions(options);
}
/**
* Sets the method of searching the tree for a new insertion. Will be one of
* SEARCHPATH_ALL, SEARCHPATH_HEAVIEST, SEARCHPATH_ZPURE, SEARCHPATH_RANDOM.
*
* @param newMethod the new tree searching mode
*/
public void setSearchPath(SelectedTag newMethod) {
if (newMethod.getTags() == TAGS_SEARCHPATH) {
m_searchPath = newMethod.getSelectedTag().getID();
}
}
/**
* Sets the sort type to be used.
*
* @param type the type of sorting
*/
public void setSortType(SelectedTag type) {
if (type.getTags() == TAGS_SORTTYPE) {
m_SortType = type.getSelectedTag().getID();
if (m_SortType == SORT_CASESENSITIVE)
m_Comparator = new CaseSensitiveComparator();
else if (m_SortType == SORT_CASEINSENSITIVE)
m_Comparator = new CaseInsensitiveComparator();
else
throw new IllegalStateException("Unhandled sort type '" + type + "'!");
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -D
* Enables debugging output (if available) to be printed.
* (default: off)</pre>
*
* <pre> -no-checks
* Turns off all checks - use with caution!
* (default: checks on)</pre>
*
* <pre> -P <0|1>
* The pruning method to use:
* 0 = No pruning
* 1 = Lambda pruning
* (default: 0)</pre>
*
* <pre> -C <num>
* The size of the cache (a prime number).
* (default: 250007)</pre>
*
* <pre> -IC <num>
* The size of the internal cache (a prime number).
* (default: 200003)</pre>
*
* <pre> -L <num>
* The lambda constant. Penalizes non-continuous subsequence
* matches. Must be in (0,1).
* (default: 0.5)</pre>
*
* <pre> -ssl <num>
* The length of the subsequence.
* (default: 3)</pre>
*
* <pre> -ssl-max <num>
* The maximum length of the subsequence.
* (default: 9)</pre>
*
* <pre> -N
* Use normalization.
* (default: no)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('P', options);
if (tmpStr.length() != 0)
setPruningMethod(
new SelectedTag(Integer.parseInt(tmpStr), TAGS_PRUNING));
else
setPruningMethod(
new SelectedTag(PRUNING_NONE, TAGS_PRUNING));
tmpStr = Utils.getOption('C', options);
if (tmpStr.length() != 0)
setCacheSize(Integer.parseInt(tmpStr));
else
setCacheSize(250007);
tmpStr = Utils.getOption("IC", options);
if (tmpStr.length() != 0)
setInternalCacheSize(Integer.parseInt(tmpStr));
else
setInternalCacheSize(200003);
tmpStr = Utils.getOption('L', options);
if (tmpStr.length() != 0)
setLambda(Double.parseDouble(tmpStr));
else
setLambda(0.5);
tmpStr = Utils.getOption("ssl", options);
if (tmpStr.length() != 0)
setSubsequenceLength(Integer.parseInt(tmpStr));
else
setSubsequenceLength(3);
tmpStr = Utils.getOption("ssl-max", options);
if (tmpStr.length() != 0)
setMaxSubsequenceLength(Integer.parseInt(tmpStr));
else
setMaxSubsequenceLength(9);
setUseNormalization(Utils.getFlag('N', options));
if (getMaxSubsequenceLength()<2*getSubsequenceLength()) {
throw new IllegalArgumentException("Lambda Pruning forbids even contiguous substring matches! " +
"Use a bigger value for ssl-max (at least 2*ssl).");
}
super.setOptions(options);
}
/**
* Parses the options for this object. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -D
* Turns on output of debugging information.</pre>
*
* <pre> -R <index1,index2-index4,...>
* Specify list of string attributes to convert to words.
* (default: select all relational attributes)</pre>
*
* <pre> -V
* Inverts the matching sense of the selection.</pre>
*
* <pre> -S <CASE|NON-CASE>
* Determines the type of sorting:
* CASE = Case-sensitive
* NON-CASE = Case-insensitive
* (default: CASE)</pre>
*
<!-- options-end -->
*
* @param options the options to use
* @throws Exception if setting of options fails
*/
public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('R', options);
if (tmpStr.length() != 0)
setAttributeIndices(tmpStr);
else
setAttributeIndices("first-last");
setInvertSelection(Utils.getFlag('V', options));
tmpStr = Utils.getOption('S', options);
if (tmpStr.length() != 0)
setSortType(new SelectedTag(tmpStr, TAGS_SORTTYPE));
else
setSortType(new SelectedTag(SORT_CASESENSITIVE, TAGS_SORTTYPE));
super.setOptions(options);
}
/**
* Sets the type of attribute to generate.
*
* @param value the attribute type
*/
public void setAttributeType(SelectedTag value) {
if (value.getTags() == TAGS_TYPE) {
m_AttributeType = value.getSelectedTag().getID();
}
}
/**
* Parses a given list of options.
*
* Valid options are:
* <p>
*
* -P <start set> <br>
* Specify a starting set of attributes. Eg 1,4,7-9.
* <p>
*
* -D <0 = forward selection | 1 = floating forward selection> <br>
* Forward selection method of the search. (default = 0).
* <p>
*
* -N <num> <br>
* Number of non improving nodes to consider before terminating search.
* (default = 5).
* <p>
*
* -I <br>
* Perform initial ranking to select top-ranked attributes.
* <p>
*
* -K <num> <br>
* Number of top-ranked attributes that are taken into account.
* <p>
*
* -T <0 = fixed-set | 1 = fixed-width> <br>
* Typ of Linear Forward Selection (default = 0).
* <p>
*
* -S <num> <br>
* Size of lookup cache for evaluated subsets. Expressed as a multiple of
* the number of attributes in the data set. (default = 1).
* <p>
*
* -Z <br>
* verbose on/off.
* <p>
*
* @param options
* the list of options as an array of strings
* @exception Exception
* if an option is not supported
*
*/
public void setOptions(String[] options) throws Exception {
String optionString;
resetOptions();
optionString = Utils.getOption('P', options);
if (optionString.length() != 0) {
setStartSet(optionString);
}
optionString = Utils.getOption('D', options);
if (optionString.length() != 0) {
setForwardSelectionMethod(new SelectedTag(Integer.parseInt(optionString),
TAGS_SEARCH_METHOD));
} else {
setForwardSelectionMethod(new SelectedTag(SEARCH_METHOD_FORWARD,
TAGS_SEARCH_METHOD));
}
optionString = Utils.getOption('N', options);
if (optionString.length() != 0) {
setSearchTermination(Integer.parseInt(optionString));
}
setPerformRanking(Utils.getFlag('I', options));
optionString = Utils.getOption('K', options);
if (optionString.length() != 0) {
setNumUsedAttributes(Integer.parseInt(optionString));
}
optionString = Utils.getOption('T', options);
if (optionString.length() != 0) {
setType(new SelectedTag(Integer.parseInt(optionString), TAGS_TYPE));
} else {
setType(new SelectedTag(TYPE_FIXED_SET, TAGS_TYPE));
}
optionString = Utils.getOption('S', options);
if (optionString.length() != 0) {
setLookupCacheSize(Integer.parseInt(optionString));
}
m_verbose = Utils.getFlag('Z', options);
}
/**
* Sets the type of algorithm to use
*
* @param value the algorithm type
*/
public void setAlgorithm(SelectedTag value) {
if (value.getTags() == TAGS_ALGORITHM) {
m_Algorithm = value.getSelectedTag().getID();
}
}
/**
* Set the kind of combination
*
* @param c the kind of combination of the search
*/
public void setCombination (SelectedTag c) {
if (c.getTags() == TAGS_SELECTION) {
m_typeOfCombination = c.getSelectedTag().getID();
}
}
/**
* Parses a given list of options.
* <p/>
*
<!-- options-start -->
* Valid options are:
* <p/>
*
* <pre>
* -S <num>
* Random number seed.
* (default 1)
* </pre>
*
* <pre>
* -B <classifier specification>
* Full class name of classifier to include, followed
* by scheme options. May be specified multiple times.
* (default: "weka.classifiers.rules.ZeroR")
* </pre>
*
* <pre>
* -D
* If set, classifier is run in debug mode and
* may output additional info to the console
* </pre>
*
* <pre>
* -P <path to serialized classifier>
* Full path to serialized classifier to include.
* May be specified multiple times to include
* multiple serialized classifiers. Note: it does
* not make sense to use pre-built classifiers in
* a cross-validation.
* </pre>
*
* <pre>
* -R <AVG|PROD|MAJ|MIN|MAX|MED>
* The combination rule to use
* (default: AVG)
* </pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
@Override
public void setOptions(String[] options) throws Exception {
String tmpStr;
tmpStr = Utils.getOption('R', options);
if (tmpStr.length() != 0)
setCombinationRule(new SelectedTag(tmpStr, TAGS_RULES));
else
setCombinationRule(new SelectedTag(AVERAGE_RULE, TAGS_RULES));
m_classifiersToLoad.clear();
while (true) {
String loadString = Utils.getOption('P', options);
if (loadString.length() == 0) {
break;
}
m_classifiersToLoad.add(loadString);
}
super.setOptions(options);
}
/**
* Parses a list of options for this object. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -h
* Prints this help.</pre>
*
* <pre> -o <file>
* The name of the output file, otherwise the generated data is
* printed to stdout.</pre>
*
* <pre> -r <name>
* The name of the relation.</pre>
*
* <pre> -d
* Whether to print debug informations.</pre>
*
* <pre> -S
* The seed for random function (default 1)</pre>
*
* <pre> -n <num>
* The number of examples to generate (default 100)</pre>
*
* <pre> -F <num>
* The function to use for generating the data. (default 1)</pre>
*
* <pre> -B
* Whether to balance the class.</pre>
*
* <pre> -P <num>
* The perturbation factor. (default 0.05)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String tmpStr;
super.setOptions(options);
tmpStr = Utils.getOption('F', options);
if (tmpStr.length() != 0)
setFunction(new SelectedTag(Integer.parseInt(tmpStr), FUNCTION_TAGS));
else
setFunction(defaultFunction());
setBalanceClass(Utils.getFlag('B', options));
tmpStr = Utils.getOption('P', options);
if (tmpStr.length() != 0)
setPerturbationFraction(Double.parseDouble(tmpStr));
else
setPerturbationFraction(defaultPerturbationFraction());
}
/**
* set quality measure to be used in searching for networks.
*
* @param newScoreType the new score type
*/
public void setScoreType(SelectedTag newScoreType) {
if (newScoreType.getTags() == TAGS_SCORE_TYPE) {
m_nScoreType = newScoreType.getSelectedTag().getID();
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -D
* Produce debugging output.
* (default no debugging output)</pre>
*
* <pre> -S <number of selection method>
* Set the attribute selection method to use. 1 = None, 2 = Greedy.
* (default 0 = M5' method)</pre>
*
* <pre> -C
* Do not try to eliminate colinear attributes.
* </pre>
*
* <pre> -R <double>
* Set ridge parameter (default 1.0e-8).
* </pre>
*
* <pre> -minimal
* Conserve memory, don't keep dataset header and means/stdevs.
* Model cannot be printed out if this option is enabled. (default: keep data)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String selectionString = Utils.getOption('S', options);
if (selectionString.length() != 0) {
setAttributeSelectionMethod(new SelectedTag(Integer
.parseInt(selectionString),
TAGS_SELECTION));
} else {
setAttributeSelectionMethod(new SelectedTag(SELECTION_M5,
TAGS_SELECTION));
}
String ridgeString = Utils.getOption('R', options);
if (ridgeString.length() != 0) {
setRidge(new Double(ridgeString).doubleValue());
} else {
setRidge(1.0e-8);
}
setDebug(Utils.getFlag('D', options));
setEliminateColinearAttributes(!Utils.getFlag('C', options));
setMinimal(Utils.getFlag("minimal", options));
}
/**
* Set the split criterion to use (either Gini or info gain).
*
* @param crit the criterion to use
*/
public void setSplitCriterion(SelectedTag crit) {
if (crit.getTags() == TAGS_SELECTION) {
m_selectedSplitMetric = crit.getSelectedTag().getID();
}
}
/**
* Sets how the training data will be transformed. Should be one of
* FILTER_NORMALIZE, FILTER_STANDARDIZE, FILTER_NONE.
*
* @param newType
* the new filtering mode
*/
public void setFilterType(SelectedTag newType) {
if (newType.getTags() == TAGS_FILTER) {
m_filterType = newType.getSelectedTag().getID();
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -D
* If set, classifier is run in debug mode and
* may output additional info to the console</pre>
*
* <pre> -C <double>
* The complexity constant C. (default 1)</pre>
*
* <pre> -N <default 0>
* Whether to 0=normalize/1=standardize/2=neither.
* (default: 0=normalize)</pre>
*
* <pre> -I <num>
* The maximum number of iterations to perform.
* (default: 500)</pre>
*
* <pre> -K <classname and parameters>
* The Kernel to use.
* (default: weka.classifiers.functions.supportVector.PolyKernel)</pre>
*
* <pre>
* Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
* </pre>
*
* <pre> -D
* Enables debugging output (if available) to be printed.
* (default: off)</pre>
*
* <pre> -no-checks
* Turns off all checks - use with caution!
* (default: checks on)</pre>
*
* <pre> -C <num>
* The size of the cache (a prime number), 0 for full cache and
* -1 to turn it off.
* (default: 250007)</pre>
*
* <pre> -E <num>
* The Exponent to use.
* (default: 1.0)</pre>
*
* <pre> -L
* Use lower-order terms.
* (default: no)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String tmpStr;
String[] tmpOptions;
tmpStr = Utils.getOption('C', options);
if (tmpStr.length() != 0)
setC(Double.parseDouble(tmpStr));
else
setC(1.0);
tmpStr = Utils.getOption('N', options);
if (tmpStr.length() != 0)
setFilterType(new SelectedTag(Integer.parseInt(tmpStr), TAGS_FILTER));
else
setFilterType(new SelectedTag(FILTER_NORMALIZE, TAGS_FILTER));
tmpStr = Utils.getOption('I', options);
if (tmpStr.length() != 0)
setMaxIterations(Integer.parseInt(tmpStr));
else
setMaxIterations(500);
tmpStr = Utils.getOption('K', options);
tmpOptions = Utils.splitOptions(tmpStr);
if (tmpOptions.length != 0) {
tmpStr = tmpOptions[0];
tmpOptions[0] = "";
setKernel(Kernel.forName(tmpStr, tmpOptions));
}
super.setOptions(options);
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -A <num>
* The type of weight setting for each prop. instance:
* 0.weight = original single bag weight /Total number of
* prop. instance in the corresponding bag;
* 1.weight = 1.0;
* 2.weight = 1.0/Total number of prop. instance in the
* corresponding bag;
* 3. weight = Total number of prop. instance / (Total number
* of bags * Total number of prop. instance in the
* corresponding bag).
* (default:0)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
String weightString = Utils.getOption('A', options);
if (weightString.length() != 0) {
setWeightMethod(
new SelectedTag(Integer.parseInt(weightString), TAGS_WEIGHTMETHOD));
} else {
setWeightMethod(
new SelectedTag(WEIGHTMETHOD_INVERSE2, TAGS_WEIGHTMETHOD));
}
}
/**
* Parses a given list of options. <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -D
* Turn on debugging output.</pre>
*
* <pre> -N <num>
* Whether to 0=normalize/1=standardize/2=neither.
* (default 1=standardize)</pre>
*
<!-- options-end -->
*
* @param options the list of options as an array of strings
* @throws Exception if an option is not supported
*/
public void setOptions(String[] options) throws Exception {
setDebug(Utils.getFlag('D', options));
String nString = Utils.getOption('N', options);
if (nString.length() != 0) {
setFilterType(new SelectedTag(Integer.parseInt(nString), TAGS_FILTER));
} else {
setFilterType(new SelectedTag(FILTER_STANDARDIZE, TAGS_FILTER));
}
}