public void checkOutput(IOContainer output) throws MissingIOObjectException {

    if (similarity.equals("Tree")) {
      TreeDistance treedistance = output.get(TreeDistance.class);
      for (int i = 0; i < expectedValues.length; i++) {
        assertEquals(treedistance.similarity(first[i], second[i]), expectedValues[i]);
      }
    }
    if (similarity.equals("Euclidean")) {
      EuclideanDistance euclideandistance = output.get(EuclideanDistance.class);
      for (int i = 0; i < expectedValues.length; i++) {
        assertEquals(euclideandistance.similarity(first[i], second[i]), expectedValues[i]);
      }
    }
    if (similarity.equals("Comparator")) {
      PerformanceVector performancevector = output.get(PerformanceVector.class);
      assertEquals(
          expectedValues[0], performancevector.getCriterion("similarity").getAverage(), 0.00001);
    }
  }
  /**
   * Applies the applier and evaluator (= second encapsulated inner operator). In order to reuse
   * possibly created predicted label attributes, we do the following: We compare the predicted
   * label of <code>testSet</code> before and after applying the inner operator. If it changed, the
   * predicted label is removed again. No outer operator could ever see it. The same applies for the
   * confidence attributes in case of classification learning.
   */
  public IOContainer evaluate(ExampleSet testSet, IOContainer learnResult)
      throws OperatorException {
    if (learnResult == null) {
      throw new RuntimeException(
          "Wrong use of ValidationChain.evaluate(ExampleSet): "
              + "No preceding invocation of learn(ExampleSet)!");
    }
    Attribute predictedBefore = testSet.getAttributes().getPredictedLabel();
    IOContainer evalInput = learnResult.append(new IOObject[] {testSet});
    IOContainer result = getEvaluator().apply(evalInput);
    Attribute predictedAfter = testSet.getAttributes().getPredictedLabel();

    // remove predicted label and confidence attributes if there is a new prediction which is not
    // equal to an old one
    if ((predictedAfter != null)
        && ((predictedBefore == null)
            || (predictedBefore.getTableIndex() != predictedAfter.getTableIndex()))) {
      PredictionModel.removePredictedLabel(testSet);
    }
    return result;
  }