Java Code Examples for weka.core.Utils#getOption()

The following examples show how to use weka.core.Utils#getOption() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RISE.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
* Parses a given list of options to set the parameters of the classifier.
* We use this for the tuning mechanism, setting parameters through setOptions
<!-- options-start -->
* Valid options are: <p/>
* <pre> -K
* Number of base classifiers.
* </pre>
* <pre> -I
* min Interval, integer, should be in range 3 to m-MINa check in build classifier is made to see if if.
* </pre>
* <pre> -T
     transforms, a space separated list.
* </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 numCls=Utils.getOption('K', options);
     if (numCls.length() != 0)
         numBaseClassifiers = Integer.parseInt(numCls);
     else
         numBaseClassifiers = DEFAULT_NUM_CLASSIFIERS;
 /** Minimum size of all intervals */
     String minInt=Utils.getOption('I', options);
     if (minInt.length() != 0)
         minInterval=Integer.parseInt(minInt);
 /** Transforms to use */

     String trans=Utils.getOption('T', options);
     if(trans.length()!=0){
         String[] t= trans.split(" ");
 //NEED TO CHECK THIS WORKS
         setTransforms(t);
     }
 }
 
Example 2
Source File: BallTree.java    From tsml with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Parses a given list of options.
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -C &lt;classname and options&gt;
 *  The construction method to employ. Either TopDown or BottomUp
 *  (default: weka.core.TopDownConstructor)</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 {

  super.setOptions(options);

  String optionString = Utils.getOption('C', options);
  if(optionString.length() != 0) {
    String constructorSpec[] = Utils.splitOptions(optionString);
    if(constructorSpec.length == 0) { 
      throw new Exception("Invalid BallTreeConstructor specification string."); 
    }
    String className = constructorSpec[0];
    constructorSpec[0] = "";

    setBallTreeConstructor( (BallTreeConstructor)
                          Utils.forName( BallTreeConstructor.class, 
                                         className, constructorSpec) );
  }
  else {
    setBallTreeConstructor(new TopDownConstructor());  
  }
}
 
Example 3
Source File: DMNBtext.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
public void setOptions(String[] options) throws Exception {

    String iterations = Utils.getOption('I', options);
    if (iterations.length() != 0) {
      setNumIterations(Integer.parseInt(iterations));
    }
    
    setMultinomialWord(Utils.getFlag('M', options));    
  }
 
Example 4
Source File: Resample.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -S &lt;num&gt;
 *  Specify the random number seed (default 1)</pre>
 * 
 * <pre> -Z &lt;num&gt;
 *  The size of the output dataset, as a percentage of
 *  the input dataset (default 100)</pre>
 * 
 * <pre> -B &lt;num&gt;
 *  Bias factor towards uniform class distribution.
 *  0 = distribution in input data -- 1 = uniform distribution.
 *  (default 0)</pre>
 * 
 * <pre> -no-replacement
 *  Disables replacement of instances
 *  (default: with replacement)</pre>
 * 
 * <pre> -V
 *  Inverts the selection - only available with '-no-replacement'.</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('S', options);
  if (tmpStr.length() != 0)
    setRandomSeed(Integer.parseInt(tmpStr));
  else
    setRandomSeed(1);

  tmpStr = Utils.getOption('B', options);
  if (tmpStr.length() != 0)
    setBiasToUniformClass(Double.parseDouble(tmpStr));
  else
    setBiasToUniformClass(0);

  tmpStr = Utils.getOption('Z', options);
  if (tmpStr.length() != 0)
    setSampleSizePercent(Double.parseDouble(tmpStr));
  else
    setSampleSizePercent(100);

  setNoReplacement(Utils.getFlag("no-replacement", options));

  if (getNoReplacement())
    setInvertSelection(Utils.getFlag('V', options));

  if (getInputFormat() != null) {
    setInputFormat(getInputFormat());
  }
}
 
