Example usage for weka.core Utils checkForRemainingOptions

List of usage examples for weka.core Utils checkForRemainingOptions

Introduction

In this page you can find the example usage for weka.core Utils checkForRemainingOptions.

Prototype

public static void checkForRemainingOptions(String[] options) throws Exception 

Source Link

Document

Checks if the given array contains any non-empty options.

Usage

From source file:Bilbo.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->/*  w  w  w  .j av  a  2s.co m*/
 * Valid options are: <p/>
 * 
 * <pre> -P
 *  Size of each bag, as a percentage of the
 *  training set size. (default 100)</pre>
 * 
 * <pre> -O
 *  Calculate the out of bag error.</pre>
 * 
 * <pre> -represent-copies-using-weights
 *  Represent copies of instances using weights rather than explicitly.</pre>
 * 
 * <pre> -S &lt;num&gt;
 *  Random number seed.
 *  (default 1)</pre>
 * 
 * <pre> -num-slots &lt;num&gt;
 *  Number of execution slots.
 *  (default 1 - i.e. no parallelism)</pre>
 * 
 * <pre> -I &lt;num&gt;
 *  Number of iterations.
 *  (default 10)</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.REPTree)</pre>
 * 
 * <pre> 
 * Options specific to classifier weka.classifiers.trees.REPTree:
 * </pre>
 * 
 * <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>
 * 
 * <pre> -I
 *  Initial class value count (default 0)</pre>
 * 
 * <pre> -R
 *  Spread initial count over all class values (i.e. don't use 1 per value)</pre>
 * 
 <!-- options-end -->
 *
 * Options after -- are passed to the designated classifier.<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 bagSize = Utils.getOption('P', options);
    if (bagSize.length() != 0) {
        setBagSizePercent(Integer.parseInt(bagSize));
    } else {
        setBagSizePercent(100);
    }

    setCalcOutOfBag(Utils.getFlag('O', options));

    setRepresentCopiesUsingWeights(Utils.getFlag("represent-copies-using-weights", options));

    super.setOptions(options);

    Utils.checkForRemainingOptions(options);
}

From source file:REPTree.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 * // w  ww  . j  a  va  2  s .  c  o  m
 <!-- 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);
}

From source file:REPRandomTree.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 * /*from www  .  jav  a2 s  . c o m*/
 <!-- 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);

    String featureFracString = Utils.getOption('F', options);
    if (featureFracString.length() != 0) {
        m_FeatureFrac = Double.parseDouble(featureFracString);
    } else {
        m_FeatureFrac = 1.0;
    }

    Utils.checkForRemainingOptions(options);
}

From source file:BetterRemoveByName.java

License:Open Source License

/**
 * Parses the options for this object./*from  w w  w  .  jav a  2 s . c o  m*/
 * <p/>
 *
 * <!-- options-start --> Valid options are:
 * <p/>
 *
 * <pre>
 * -D
 *  Turns on output of debugging information.
 * </pre>
 *
 * <pre>
 * -E &lt;regular expression&gt;
 *  The regular expression to match the attribute names against.
 *  (default: ^.*id$)
 * </pre>
 *
 * <pre>
 * -V
 *  Flag for inverting the matching sense. If set, attributes are kept
 *  instead of deleted.
 *  (default: off)
 * </pre>
 *
 * <!-- options-end -->
 *
 * @param options the options to use
 * @throws Exception if the option setting fails
 */
@Override
public void setOptions(String[] options) throws Exception {

    String tmpStr = Utils.getOption("E", options);
    if (tmpStr.length() != 0) {
        setExpression(tmpStr);
    } else {
        setExpression(DEFAULT_EXPRESSION);
    }

    setInvertSelection(Utils.getFlag("V", options));

    super.setOptions(options);

    Utils.checkForRemainingOptions(options);
}

