Search in sources :

Example 1 with LabelNodeImpl

use of mulan.data.LabelNodeImpl in project dkpro-tc by dkpro.

the class WekaUtils method convertMekaInstancesToMulanInstances.

/**
 * Converts the Meka-specific instances format to Mulan-specific instances. Hierarchical
 * relationships among labels cannot be expressed.
 *
 * @param instances
 *            instances
 * @return multi label instances
 * @throws InvalidDataFormatException
 *             in case of data format error
 */
public static MultiLabelInstances convertMekaInstancesToMulanInstances(Instances instances) throws InvalidDataFormatException {
    LabelsMetaDataImpl labelsMetaDataImpl = new LabelsMetaDataImpl();
    for (int i = 0; i < instances.classIndex(); i++) {
        String classAttName = instances.attribute(i).name();
        LabelNodeImpl labelNodeImpl = new LabelNodeImpl(classAttName);
        labelsMetaDataImpl.addRootNode(labelNodeImpl);
    }
    return new MultiLabelInstances(instances, labelsMetaDataImpl);
}
Also used : LabelNodeImpl(mulan.data.LabelNodeImpl) LabelsMetaDataImpl(mulan.data.LabelsMetaDataImpl) MultiLabelInstances(mulan.data.MultiLabelInstances)

Aggregations

LabelNodeImpl (mulan.data.LabelNodeImpl)1 LabelsMetaDataImpl (mulan.data.LabelsMetaDataImpl)1 MultiLabelInstances (mulan.data.MultiLabelInstances)1