weka.core.Utils.getFlag()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中weka.core.Utils.getFlag()方法的一些代码示例,展示了Utils.getFlag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getFlag()方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:getFlag

Utils.getFlag介绍

[英]Checks if the given array contains the flag "-Char". Stops searching at the first marker "--". If the flag is found, it is replaced with the empty string.
[中]检查给定数组是否包含标志“-Char”。停止搜索第一个标记“-”。如果找到该标志,则将其替换为空字符串。

代码示例

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
public void setOptions(String[] options) throws Exception {
 m_encodeMissingAsZero = Utils.getFlag('M', options);
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: net.sf.meka/meka

/**
 * Parses a given list of options.
 *
 * @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;
  setSkipTitle(Utils.getFlag("skip-title", options));
  value = Utils.getOption("W", options);
  if (value.isEmpty())
    throw new Exception("No classname provided!");
  setClassname(value);
  super.setOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Parses a given list of options.
 * <p/>
 * 
 * Valid options are:
 * <p>
 * 
 * -U <br>
 * Use unsmoothed predictions.
 * <p>
 * 
 * -R <br>
 * Build a regression tree rather than a model tree.
 * <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 {
 setUnpruned(Utils.getFlag('N', options));
 setUseUnsmoothed(Utils.getFlag('U', options));
 setBuildRegressionTree(Utils.getFlag('R', options));
 String optionString = Utils.getOption('M', options);
 if (optionString.length() != 0) {
  setMinNumInstances((new Double(optionString)).doubleValue());
 }
 super.setOptions(options);
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

public void setOptions(String[] options) throws Exception {
 setUseConjugateGradientDescent(Utils.getFlag('C', options));
 String ridgeString = Utils.getOption('R', options);
 if (ridgeString.length() != 0) {
  m_Ridge = Double.parseDouble(ridgeString);
 String maxItsString = Utils.getOption('M', options);
 if (maxItsString.length() != 0) {
  m_MaxIts = Integer.parseInt(maxItsString);
 Utils.checkForRemainingOptions(options);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Parses a given list of options.
 * 
 * @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 optionString = Utils.getOption('N', options);
 if (optionString.length() != 0) {
  setMaxInstancesInLeaf(Integer.parseInt(optionString));
 } else {
  setMaxInstancesInLeaf(40);
 }
 setContainChildBalls(Utils.getFlag('R', options));
}

代码示例来源:origin: Waikato/weka-trunk

@Override
public void setOptions(String[] options) throws Exception {
 m_encodeMissingAsZero = Utils.getFlag('M', options);
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * Parses a given list of options.
 * <p/>
 * 
 * Valid options are:
 * <p>
 * 
 * -U <br>
 * Use unsmoothed predictions.
 * <p>
 * 
 * -R <br>
 * Build a regression tree rather than a model tree.
 * <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 {
 setUnpruned(Utils.getFlag('N', options));
 setUseUnsmoothed(Utils.getFlag('U', options));
 setBuildRegressionTree(Utils.getFlag('R', options));
 String optionString = Utils.getOption('M', options);
 if (optionString.length() != 0) {
  setMinNumInstances((new Double(optionString)).doubleValue());
 }
 super.setOptions(options);
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Parses a given list of options.
 * 
 * @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;
 setDontNormalize(Utils.getFlag('D', options));
 tmpStr = Utils.getOption('R', options);
 if (tmpStr.length() != 0) {
  setAttributeIndices(tmpStr);
 } else {
  setAttributeIndices("first-last");
 }
 setInvertSelection(Utils.getFlag('V', options));
}

代码示例来源:origin: com.github.fracpete/multisearch-weka-package

/**
 * Parses the options for this object.
 *
 * @param options    the options to use
 * @throws Exception    if setting of options fails
 */
@Override
public void setOptions(String[] options) throws Exception {
 setDebug(Utils.getFlag("D", options));
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: Waikato/weka-trunk

public void setOptions(String[] options) throws Exception {
 setUseConjugateGradientDescent(Utils.getFlag('C', options));
 String ridgeString = Utils.getOption('R', options);
 if (ridgeString.length() != 0) {
  m_Ridge = Double.parseDouble(ridgeString);
 String maxItsString = Utils.getOption('M', options);
 if (maxItsString.length() != 0) {
  m_MaxIts = Integer.parseInt(maxItsString);
 Utils.checkForRemainingOptions(options);

代码示例来源:origin: Waikato/meka

/**
 * Parses a given list of options.
 *
 * @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;
  setSkipTitle(Utils.getFlag("skip-title", options));
  value = Utils.getOption("W", options);
  if (value.isEmpty())
    throw new Exception("No classname provided!");
  setClassname(value);
  super.setOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Parses a given list of options.
 * <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 {
 Option.setOptionsForHierarchy(options, this, Kernel.class);
 setDebug(Utils.getFlag("output-debug-info", options));
 // This one does nothing but remains for backwards compatibility
 setChecksTurnedOff(Utils.getFlag("no-checks", options));
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

String atts = Utils.getOption('R', options);
if (atts.length() > 0) {
 setSelectedAttributes(atts);
String replacements = Utils.getOption('N', options);
if (replacements.length() > 0) {
 setValueReplacements(replacements);
setInvertSelection(Utils.getFlag('V', options));
setIgnoreCase(Utils.getFlag('I', options));
Utils.checkForRemainingOptions(options);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Parses a given list of options.
 * 
 * @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('W', options);
 if (tmpStr.length() > 0) {
  setClassname(tmpStr);
 } else {
  setClassname(this.getClass().getName());
 }
 setUseStars(!Utils.getFlag("nostars", options));
 setDir(Utils.getOption("dir", options));
 setSilent(Utils.getFlag("silent", options));
}

代码示例来源:origin: Waikato/weka-trunk

/**
 * Parses a given list of options.
 * <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 {
 Option.setOptionsForHierarchy(options, this, Kernel.class);
 setDebug(Utils.getFlag("output-debug-info", options));
 // This one does nothing but remains for backwards compatibility
 setChecksTurnedOff(Utils.getFlag("no-checks", options));
 Utils.checkForRemainingOptions(options);
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

String optionString = Utils.getOption('S', options);
if (optionString.length() != 0) {
 Double temp = Double.valueOf(optionString);
 setShrinkage(temp.doubleValue());
setMinimizeAbsoluteError(Utils.getFlag('A', options));
Utils.checkForRemainingOptions(options);

代码示例来源:origin: Waikato/weka-trunk

/**
 * Parses a given list of options.
 * 
 * @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 optionString = Utils.getOption('N', options);
 if (optionString.length() != 0) {
  setMaxInstancesInLeaf(Integer.parseInt(optionString));
 } else {
  setMaxInstancesInLeaf(40);
 }
 setContainChildBalls(Utils.getFlag('R', options));
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override public void run(Object toRun, String[] options) throws Exception {
 if (!(toRun instanceof ListOptions)) {
  throw new IllegalArgumentException("Object to run is not an instance "
   + "of ListOptions!");
 }
 ListOptions list = (ListOptions) toRun;
 try {
  try {
   if (Utils.getFlag('h', options)) {
    throw new Exception("Help requested");
   }
   list.setOptions(options);
   Utils.checkForRemainingOptions(options);
  } catch (Exception ex) {
   String result = "\n" + ex.getMessage() + "\n\n" + list.generateHelp();
   throw new Exception(result);
  }
  System.out.println("\n" + list.generate());
 } catch (Exception ex) {
  System.err.println(ex.getMessage());
 }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

public void setOptions(String[] options) throws Exception {
 setCompressOutput(Utils.getFlag("compress", options));
 String tmpStr = Utils.getOption("decimal", options);
 if (tmpStr.length() > 0) {
  setMaxDecimalPlaces(Integer.parseInt(tmpStr));
 Utils.checkForRemainingOptions(options);

代码示例来源:origin: Waikato/weka-trunk

/**
 * Parses a given list of options.
 * 
 * @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;
 setDontNormalize(Utils.getFlag('D', options));
 tmpStr = Utils.getOption('R', options);
 if (tmpStr.length() != 0) {
  setAttributeIndices(tmpStr);
 } else {
  setAttributeIndices("first-last");
 }
 setInvertSelection(Utils.getFlag('V', options));
}

相关文章