From source file:HierarchicalClusterer.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 *
    <!-- options-start -->/*from  w w  w.ja  v  a 2  s  . c om*/
 * Valid options are: <p/>
 * 
    <!-- 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_bPrintNewick = Utils.getFlag('P', options);

    String optionString = Utils.getOption('N', options);
    if (optionString.length() != 0) {
        Integer temp = new Integer(optionString);
        setNumClusters(temp);
    } else {
        setNumClusters(2);
    }

    setDebug(Utils.getFlag('D', options));
    setDistanceIsBranchLength(Utils.getFlag('B', options));

    String sLinkType = Utils.getOption('L', options);

    if (sLinkType.compareTo("SINGLE") == 0) {
        setLinkType(new SelectedTag(SINGLE, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("COMPLETE") == 0) {
        setLinkType(new SelectedTag(COMPLETE, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("AVERAGE") == 0) {
        setLinkType(new SelectedTag(AVERAGE, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("MEAN") == 0) {
        setLinkType(new SelectedTag(MEAN, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("CENTROID") == 0) {
        setLinkType(new SelectedTag(CENTROID, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("WARD") == 0) {
        setLinkType(new SelectedTag(WARD, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("ADJCOMLPETE") == 0) {
        setLinkType(new SelectedTag(ADJCOMLPETE, TAGS_LINK_TYPE));
    }
    if (sLinkType.compareTo("NEIGHBOR_JOINING") == 0) {
        setLinkType(new SelectedTag(NEIGHBOR_JOINING, TAGS_LINK_TYPE));
    }

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

        setDistanceFunction(
                (DistanceFunction) Utils.forName(DistanceFunction.class, className, nnSearchClassSpec));
    } else {
        setDistanceFunction(new EuclideanDistance());
    }

    Utils.checkForRemainingOptions(options);
}

From source file:ai.BalancedRandomForest.java

License:GNU General Public License

/**
 * Parses a given list of options. <p/>
 * //from  w  w w  .ja  va  2s.c  o  m
   <!-- options-start -->
 * Valid options are: <p/>
 * 
 * <pre> -I &lt;number of trees&gt;
 *  Number of trees to build.</pre>
 * 
 * <pre> -K &lt;number of features&gt;
 *  Number of features to consider (&lt;1=int(logM+1)).</pre>
 * 
 * <pre> -S
 *  Seed for random number generator.
 *  (default 1)</pre>
 * 
 * <pre> -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console</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('I', options);
    if (tmpStr.length() != 0) {
        this.numTrees = Integer.parseInt(tmpStr);
    } else {
        this.numTrees = 100;
    }

    tmpStr = Utils.getOption('K', options);
    if (tmpStr.length() != 0) {
        this.numFeatures = Integer.parseInt(tmpStr);
    } else {
        this.numFeatures = 0;
    }

    tmpStr = Utils.getOption('S', options);
    if (tmpStr.length() != 0) {
        setSeed(Integer.parseInt(tmpStr));
    } else {
        setSeed(1);
    }

    super.setOptions(options);

    Utils.checkForRemainingOptions(options);
}

From source file:br.com.ufu.lsi.rebfnetwork.RBFNetwork.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->// w  w  w.  ja  v  a  2s  .  c om
 * Valid options are: <p/>
 * 
 * <pre> -B &lt;number&gt;
 *  Set the number of clusters (basis functions) to generate. (default = 2).</pre>
 * 
 * <pre> -S &lt;seed&gt;
 *  Set the random seed to be used by K-means. (default = 1).</pre>
 * 
 * <pre> -R &lt;ridge&gt;
 *  Set the ridge value for the logistic or linear regression.</pre>
 * 
 * <pre> -M &lt;number&gt;
 *  Set the maximum number of iterations for the logistic regression. (default -1, until convergence).</pre>
 * 
 * <pre> -W &lt;number&gt;
 *  Set the minimum standard deviation for the clusters. (default 0.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 {
    setDebug(Utils.getFlag('D', options));

    String ridgeString = Utils.getOption('R', options);
    if (ridgeString.length() != 0) {
        m_ridge = Double.parseDouble(ridgeString);
    } else {
        m_ridge = 1.0e-8;
    }

    String maxItsString = Utils.getOption('M', options);
    if (maxItsString.length() != 0) {
        m_maxIts = Integer.parseInt(maxItsString);
    } else {
        m_maxIts = -1;
    }

    String numClustersString = Utils.getOption('B', options);
    if (numClustersString.length() != 0) {
        setNumClusters(Integer.parseInt(numClustersString));
    }

    String seedString = Utils.getOption('S', options);
    if (seedString.length() != 0) {
        setClusteringSeed(Integer.parseInt(seedString));
    }
    String stdString = Utils.getOption('W', options);
    if (stdString.length() != 0) {
        setMinStdDev(Double.parseDouble(stdString));
    }
    Utils.checkForRemainingOptions(options);
}

From source file:cba.AssociatorEvaluation.java

License:Open Source License

/**
 * Evaluates the associator with the given commandline options and returns
 * the evaluation string./*  w w w.j a  v  a  2  s  . co m*/
 * 
 * @param associator   the Associator to evaluate
 * @param options   the commandline options
 * @return      the generated output string
 * @throws Exception   if evaluation fails
 */
public static String evaluate(Associator associator, String[] options) throws Exception {

    String trainFileString = "";
    String graphFileName = "";
    AssociatorEvaluation eval;
    DataSource loader;

    // help?
    if (Utils.getFlag('h', options))
        throw new Exception("\nHelp requested.\n" + makeOptionString(associator));

    try {
        // general options
        trainFileString = Utils.getOption('t', options);
        if (trainFileString.length() == 0)
            throw new Exception("No training file given!");
        loader = new DataSource(trainFileString);

        graphFileName = Utils.getOption('g', options);

        // associator specific options
        if (associator instanceof OptionHandler) {
            ((OptionHandler) associator).setOptions(options);
        }

        // left-over options?
        Utils.checkForRemainingOptions(options);
    } catch (Exception e) {
        throw new Exception("\nWeka exception: " + e.getMessage() + "\n" + makeOptionString(associator));
    }

    // load file and build associations
    eval = new AssociatorEvaluation();
    String results = eval.evaluate(associator, new Instances(loader.getDataSet()));

    // If associator is drawable output string describing graph
    if ((associator instanceof Drawable) && (graphFileName.length() != 0)) {
        BufferedWriter writer = new BufferedWriter(new FileWriter(graphFileName));
        writer.write(((Drawable) associator).graph());
        writer.newLine();
        writer.flush();
        writer.close();
    }

    return results;
}

From source file:classifiers.mlp.MultilayerPerceptronCustom.java

License:Open Source License

/**
 * Parses a given list of options. <p/>
 *
 <!-- options-start -->//from   www .  j  a va  2 s.  c  om
 * Valid options are: <p/>
 * 
 * <pre> -L &lt;learning rate&gt;
 *  Learning Rate for the backpropagation algorithm.
 *  (Value should be between 0 - 1, Default = 0.3).</pre>
 * 
 * <pre> -M &lt;momentum&gt;
 *  Momentum Rate for the backpropagation algorithm.
 *  (Value should be between 0 - 1, Default = 0.2).</pre>
 * 
 * <pre> -N &lt;number of epochs&gt;
 *  Number of epochs to train through.
 *  (Default = 500).</pre>
 * 
 * <pre> -V &lt;percentage size of validation set&gt;
 *  Percentage size of validation set to use to terminate
 *  training (if this is non zero it can pre-empt num of epochs.
 *  (Value should be between 0 - 100, Default = 0).</pre>
 * 
 * <pre> -S &lt;seed&gt;
 *  The value used to seed the random number generator
 *  (Value should be &gt;= 0 and and a long, Default = 0).</pre>
 * 
 * <pre> -E &lt;threshold for number of consequetive errors&gt;
 *  The consequetive number of errors allowed for validation
 *  testing before the netwrok terminates.
 *  (Value should be &gt; 0, Default = 20).</pre>
 * 
 * <pre> -G
 *  GUI will be opened.
 *  (Use this to bring up a GUI).</pre>
 * 
 * <pre> -A
 *  Autocreation of the network connections will NOT be done.
 *  (This will be ignored if -G is NOT set)</pre>
 * 
 * <pre> -B
 *  A NominalToBinary filter will NOT automatically be used.
 *  (Set this to not use a NominalToBinary filter).</pre>
 * 
 * <pre> -H &lt;comma seperated numbers for nodes on each layer&gt;
 *  The hidden layers to be created for the network.
 *  (Value should be a list of comma separated Natural 
 *  numbers or the letters 'a' = (attribs + classes) / 2, 
 *  'i' = attribs, 'o' = classes, 't' = attribs .+ classes)
 *  for wildcard values, Default = a).</pre>
 * 
 * <pre> -C
 *  Normalizing a numeric class will NOT be done.
 *  (Set this to not normalize the class if it's numeric).</pre>
 * 
 * <pre> -I
 *  Normalizing the attributes will NOT be done.
 *  (Set this to not normalize the attributes).</pre>
 * 
 * <pre> -R
 *  Reseting the network will NOT be allowed.
 *  (Set this to not allow the network to reset).</pre>
 * 
 * <pre> -D
 *  Learning rate decay will occur.
 *  (Set this to cause the learning rate to decay).</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 {
    //the defaults can be found here!!!!
    String learningString = Utils.getOption('L', options);
    if (learningString.length() != 0) {
        setLearningRate((new Double(learningString)).doubleValue());
    } else {
        setLearningRate(0.3);
    }
    String momentumString = Utils.getOption('M', options);
    if (momentumString.length() != 0) {
        setMomentum((new Double(momentumString)).doubleValue());
    } else {
        setMomentum(0.2);
    }
    String epochsString = Utils.getOption('N', options);
    if (epochsString.length() != 0) {
        setTrainingTime(Integer.parseInt(epochsString));
    } else {
        setTrainingTime(500);
    }
    String valSizeString = Utils.getOption('V', options);
    if (valSizeString.length() != 0) {
        setValidationSetSize(Integer.parseInt(valSizeString));
    } else {
        setValidationSetSize(0);
    }
    String seedString = Utils.getOption('S', options);
    if (seedString.length() != 0) {
        setSeed(Integer.parseInt(seedString));
    } else {
        setSeed(0);
    }
    String thresholdString = Utils.getOption('E', options);
    if (thresholdString.length() != 0) {
        setValidationThreshold(Integer.parseInt(thresholdString));
    } else {
        setValidationThreshold(20);
    }
    String hiddenLayers = Utils.getOption('H', options);
    if (hiddenLayers.length() != 0) {
        setHiddenLayers(hiddenLayers);
    } else {
        setHiddenLayers("a");
    }
    if (Utils.getFlag('G', options)) {
        setGUI(true);
    } else {
        setGUI(false);
    } //small note. since the gui is the only option that can change the other
      //options this should be set first to allow the other options to set 
      //properly
    if (Utils.getFlag('A', options)) {
        setAutoBuild(false);
    } else {
        setAutoBuild(true);
    }
    if (Utils.getFlag('B', options)) {
        setNominalToBinaryFilter(false);
    } else {
        setNominalToBinaryFilter(true);
    }
    if (Utils.getFlag('C', options)) {
        setNormalizeNumericClass(false);
    } else {
        setNormalizeNumericClass(true);
    }
    if (Utils.getFlag('I', options)) {
        setNormalizeAttributes(false);
    } else {
        setNormalizeAttributes(true);
    }
    if (Utils.getFlag('R', options)) {
        setReset(false);
    } else {
        setReset(true);
    }
    if (Utils.getFlag('D', options)) {
        setDecay(true);
    } else {
        setDecay(false);
    }

    Utils.checkForRemainingOptions(options);
}

From source file:clusterer.SimpleKMeansWithSilhouette.java

License:Open Source License

/**
 * Parses a given list of options./*w ww .ja  v  a2s  .c  o m*/
 * <p/>
 * 
 * <!-- options-start --> Valid options are:
 * <p/>
 * 
 * <pre>
 * -N &lt;num&gt;
 *  Number of clusters.
 *  (default 2).
 * </pre>
 * 
 * <pre>
 * -init
 *  Initialization method to use.
 *  0 = random, 1 = k-means++, 2 = canopy, 3 = farthest first.
 *  (default = 0)
 * </pre>
 * 
 * <pre>
 * -C
 *  Use canopies to reduce the number of distance calculations.
 * </pre>
 * 
 * <pre>
 * -max-candidates &lt;num&gt;
 *  Maximum number of candidate canopies to retain in memory
 *  at any one time when using canopy clustering.
 *  T2 distance plus, data characteristics,
 *  will determine how many candidate canopies are formed before
 *  periodic and final pruning are performed, which might result
 *  in exceess memory consumption. This setting avoids large numbers
 *  of candidate canopies consuming memory. (default = 100)
 * </pre>
 * 
 * <pre>
 * -periodic-pruning &lt;num&gt;
 *  How often to prune low density canopies when using canopy clustering. 
 *  (default = every 10,000 training instances)
 * </pre>
 * 
 * <pre>
 * -min-density
 *  Minimum canopy density, when using canopy clustering, below which
 *   a canopy will be pruned during periodic pruning. (default = 2 instances)
 * </pre>
 * 
 * <pre>
 * -t2
 *  The T2 distance to use when using canopy clustering. Values &lt; 0 indicate that
 *  a heuristic based on attribute std. deviation should be used to set this.
 *  (default = -1.0)
 * </pre>
 * 
 * <pre>
 * -t1
 *  The T1 distance to use when using canopy clustering. A value &lt; 0 is taken as a
 *  positive multiplier for T2. (default = -1.5)
 * </pre>
 * 
 * <pre>
 * -V
 *  Display std. deviations for centroids.
 * </pre>
 * 
 * <pre>
 * -M
 *  Don't replace missing values with mean/mode.
 * </pre>
 * 
 * <pre>
 * -A &lt;classname and options&gt;
 *  Distance function to use.
 *  (default: weka.core.EuclideanDistance)
 * </pre>
 * 
 * <pre>
 * -I &lt;num&gt;
 *  Maximum number of iterations.
 * </pre>
 * 
 * <pre>
 * -O
 *  Preserve order of instances.
 * </pre>
 * 
 * <pre>
 * -fast
 *  Enables faster distance calculations, using cut-off values.
 *  Disables the calculation/output of squared errors/distances.
 * </pre>
 * 
 * <pre>
 * -num-slots &lt;num&gt;
 *  Number of execution slots.
 *  (default 1 - i.e. no parallelism)
 * </pre>
 * 
 * <pre>
 * -S &lt;num&gt;
 *  Random number seed.
 *  (default 10)
 * </pre>
 * 
 * <pre>
 * -output-debug-info
 *  If set, clusterer is run in debug mode and
 *  may output additional info to the console
 * </pre>
 * 
 * <pre>
 * -do-not-check-capabilities
 *  If set, clusterer capabilities are not checked before clusterer 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 {

    m_displayStdDevs = Utils.getFlag("V", options);
    m_dontReplaceMissing = Utils.getFlag("M", options);

    String initM = Utils.getOption("init", options);
    if (initM.length() > 0) {
        setInitializationMethod(new SelectedTag(Integer.parseInt(initM), TAGS_SELECTION));
    }

    m_speedUpDistanceCompWithCanopies = Utils.getFlag('C', options);

    String temp = Utils.getOption("max-candidates", options);
    if (temp.length() > 0) {
        setCanopyMaxNumCanopiesToHoldInMemory(Integer.parseInt(temp));
    }

    temp = Utils.getOption("periodic-pruning", options);
    if (temp.length() > 0) {
        setCanopyPeriodicPruningRate(Integer.parseInt(temp));
    }

    temp = Utils.getOption("min-density", options);
    if (temp.length() > 0) {
        setCanopyMinimumCanopyDensity(Double.parseDouble(temp));
    }

    temp = Utils.getOption("t2", options);
    if (temp.length() > 0) {
        setCanopyT2(Double.parseDouble(temp));
    }

    temp = Utils.getOption("t1", options);
    if (temp.length() > 0) {
        setCanopyT1(Double.parseDouble(temp));
    }

    String optionString = Utils.getOption('N', options);

    if (optionString.length() != 0) {
        setNumClusters(Integer.parseInt(optionString));
    }

    optionString = Utils.getOption("I", options);
    if (optionString.length() != 0) {
        setMaxIterations(Integer.parseInt(optionString));
    }

    String distFunctionClass = Utils.getOption('A', options);
    if (distFunctionClass.length() != 0) {
        String distFunctionClassSpec[] = Utils.splitOptions(distFunctionClass);
        if (distFunctionClassSpec.length == 0) {
            throw new Exception("Invalid DistanceFunction specification string.");
        }
        String className = distFunctionClassSpec[0];
        distFunctionClassSpec[0] = "";

        setDistanceFunction(
                (DistanceFunction) Utils.forName(DistanceFunction.class, className, distFunctionClassSpec));
    } else {
        setDistanceFunction(new EuclideanDistance());
    }

    m_PreserveOrder = Utils.getFlag("O", options);

    m_FastDistanceCalc = Utils.getFlag("fast", options);

    String slotsS = Utils.getOption("num-slots", options);
    if (slotsS.length() > 0) {
        setNumExecutionSlots(Integer.parseInt(slotsS));
    }

    super.setOptions(options);

    Utils.checkForRemainingOptions(options);
}