ArffLoader loader = new ArffLoader();
loader.setFile(new File(PropertiesGetter.getProperty("TrainingDataSetObject")));
Instances structure = loader.getStructure();
structure.setClassIndex(structure.numAttributes() - 1);
int numAtts = structure.numAttributes();
Instance instanceToClassify = getNewInstance(numAtts);
Iterator<Entry<Integer, Double>> currentIt = sample.entrySet().iterator();
Entry<Integer, Double> tempEntry;
while (currentIt.hasNext()) {
tempEntry = currentIt.next();
instanceToClassify.setValue(tempEntry.getKey(), tempEntry.getValue());
}
instanceToClassify.setDataset(structure);
instanceToClassify.setClassMissing();
try {
return cModel.classifyInstance(instanceToClassify);
} catch (Exception ex) {
Logger.getLogger(WekaWrapper.class.getName()).log(Level.SEVERE, null, ex);
System.out.println(ex.toString());