List of usage examples for weka.classifiers Evaluation evaluationForSingleInstance
public double evaluationForSingleInstance(double[] dist, Instance instance, boolean storePredictions) throws Exception
From source file:net.sf.jclal.classifier.WekaComitteClassifier.java
License:Open Source License
/** * Evaluates the classifier using the test dataset * * @param instances The test instances./*from www .ja v a 2 s. co m*/ * @return The evaluation of the model. */ @Override public AbstractEvaluation testModel(IDataset instances) { try { // test phase with the actual model Evaluation evaluator; evaluator = new Evaluation(new Instances(instances.getDataset(), 0)); Instances testData = instances.getDataset(); for (Instance in : testData) { double temp[] = distributionForInstance(in); evaluator.evaluationForSingleInstance(temp, in, true); } SingleLabelEvaluation sleval = new SingleLabelEvaluation(); sleval.setEvaluation(evaluator); return sleval; } catch (Exception e) { Logger.getLogger(WekaComitteClassifier.class.getName()).log(Level.SEVERE, null, e); } return null; }