Search in sources :

Example 1 with MultiLabelClassifier

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;
}
Also used : MultiLabelClassifier(meka.classifiers.multilabel.MultiLabelClassifier) AbstractClassifier(weka.classifiers.AbstractClassifier) Classifier(weka.classifiers.Classifier) MultiLabelClassifier(meka.classifiers.multilabel.MultiLabelClassifier)

Aggregations

MultiLabelClassifier (meka.classifiers.multilabel.MultiLabelClassifier)1 AbstractClassifier (weka.classifiers.AbstractClassifier)1 Classifier (weka.classifiers.Classifier)1