use of meka.classifiers.multilabel.MultiLabelClassifier in project dkpro-tc by dkpro.
the class WekaUtils method getClassifier.
/**
* Retrieves a classifier
*
* @param learningMode
* the learning mode
* @param classificationArguments
* classifier arguments
* @return classifier
* @throws Exception
* in case of errors
*/
public static Classifier getClassifier(String learningMode, List<Object> classificationArguments) throws Exception {
boolean multiLabel = learningMode.equals(Constants.LM_MULTI_LABEL);
Classifier cl;
if (multiLabel) {
List<String> mlArgs = Arrays.asList(classificationArguments.subList(2, classificationArguments.size()).toArray(new String[0]));
cl = AbstractClassifier.forName((String) classificationArguments.get(1), new String[] {});
((MultiLabelClassifier) cl).setOptions(mlArgs.toArray(new String[0]));
} else {
cl = AbstractClassifier.forName((String) classificationArguments.get(1), classificationArguments.subList(2, classificationArguments.size()).toArray(new String[0]));
}
return cl;
}
Aggregations