// train the neural network
final MLTrain train = new ResilientPropagation(network, trainingSet);
do {
train.iteration();
} while (train.getError() > 0.009);
double e = network.calculateError(trainingSet);
System.out.println("Network traiined to error: " + e);