List of usage examples for weka.classifiers.meta Stacking buildClassifier
public void buildClassifier(Instances data) throws Exception
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. * //www . java 2s .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; }