Example 5
Source File: BayesNet.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parses a given list of options. <p>
 * 
   <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -D
 *  Do not use ADTree data structure
 * </pre>
 * 
 * <pre> -B &lt;BIF file&gt;
 *  BIF file to compare with
 * </pre>
 * 
 * <pre> -Q weka.classifiers.bayes.net.search.SearchAlgorithm
 *  Search algorithm
 * </pre>
 * 
 * <pre> -E weka.classifiers.bayes.net.estimate.SimpleEstimator
 *  Estimator algorithm
 * </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 {
  m_bUseADTree = !(Utils.getFlag('D', options));

  String sBIFFile = Utils.getOption('B', options);
  if (sBIFFile != null && !sBIFFile.equals("")) {
    setBIFFile(sBIFFile);
  }

  String searchAlgorithmName = Utils.getOption('Q', options);
  if (searchAlgorithmName.length() != 0) {
    setSearchAlgorithm(
 (SearchAlgorithm) Utils.forName(
     SearchAlgorithm.class,
     searchAlgorithmName,
     partitionOptions(options)));
  }
  else {
    setSearchAlgorithm(new K2());
  }


  String estimatorName = Utils.getOption('E', options);
  if (estimatorName.length() != 0) {
    setEstimator(
 (BayesNetEstimator) Utils.forName(
     BayesNetEstimator.class,
     estimatorName,
     Utils.partitionOptions(options)));
  }
  else {
    setEstimator(new SimpleEstimator());
  }

  Utils.checkForRemainingOptions(options);
}
 
Example 6
Source File: Stacking.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Process options setting meta classifier.
 * 
 * @param options the options to parse
 * @throws Exception if the parsing fails
 */
protected void processMetaOptions(String[] options) throws Exception {

  String classifierString = Utils.getOption('M', options);
  String [] classifierSpec = Utils.splitOptions(classifierString);
  String classifierName;
  if (classifierSpec.length == 0) {
    classifierName = "weka.classifiers.rules.ZeroR";
  } else {
    classifierName = classifierSpec[0];
    classifierSpec[0] = "";
  }
  setMetaClassifier(AbstractClassifier.forName(classifierName, classifierSpec));
}
 
Example 7
Source File: ARMA.java    From tsml with GNU General Public License v3.0 5 votes vote down vote up
public void setOptions(String[] options) throws Exception {
    String maxLagString=Utils.getOption('L', options);
    if (maxLagString.length() != 0)
        this.maxLag = Integer.parseInt(maxLagString);
    else
        this.maxLag = globalMaxLag;
}
 
