Example usage for weka.core Option name

List of usage examples for weka.core Option name

Introduction

In this page you can find the example usage for weka.core Option name.

Prototype

public String name() 

Source Link

Document

Returns the option's name.

Usage

From source file:com.rapidminer.tools.WekaTools.java

License:Open Source License

/**
 * Tries to guess the type of the given option. If the number of arguments
 * is zero, than a boolean type is assumed. In other cases it will be tried
 * to parse the default value in the options array as a number and on
 * success a Double type is returned. If this fails, a ParameterTypeString
 * is returned./*from w  w  w  .j  a v a 2 s  .  c o  m*/
 */
public static ParameterType guessParameterType(Option option, String[] options) {
    if (option.numArguments() == 0) {
        String defaultString = getStringDefault(option.name(), options);
        if (defaultString == null) {
            return new ParameterTypeBoolean(option.name(), option.description(),
                    getBooleanDefault(option.name(), options));
        } else {
            return new ParameterTypeString(option.name(), option.description(), defaultString);
        }
    } else {
        String defaultString = getStringDefault(option.name(), options);
        if (defaultString == null) {
            return new ParameterTypeString(option.name(), option.description());
        } else {
            try {
                double defaultValue = Double.parseDouble(defaultString);
                return new ParameterTypeDouble(option.name(), option.description(), Double.NEGATIVE_INFINITY,
                        Double.POSITIVE_INFINITY, defaultValue);
            } catch (NumberFormatException e) {
                return new ParameterTypeString(option.name(), option.description(), defaultString);
            }
        }
    }
}

From source file:com.rapidminer.tools.WekaTools.java

License:Open Source License

/** Add the parameter type for the options of a Weka option handler. */
public static void addParameterTypes(OptionHandler handler, List<ParameterType> types,
        List<ParameterType> wekaParameters, boolean meta, String metaParameter) {
    String[] defaultOptions = removeMetaOptions(handler.getOptions());
    Enumeration options = handler.listOptions();
    while (options.hasMoreElements()) {
        Option option = (Option) options.nextElement();
        if (option.name().trim().length() == 0)
            break; // necessary to prevent adding of parameters of children
                   // of meta learners

        // prevent adding the meta learning scheme options
        if (meta && option.name().trim().toLowerCase().equals(metaParameter.toLowerCase())) {
            continue;
        }/*from  w w w.  jav a 2s  . co m*/

        ParameterType type = guessParameterType(option, defaultOptions);
        type.setExpert(false); // all Weka paras as non expert paras
        types.add(type);
        wekaParameters.add(type);
    }
}

From source file:meka.classifiers.multilabel.Evaluation.java

License:Open Source License

public static void printOptions(Enumeration e) {

    // Evaluation Options
    StringBuffer text = new StringBuffer();
    text.append("\n\nEvaluation Options:\n\n");
    text.append("-h\n");
    text.append("\tOutput help information.\n");
    text.append("-t <name of training file>\n");
    text.append("\tSets training file.\n");
    text.append("-T <name of test file>\n");
    text.append("\tSets test file.\n");
    text.append("-x <number of folds>\n");
    text.append("\tDo cross-validation with this many folds.\n");
    text.append("-R\n");
    text.append("\tRandomize the order of instances in the dataset.\n");
    text.append("-split-percentage <percentage>\n");
    text.append("\tSets the percentage for the train/test set split, e.g., 66.\n");
    text.append("-split-number <number>\n");
    text.append("\tSets the number of training examples, e.g., 800\n");
    text.append("-i\n");
    text.append("\tInvert the specified train/test split.\n");
    text.append("-s <random number seed>\n");
    text.append("\tSets random number seed (use with -R, for different CV or train/test splits).\n");
    text.append("-threshold <threshold>\n");
    text.append(//from w  ww . j ava  2  s .  c  om
            "\tSets the type of thresholding; where\n\t\t'PCut1' automatically calibrates a threshold (the default);\n\t\t'PCutL' automatically calibrates one threshold for each label;\n\t\tany number, e.g. '0.5', specifies that threshold.\n");
    text.append("-C <number of labels>\n");
    text.append("\tSets the number of target variables (labels) to assume (indexed from the beginning).\n");
    //text.append("-f <results_file>\n");
    //text.append("\tSpecify a file to output results and evaluation statistics into.\n");
    text.append("-d <classifier_file>\n");
    text.append("\tSpecify a file to dump classifier into.\n");
    text.append("-l <classifier_file>\n");
    text.append("\tSpecify a file to load classifier from.\n");
    text.append("-verbosity <verbosity level>\n");
    text.append("\tSpecify more/less evaluation output\n");
    // Multilabel Options
    text.append("\n\nClassifier Options:\n\n");
    while (e.hasMoreElements()) {
        Option o = (Option) (e.nextElement());
        text.append("-" + o.name() + '\n');
        text.append("" + o.description() + '\n');
    }

    System.out.println(text);
}

From source file:meka.classifiers.multilabel.incremental.IncrementalEvaluation.java

License:Open Source License

public static void printOptions(Enumeration e) {

    // Evaluation Options
    StringBuffer text = new StringBuffer();
    text.append("\n\nEvaluation Options:\n\n");
    text.append("-t\n");
    text.append("\tSpecify the dataset (required)\n");
    //text.append("-split-percentage <percentage>\n");
    //text.append("\tSets the percentage of data to use for the initial training, e.g., 10.\n");
    text.append("-x <number of windows>\n");
    text.append("\tSets the number of samples to take (at evenly space intervals); default: 10.\n");
    text.append("-supervision <ratio labelled>\n");
    text.append("\tSets the ratio of labelled instances; default: 1.\n");
    text.append("-threshold <threshold>\n");
    text.append("\tSets the threshold to use.\n");
    text.append("-verbosity <verbosity level>\n");
    text.append("\tSpecify more/less evaluation output.\n");
    // Multilabel Options
    text.append("\n\nClassifier Options:\n\n");
    while (e.hasMoreElements()) {
        Option o = (Option) (e.nextElement());
        text.append("-" + o.name() + '\n');
        text.append("" + o.description() + '\n');
    }//  ww  w.j  a va2 s.co m
    System.out.println(text);
}