private XYDataset createDataset(String metricName) { series = new XYSeriesCollection(); // For each collection of evaluations for (int i = 0; i < evaluationsCollection.size(); i++) { if (!set.contains(i)) { List<AbstractEvaluation> evaluations = evaluationsCollection.get(i); XYSeries newXYSerie = new XYSeries(queryNames.get(i)); int evalIndex = 0; for (AbstractEvaluation eval : evaluations) { if (evalIndex % reportFrecuency == 0) { newXYSerie.add(eval.getLabeledSetSize(), eval.getMetricValue(metricName)); } ++evalIndex; } series.addSeries(newXYSerie); } } // The series that belongs to passive learning is the last if (passiveEvaluation != null) { series.addSeries(createPassiveLearningSerie(metricName, evaluationsCollection.get(0))); } return series; }
public XYSeries createPassiveLearningSerie( String metricName, List<AbstractEvaluation> evaluations) { XYSeries xyseriesPassive = new XYSeries("Passive learning"); // Fill the series of passive learning int evalIndex = 0; for (AbstractEvaluation eval : evaluations) { if (evalIndex % reportFrecuency == 0) { xyseriesPassive.add(eval.getLabeledSetSize(), passiveEvaluation.getMetricValue(metricName)); } ++evalIndex; } return xyseriesPassive; }
/** Evaluates the classifier using the test dataset. */ @Override public void testModel() { try { // test phase with the actual model AbstractEvaluation evaluation = classifier.testModel(testData); evaluation.setLabeledSetSize(getLabelledData().getNumInstances()); evaluation.setUnlabeledSetSize(getUnlabelledData().getNumInstances()); evaluations.add(evaluation); } catch (Exception e) { Logger.getLogger(AbstractQueryStrategy.class.getName()).log(Level.SEVERE, null, e); } }