// calculate the error on test instance
for (double[] testInstance : testInstances) {
DoubleVector instance = new DenseDoubleVector(testInstance);
double expected = instance.get(instance.getDimension() - 1);
instance = instance.slice(instance.getDimension() - 1);
instance = featureTransformer.transform(instance);
double actual = ann.getOutput(instance).get(0);
if (actual < 0.5 && expected >= 0.5 || actual >= 0.5 && expected < 0.5) {
++errorRate;
}
}