* map name -> (attribute info, attribute number)
*/
protected <T extends PerformanceTuple> InstanceList createInstances(
List<T> trainingData, Map<String, Pair<AttrInfo, Integer>> attrMap) {
InstanceList instances = new InstanceList(schema);
for (PerformanceTuple perfTuple : trainingData) {
Set<String> setAttribs = new HashSet<>();
Instance instance = new Instance(instances.get_schema());
MLJUtils.setAttributeValues(instance, attrMap,
perfTuple.getConfiguration());
setAttribs.addAll(perfTuple.getConfiguration().keySet());
MLJUtils.setAttributeValues(instance, attrMap, perfTuple.getFeatures());
setAttribs.addAll(perfTuple.getFeatures().keySet());
// Care for missing values
Set<String> missingAttribs = new HashSet<>(attrMap.keySet());
missingAttribs.removeAll(setAttribs);
for (String missingAttrib : missingAttribs) {
MLJUtils.setMissingAttribute(instance, attrMap.get(missingAttrib));
}
labelInstance(instance, schema.label_info(), perfTuple.getPerformance());
instances.add_instance(instance);
}
return instances;
}