Example 8
Source File: CSVSaver.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/** 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -F &lt;separator&gt;
 *  The field separator to be used.
 *  '\t' can be used as well.
 *  (default: ',')</pre>
 * 
 * <pre> -M &lt;str&gt;
 *  The string representing a missing value.
 *  (default: ?)</pre>
 * 
 * <pre> -N
 *  Don't write a header row.</pre>
 * 
 * <pre> -decimal &lt;num&gt;
 *  The maximum number of digits to print after the decimal
 *  place for numeric values (default: 6)</pre>
 * 
 * <pre> -i &lt;the input file&gt;
 *  The input file</pre>
 * 
 * <pre> -o &lt;the output file&gt;
 *  The output file</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('F', options);
  if (tmpStr.length() != 0)
    setFieldSeparator(tmpStr);
  else
    setFieldSeparator(",");

  tmpStr = Utils.getOption('M', options);
  if (tmpStr.length() != 0)
    setMissingValue(tmpStr);
  else
    setMissingValue("?");
  
  setNoHeaderRow(Utils.getFlag('N', options));

  tmpStr = Utils.getOption("decimal", options);
  if (tmpStr.length() > 0) {
    setMaxDecimalPlaces(Integer.parseInt(tmpStr));
  }

  super.setOptions(options);
}
 
Example 9
Source File: SimulatedAnnealing.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -A &lt;float&gt;
 *  Start temperature</pre>
 * 
 * <pre> -U &lt;integer&gt;
 *  Number of runs</pre>
 * 
 * <pre> -D &lt;float&gt;
 *  Delta temperature</pre>
 * 
 * <pre> -R &lt;seed&gt;
 *  Random number seed</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 [BAYES|MDL|ENTROPY|AIC|CROSS_CLASSIC|CROSS_BAYES]
 *  Score type (BAYES, BDeu, MDL, ENTROPY and AIC)</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 sTStart = Utils.getOption('A', options);
	if (sTStart.length() != 0) {
		setTStart(Double.parseDouble(sTStart));
	}
	String sRuns = Utils.getOption('U', options);
	if (sRuns.length() != 0) {
		setRuns(Integer.parseInt(sRuns));
	}
	String sDelta = Utils.getOption('D', options);
	if (sDelta.length() != 0) {
		setDelta(Double.parseDouble(sDelta));
	}
	String sSeed = Utils.getOption('R', options);
	if (sSeed.length() != 0) {
		setSeed(Integer.parseInt(sSeed));
	}
	super.setOptions(options);
}
 
Example 10
Source File: PredictiveApriori.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -N &lt;required number of rules output&gt;
 *  The required number of rules. (default = 100)</pre>
 * 
 * <pre> -A
 *  If set class association rules are mined. (default = no)</pre>
 * 
 * <pre> -c &lt;the class index&gt;
 *  The class index. (default = last)</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 {
  
  resetOptions();
  
  String numRulesString = Utils.getOption('N', options);
  if (numRulesString.length() != 0) 
    m_numRules = Integer.parseInt(numRulesString)+5;
  else
    m_numRules = Integer.MAX_VALUE;

  String classIndexString = Utils.getOption('c',options);
  if (classIndexString.length() != 0) 
    m_classIndex = Integer.parseInt(classIndexString);

  m_car = Utils.getFlag('A', options);
}
 
Example 11
Source File: ClassOrder.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -R &lt;seed&gt;
 *  Specify the seed of randomization
 *  used to randomize the class
 *  order (default: 1)</pre>
 * 
 * <pre> -C &lt;order&gt;
 *  Specify the class order to be
 *  sorted, could be 0: ascending
 *  1: descending and 2: random.(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 seedString = Utils.getOption('R', options);
  if (seedString.length() != 0)
    m_Seed = Long.parseLong(seedString);
  else 
    m_Seed = 1;  
	
  String orderString = Utils.getOption('C', options);
  if (orderString.length() != 0)
    m_ClassOrder = Integer.parseInt(orderString);
  else 
    m_ClassOrder = FREQ_ASCEND;   	
	
  if (getInputFormat() != null)
    setInputFormat(getInputFormat()); 	
	
  m_Random = null;
}
 
Example 12
Source File: AddValues.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -C &lt;col&gt;
 *  Sets the attribute index
 *  (default last).</pre>
 * 
 * <pre> -L &lt;label1,label2,...&gt;
 *  Comma-separated list of labels to add.
 *  (default: none)</pre>
 * 
 * <pre> -S
 *  Turns on the sorting of the labels.</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('C', options);
  if (tmpStr.length() != 0)
    setAttributeIndex(tmpStr);
  else
    setAttributeIndex("last");

  tmpStr = Utils.getOption('L', options);
  if (tmpStr.length() != 0)
    setLabels(tmpStr);
  else
    setLabels("");

  setSort(Utils.getFlag('S', options));
 
  if (getInputFormat() != null)
    setInputFormat(getInputFormat());
}
 
Example 13
Source File: IBk.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -I
 *  Weight neighbours by the inverse of their distance
 *  (use when k &gt; 1)</pre>
 * 
 * <pre> -F
 *  Weight neighbours by 1 - their distance
 *  (use when k &gt; 1)</pre>
 * 
 * <pre> -K &lt;number of neighbors&gt;
 *  Number of nearest neighbours (k) used in classification.
 *  (Default = 1)</pre>
 * 
 * <pre> -E
 *  Minimise mean squared error rather than mean absolute
 *  error when using -X option with numeric prediction.</pre>
 * 
 * <pre> -W &lt;window size&gt;
 *  Maximum number of training instances maintained.
 *  Training instances are dropped FIFO. (Default = no window)</pre>
 * 
 * <pre> -X
 *  Select the number of nearest neighbours between 1
 *  and the k value specified using hold-one-out evaluation
 *  on the training data (use when k &gt; 1)</pre>
 * 
 * <pre> -A
 *  The nearest neighbour search algorithm to use (default: weka.core.neighboursearch.LinearNNSearch).
 * </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 knnString = Utils.getOption('K', options);
  if (knnString.length() != 0) {
    setKNN(Integer.parseInt(knnString));
  } else {
    setKNN(1);
  }
  String windowString = Utils.getOption('W', options);
  if (windowString.length() != 0) {
    setWindowSize(Integer.parseInt(windowString));
  } else {
    setWindowSize(0);
  }
  if (Utils.getFlag('I', options)) {
    setDistanceWeighting(new SelectedTag(WEIGHT_INVERSE, TAGS_WEIGHTING));
  } else if (Utils.getFlag('F', options)) {
    setDistanceWeighting(new SelectedTag(WEIGHT_SIMILARITY, TAGS_WEIGHTING));
  } else {
    setDistanceWeighting(new SelectedTag(WEIGHT_NONE, TAGS_WEIGHTING));
  }
  setCrossValidate(Utils.getFlag('X', options));
  setMeanSquared(Utils.getFlag('E', options));

  String nnSearchClass = Utils.getOption('A', options);
  if(nnSearchClass.length() != 0) {
    String nnSearchClassSpec[] = Utils.splitOptions(nnSearchClass);
    if(nnSearchClassSpec.length == 0) { 
      throw new Exception("Invalid NearestNeighbourSearch algorithm " +
                          "specification string."); 
    }
    String className = nnSearchClassSpec[0];
    nnSearchClassSpec[0] = "";

    setNearestNeighbourSearchAlgorithm( (NearestNeighbourSearch)
                Utils.forName( NearestNeighbourSearch.class, 
                               className, 
                               nnSearchClassSpec)
                                      );
  }
  else 
    this.setNearestNeighbourSearchAlgorithm(new LinearNNSearch());
  
  Utils.checkForRemainingOptions(options);
}
 
Example 14
Source File: CVParameterSelection.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
  * Parses a given list of options. <p/>
  *
  <!-- options-start -->
  * Valid options are: <p/>
  * 
  * <pre> -X &lt;number of folds&gt;
  *  Number of folds used for cross validation (default 10).</pre>
  * 
  * <pre> -P &lt;classifier parameter&gt;
  *  Classifier parameter options.
  *  eg: "N 1 5 10" Sets an optimisation parameter for the
  *  classifier with name -N, with lower bound 1, upper bound
  *  5, and 10 optimisation steps. The upper bound may be the
  *  character 'A' or 'I' to substitute the number of
  *  attributes or instances in the training data,
  *  respectively. This parameter may be supplied more than
  *  once to optimise over several classifier options
  *  simultaneously.</pre>
  * 
  * <pre> -S &lt;num&gt;
  *  Random number seed.
  *  (default 1)</pre>
  * 
  * <pre> -D
  *  If set, classifier is run in debug mode and
  *  may output additional info to the console</pre>
  * 
  * <pre> -W
  *  Full name of base classifier.
  *  (default: weka.classifiers.rules.ZeroR)</pre>
  * 
  * <pre> 
  * Options specific to classifier weka.classifiers.rules.ZeroR:
  * </pre>
  * 
  * <pre> -D
  *  If set, classifier is run in debug mode and
  *  may output additional info to the console</pre>
  * 
  <!-- options-end -->
  *
  * Options after -- are passed to the designated sub-classifier. <p>
  *
  * @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 foldsString = Utils.getOption('X', options);
   if (foldsString.length() != 0) {
     setNumFolds(Integer.parseInt(foldsString));
   } else {
     setNumFolds(10);
   }

   String cvParam;
   m_CVParams = new FastVector();
   do {
     cvParam = Utils.getOption('P', options);
     if (cvParam.length() != 0) {
addCVParameter(cvParam);
     }
   } while (cvParam.length() != 0);

   super.setOptions(options);
 }
 
Example 15
Source File: StratifiedRemoveFolds.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -V
 *  Specifies if inverse of selection is to be output.
 * </pre>
 * 
 * <pre> -N &lt;number of folds&gt;
 *  Specifies number of folds dataset is split into. 
 *  (default 10)
 * </pre>
 * 
 * <pre> -F &lt;fold&gt;
 *  Specifies which fold is selected. (default 1)
 * </pre>
 * 
 * <pre> -S &lt;seed&gt;
 *  Specifies random number seed. (default 0, no randomizing)
 * </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 {

  setInvertSelection(Utils.getFlag('V', options));
  String numFolds = Utils.getOption('N', options);
  if (numFolds.length() != 0) {
    setNumFolds(Integer.parseInt(numFolds));
  } else {
    setNumFolds(10);
  }
  String fold = Utils.getOption('F', options);
  if (fold.length() != 0) {
    setFold(Integer.parseInt(fold));
  } else {
    setFold(1);
  }
  String seed = Utils.getOption('S', options);
  if (seed.length() != 0) {
    setSeed(Integer.parseInt(seed));
  } else {
    setSeed(0);
  }
  if (getInputFormat() != null) {
    setInputFormat(getInputFormat());
  }
}
 
Example 16
Source File: REPTree.java    From tsml with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -M &lt;minimum number of instances&gt;
 *  Set minimum number of instances per leaf (default 2).</pre>
 * 
 * <pre> -V &lt;minimum variance for split&gt;
 *  Set minimum numeric class variance proportion
 *  of train variance for split (default 1e-3).</pre>
 * 
 * <pre> -N &lt;number of folds&gt;
 *  Number of folds for reduced error pruning (default 3).</pre>
 * 
 * <pre> -S &lt;seed&gt;
 *  Seed for random data shuffling (default 1).</pre>
 * 
 * <pre> -P
 *  No pruning.</pre>
 * 
 * <pre> -L
 *  Maximum tree depth (default -1, no maximum)</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 minNumString = Utils.getOption('M', options);
  if (minNumString.length() != 0) {
    m_MinNum = (double)Integer.parseInt(minNumString);
  } else {
    m_MinNum = 2;
  }
  String minVarString = Utils.getOption('V', options);
  if (minVarString.length() != 0) {
    m_MinVarianceProp = Double.parseDouble(minVarString);
  } else {
    m_MinVarianceProp = 1e-3;
  }
  String numFoldsString = Utils.getOption('N', options);
  if (numFoldsString.length() != 0) {
    m_NumFolds = Integer.parseInt(numFoldsString);
  } else {
    m_NumFolds = 3;
  }
  String seedString = Utils.getOption('S', options);
  if (seedString.length() != 0) {
    m_Seed = Integer.parseInt(seedString);
  } else {
    m_Seed = 1;
  }
  m_NoPruning = Utils.getFlag('P', options);
  String depthString = Utils.getOption('L', options);
  if (depthString.length() != 0) {
    m_MaxDepth = Integer.parseInt(depthString);
  } else {
    m_MaxDepth = -1;
  }
  String initialCountString = Utils.getOption('I', options);
  if (initialCountString.length() != 0) {
    m_InitialCount = Double.parseDouble(initialCountString);
  } else {
    m_InitialCount = 0;
  }
  m_SpreadInitialCount = Utils.getFlag('R', options);
  
  Utils.checkForRemainingOptions(options);
}
 
Example 17
Source File: AttributeSelectedClassifier.java    From tsml with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -E &lt;attribute evaluator specification&gt;
 *  Full class name of attribute evaluator, followed
 *  by its options.
 *  eg: "weka.attributeSelection.CfsSubsetEval -L"
 *  (default weka.attributeSelection.CfsSubsetEval)</pre>
 * 
 * <pre> -S &lt;search method specification&gt;
 *  Full class name of search method, followed
 *  by its options.
 *  eg: "weka.attributeSelection.BestFirst -D 1"
 *  (default weka.attributeSelection.BestFirst)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</pre>
 * 
 * <pre> -W
 *  Full name of base classifier.
 *  (default: weka.classifiers.trees.J48)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.J48:
 * </pre>
 * 
 * <pre> -U
 *  Use unpruned tree.</pre>
 * 
 * <pre> -C &lt;pruning confidence&gt;
 *  Set confidence threshold for pruning.
 *  (default 0.25)</pre>
 * 
 * <pre> -M &lt;minimum number of instances&gt;
 *  Set minimum number of instances per leaf.
 *  (default 2)</pre>
 * 
 * <pre> -R
 *  Use reduced error pruning.</pre>
 * 
 * <pre> -N &lt;number of folds&gt;
 *  Set number of folds for reduced error
 *  pruning. One fold is used as pruning set.
 *  (default 3)</pre>
 * 
 * <pre> -B
 *  Use binary splits only.</pre>
 * 
 * <pre> -S
 *  Don't perform subtree raising.</pre>
 * 
 * <pre> -L
 *  Do not clean up after the tree has been built.</pre>
 * 
 * <pre> -A
 *  Laplace smoothing for predicted probabilities.</pre>
 * 
 * <pre> -Q &lt;seed&gt;
 *  Seed for random data shuffling (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 {

  // same for attribute evaluator
  String evaluatorString = Utils.getOption('E', options);
  if (evaluatorString.length() == 0)
    evaluatorString = weka.attributeSelection.CfsSubsetEval.class.getName();
  String [] evaluatorSpec = Utils.splitOptions(evaluatorString);
  if (evaluatorSpec.length == 0) {
    throw new Exception("Invalid attribute evaluator specification string");
  }
  String evaluatorName = evaluatorSpec[0];
  evaluatorSpec[0] = "";
  setEvaluator(ASEvaluation.forName(evaluatorName, evaluatorSpec));

  // same for search method
  String searchString = Utils.getOption('S', options);
  if (searchString.length() == 0)
    searchString = weka.attributeSelection.BestFirst.class.getName();
  String [] searchSpec = Utils.splitOptions(searchString);
  if (searchSpec.length == 0) {
    throw new Exception("Invalid search specification string");
  }
  String searchName = searchSpec[0];
  searchSpec[0] = "";
  setSearch(ASSearch.forName(searchName, searchSpec));

  super.setOptions(options);
}
 
Example 18
Source File: VFI.java    From tsml with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -C
 *  Don't weight voting intervals by confidence</pre>
 * 
 * <pre> -B &lt;bias&gt;
 *  Set exponential bias towards confident intervals
 *  (default = 1.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 optionString;
  
  setWeightByConfidence(!Utils.getFlag('C', options));
  
  optionString = Utils.getOption('B', options);
  if (optionString.length() != 0) {
    Double temp = new Double(optionString);
    setBias(temp.doubleValue());
  }

  Utils.checkForRemainingOptions(options);
}
 
Example 19
Source File: RemoveType.java    From tsml with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Parses a given list of options. <p/>
 * 
 <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -T &lt;nominal|numeric|string|date|relational&gt;
 *  Attribute type to delete. Valid options are "nominal", 
 *  "numeric", "string", "date" and "relational".
 *  (default "string")</pre>
 * 
 * <pre> -V
 *  Invert matching sense (i.e. only keep specified columns)</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 tString = Utils.getOption('T', options);
  if (tString.length() != 0) setAttributeTypeString(tString);
  setInvertSelection(Utils.getFlag('V', options));

  if (getInputFormat() != null) {
    setInputFormat(getInputFormat());
  }
}
 
Example 20
Source File: RandomizableIteratedSingleClassifierEnhancer.java    From tsml with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Parses a given list of options. Valid options are:<p>
 *
 * -W classname <br>
 * Specify the full class name of the base learner.<p>
 *
 * -I num <br>
 * Set the number of iterations (default 10). <p>
 *
 * -S num <br>
 * Set the random number seed (default 1). <p>
 *
 * Options after -- are passed to the designated classifier.<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 seed = Utils.getOption('S', options);
  if (seed.length() != 0) {
    setSeed(Integer.parseInt(seed));
  } else {
    setSeed(1);
  }

  super.setOptions(options);
}