本文整理汇总了Java中weka.core.Utils.getOption方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getOption方法的具体用法?Java Utils.getOption怎么用?Java Utils.getOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Utils
的用法示例。
在下文中一共展示了Utils.getOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options. Valid options are:
* <p>
*
* -W classname <br>
* Specify the full class name of the clusterer to evaluate.
* <p>
*
* All option after -- will be passed to the classifier.
*
* @param options the list of options as an array of strings
* @exception Exception if an option is not supported
*/
@Override
public void setOptions(String[] options) throws Exception {
m_NoSizeDetermination = Utils.getFlag("no-size", options);
String cName = Utils.getOption('W', options);
if (cName.length() == 0) {
throw new Exception("A clusterer must be specified with"
+ " the -W option.");
}
// Do it first without options, so if an exception is thrown during
// the option setting, listOptions will contain options for the actual
// Classifier.
setClusterer((DensityBasedClusterer) AbstractClusterer.forName(cName, null));
if (getClusterer() instanceof OptionHandler) {
((OptionHandler) getClusterer()).setOptions(Utils
.partitionOptions(options));
updateOptions();
}
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:33,代码来源:DensityBasedClustererSplitEvaluator.java
示例2: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -C <index>
* Specify where to insert the ID. First and last
* are valid indexes.(default first)
* </pre>
*
* <pre>
* -N <name>
* Name of the new attribute.
* (default = 'ID')
* </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('C', options);
if (tmpStr.length() != 0) {
m_Index.setSingleIndex(tmpStr);
} else {
m_Index.setSingleIndex("first");
}
tmpStr = Utils.getOption('N', options);
if (tmpStr.length() != 0) {
m_Name = tmpStr;
} else {
m_Name = "ID";
}
if (getInputFormat() != null) {
setInputFormat(getInputFormat());
}
Utils.checkForRemainingOptions(options);
}
示例3: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Set the options for this filter
*
* @param options the options
* @throws Exception if a problem occurs
*/
public void setOptions(String[] options) throws Exception {
String filterSpec = Utils.getOption("filter", options);
if (!DistributedJobConfig.isEmpty(filterSpec)) {
String[] spec = Utils.splitOptions(filterSpec);
String filterClass = spec[0];
spec[0] = "";
Filter base = (Filter) Class.forName(filterClass).newInstance();
if (base instanceof OptionHandler) {
((OptionHandler) base).setOptions(spec);
}
setBaseFilter(base);
}
}
示例4: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
@Override
public void setOptions(String[] options) throws Exception {
m_mrConfig.setOptions(options);
String wekaPath = Utils.getOption("weka-jar", options);
if (!DistributedJobConfig.isEmpty(wekaPath)) {
setPathToWekaJar(wekaPath);
}
String additionalPackages = Utils.getOption("weka-packages", options);
setAdditionalWekaPackages(additionalPackages);
String logInt = Utils.getOption("logging-interval", options);
setLoggingInterval(logInt);
setDebug(Utils.getFlag("debug", options));
}
示例5: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
@Override
public void setOptions(String[] options) throws Exception {
super.setOptions(options);
String host = Utils.getOption("hdfs-host", options);
if (!isEmpty(host)) {
setHDFSHost(host);
} else {
setHDFSHost(DEFAULT_HOST);
}
String port = Utils.getOption("hdfs-port", options);
if (!isEmpty(port)) {
setHDFSPort(port);
} else {
setHDFSPort(DEFAULT_PORT);
}
}
示例6: main
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Main method.
*
* @param args the commandline options
*/
public static void main(String[] args) {
try {
String[] argsCopy = args.clone();
if (Utils.getFlag('h', argsCopy) || Utils.getFlag("help", argsCopy)) {
runAssociator(new FPGrowth(), args);
System.out
.println("-disk\n\tProcess data off of disk instead of loading\n\t"
+ "into main memory. This is a command line only option.");
return;
}
if (!Utils.getFlag("disk", args)) {
runAssociator(new FPGrowth(), args);
} else {
String filename;
filename = Utils.getOption('t', args);
weka.core.converters.ArffLoader loader = null;
if (filename.length() != 0) {
loader = new weka.core.converters.ArffLoader();
loader.setFile(new java.io.File(filename));
} else {
throw new Exception("No training file specified!");
}
FPGrowth fpGrowth = new FPGrowth();
fpGrowth.setOptions(args);
Utils.checkForRemainingOptions(args);
fpGrowth.buildAssociations(loader);
System.out.print(fpGrowth.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例7: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -C <col>
* Sets the attribute index
* (default: last)
* </pre>
*
* <pre>
* -L <label>
* Sets the label of the newly merged classes
* (default: 'merged')
* </pre>
*
* <pre>
* -R <range>
* Sets the merge range. 'first and 'last' are accepted as well.'
* E.g.: first-5,7,9,20-last
* (default: 1,2)
* </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 = Utils.getOption('C', options);
if (tmpStr.length() != 0) {
setAttributeIndex(tmpStr);
} else {
setAttributeIndex("last");
}
tmpStr = Utils.getOption('L', options);
if (tmpStr.length() != 0) {
setLabel(tmpStr);
} else {
setLabel("merged");
}
tmpStr = Utils.getOption('R', options);
if (tmpStr.length() != 0) {
setMergeValueRange(tmpStr);
} else {
setMergeValueRange("1,2");
}
if (getInputFormat() != null) {
setInputFormat(getInputFormat());
}
super.setOptions(options);
Utils.checkForRemainingOptions(options);
}
示例8: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
@Override
public void setOptions(String[] options) throws Exception {
setRunPCA(Utils.getFlag("pca", options));
String numNodes = Utils.getOption("num-nodes", options);
setNumNodesInCluster(numNodes);
String className = Utils.getOption("class", options);
setClassAttribute(className);
String[] optionsCopy = options.clone();
// set general hadoop connection/config opts for our job
super.setOptions(options);
// options for the ARFF header job
String sArffOpts = Utils.joinOptions(optionsCopy);
if (!sArffOpts.contains("-summary-stats")) {
// make sure we generate summary stats!!
sArffOpts += " -summary-stats";
optionsCopy = Utils.splitOptions(sArffOpts);
}
m_arffHeaderJob.setOptions(optionsCopy);
String optsToCSVTask = Utils.joinOptions(m_arffHeaderJob.getOptions());
if (!DistributedJobConfig.isEmpty(optsToCSVTask)) {
setCSVMapTaskOptions(optsToCSVTask);
}
// options to the Correlation task
CorrelationMatrixMapTask correlationTemp = new CorrelationMatrixMapTask();
correlationTemp.setOptions(options);
String optsToCorrTask = Utils.joinOptions(correlationTemp.getOptions());
if (!DistributedJobConfig.isEmpty(optsToCorrTask)) {
setCorrelationMapTaskOptions(optsToCorrTask);
}
}
示例9: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Sets the options.
*
* @param options the options
* @throws Exception if invalid option
*/
@Override
public void setOptions(String[] options) throws Exception {
String tmpStr;
super.setOptions(options);
tmpStr = Utils.getOption('a', options);
if (tmpStr.length() != 0) {
setNumAttributes(Integer.parseInt(tmpStr));
} else {
setNumAttributes(defaultNumAttributes());
}
setClassFlag(Utils.getFlag('c', options));
tmpStr = Utils.getOption('b', options);
setBooleanIndices(tmpStr);
m_booleanCols.setUpper(getNumAttributes());
tmpStr = Utils.getOption('m', options);
setNominalIndices(tmpStr);
m_nominalCols.setUpper(getNumAttributes());
// check indices
tmpStr = checkIndices();
if (tmpStr.length() > 0) {
throw new IllegalArgumentException(tmpStr);
}
}
示例10: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a list of options for this object.
* <p/>
*
* For list of valid options see class description.
* <p/>
*
* @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;
// remove unwanted options
options = removeBlacklist(options);
tmpStr = Utils.getOption('r', options);
if (tmpStr.length() != 0) {
setRelationName(Utils.unquote(tmpStr));
} else {
setRelationName("");
}
tmpStr = Utils.getOption('o', options);
if (tmpStr.length() != 0) {
setOutput(new PrintWriter(new FileOutputStream(tmpStr)));
} else if (getOutput() == null) {
throw new Exception("No Output defined!");
}
setDebug(Utils.getFlag('d', options));
tmpStr = Utils.getOption('S', options);
if (tmpStr.length() != 0) {
setSeed(Integer.parseInt(tmpStr));
} else {
setSeed(defaultSeed());
}
}
示例11: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -S <seed>
* Random number seed for cross validation
* (default = 1)
* </pre>
*
* <pre>
* -F <folds>
* Number of folds for cross validation
* (default = 10)
* </pre>
*
* <pre>
* -D
* Use training data for evaluation rather than cross validaton
* </pre>
*
* <pre>
* -B <minimum bucket size>
* Minimum number of objects in a bucket
* (passed on to OneR, default = 6)
* </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 temp = Utils.getOption('S', options);
if (temp.length() != 0) {
setSeed(Integer.parseInt(temp));
}
temp = Utils.getOption('F', options);
if (temp.length() != 0) {
setFolds(Integer.parseInt(temp));
}
temp = Utils.getOption('B', options);
if (temp.length() != 0) {
setMinimumBucketSize(Integer.parseInt(temp));
}
setEvalUsingTrainingData(Utils.getFlag('D', options));
Utils.checkForRemainingOptions(options);
}
示例12: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -N
* Initial structure is empty (instead of Naive Bayes)
* </pre>
*
* <pre>
* -P <nr of parents>
* Maximum number of parents
* </pre>
*
* <pre>
* -R
* Random order.
* (default false)
* </pre>
*
* <pre>
* -mbc
* Applies a Markov Blanket correction to the network structure,
* after a network structure is learned. This ensures that all
* nodes in the network are part of the Markov blanket of the
* classifier node.
* </pre>
*
* <pre>
* -S [LOO-CV|k-Fold-CV|Cumulative-CV]
* Score type (LOO-CV,k-Fold-CV,Cumulative-CV)
* </pre>
*
* <pre>
* -Q
* Use probabilistic or 0/1 scoring.
* (default probabilistic scoring)
* </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 {
setRandomOrder(Utils.getFlag('R', options));
m_bInitAsNaiveBayes = !(Utils.getFlag('N', options));
String sMaxNrOfParents = Utils.getOption('P', options);
if (sMaxNrOfParents.length() != 0) {
setMaxNrOfParents(Integer.parseInt(sMaxNrOfParents));
} else {
setMaxNrOfParents(100000);
}
super.setOptions(options);
}
示例13: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
<!-- options-start -->
* Valid options are: <p/>
*
* <pre> -N <double>
* The number of attributes to randomly select.
* If < 1 then percentage, >= 1 absolute number.
* (default: 0.5)</pre>
*
* <pre> -V
* Invert selection - i.e. randomly remove rather than select.</pre>
*
* <pre> -S <int>
* The seed value.
* (default: 1)</pre>
*
* <pre> -output-debug-info
* If set, filter is run in debug mode and
* may output additional info to the console</pre>
*
* <pre> -do-not-check-capabilities
* If set, filter capabilities are not checked before filter is built
* (use with caution).</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("N", options);
if (tmpStr.length() != 0) {
setNumAttributes(Double.parseDouble(tmpStr));
} else {
setNumAttributes(0.5);
}
setInvertSelection(Utils.getFlag('V', options));
tmpStr = Utils.getOption("S", options);
if (tmpStr.length() != 0) {
setSeed(Integer.parseInt(tmpStr));
} else {
setSeed(1);
}
super.setOptions(options);
}
示例14: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -R <index1,index2-index4,...>
* Specify list of columns to take the differences between.
* First and last are valid indexes.
* (default none)
* </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 deltaList = Utils.getOption('R', options);
if (deltaList.length() != 0) {
setAttributeIndices(deltaList);
} else {
setAttributeIndices("");
}
if (getInputFormat() != null) {
setInputFormat(getInputFormat());
}
Utils.checkForRemainingOptions(options);
}
示例15: setOptions
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Parses a given list of options.
* <p/>
*
* <!-- options-start --> Valid options are:
* <p/>
*
* <pre>
* -delimiters <value>
* The delimiters to use
* (default ' \r\n\t.,;:'"()?!').
* </pre>
*
* <pre>
* -max <int>
* The max size of the Ngram (default = 3).
* </pre>
*
* <pre>
* -min <int>
* The min size of the Ngram (default = 1).
* </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 value;
value = Utils.getOption("max", options);
if (value.length() != 0) {
setNGramMaxSize(Integer.parseInt(value));
} else {
setNGramMaxSize(3);
}
value = Utils.getOption("min", options);
if (value.length() != 0) {
setNGramMinSize(Integer.parseInt(value));
} else {
setNGramMinSize(1);
}
super.setOptions(options);
}