Example usage for weka.classifiers.meta Stacking setOptions

List of usage examples for weka.classifiers.meta Stacking setOptions

Introduction

In this page you can find the example usage for weka.classifiers.meta Stacking setOptions.

Prototype

public void setOptions(String[] options) throws Exception 

Source Link

Document

Parses a given list of options.

Usage

From source file:de.uniheidelberg.cl.swp.mlprocess.WEKARunner.java

License:Apache License

/**
 * Internal construction of the stacking classifier and its level 1 and level 0 algorithms.
 * //from   w  ww  . jav  a2s  . co m
 * @param type A meta machine learning algorithm for level 1.
 * @param subtypes Multiple machine learning algorithms for level 0.
 * @param options Options for the classifiers.
 * @return The stacking classifier.
 */
private Stacking createStack(String type, String[] subtypes, String options) throws Exception {
    StringBuffer sb = new StringBuffer();
    Stacking stack = new Stacking();

    sb.append("-M " + getClass(Type.valueOf(type.toUpperCase())));

    for (String s : subtypes) {
        sb.append(" -B " + getClass(Type.valueOf(s.toUpperCase())));
    }
    sb.append(" " + options);

    Logging.getInstance().getLogger()
            .info("Building " + subtypes.length + " subclassifiers... this might take some time");
    stack.setOptions(Utils.splitOptions(sb.toString()));
    stack.buildClassifier(train);

    return stack;
}