use of mulan.data.LabelsMetaDataImpl 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);
}
Aggregations