if(itemClassMap.isEmpty()){
throw new RuntimeException("Map should have at least one element!");
}
//initialize jml dataset
Dataset jmlDataset = new DefaultDataset();
//iterate through Map
for(Map.Entry<double[],String> entry : itemClassMap.entrySet()){
//initialize Instance from Map entry Key (double array) and Value (String) class value
Instance dataRow = new DenseInstance(entry.getKey(), entry.getValue());
//add Instance to jml dataset
jmlDataset.add(dataRow);
}
return jmlDataset;
}