/** Train the classifier. */
  @Override
  public void training() {
    try {

      classifier.buildClassifier(getLabelledData());

    } catch (Exception ex) {
      Logger.getLogger(PoolBasedSamplingScenario.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  /**
   * Set the classifier to use on query strategy
   *
   * @param classifier The classifier to use
   */
  @Override
  public void setClassifier(IClassifier classifier) {

    try {
      this.classifier = classifier.makeCopy();
    } catch (Exception e) {

      Logger.getLogger(AbstractQueryStrategy.class.getName()).log(Level.SEVERE, null, e);
    }
  }
  /**
   * Returns the probability of the instance belongs to each class.
   *
   * @param instance The instance to test
   * @return The probability for each class
   */
  @Override
  public double[] distributionForInstance(Instance instance) {
    try {

      return classifier.distributionForInstance(instance);

    } catch (Exception ex) {
      Logger.getLogger(AbstractQueryStrategy.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
  }
  /** 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);
    }
  }