// create training set (logical XOR function)
TrainingSet trainingSet = new TrainingSet(2, 1);
trainingSet.addElement(new SupervisedTrainingElement(new double[]{0, 0}, new double[]{0}));
trainingSet.addElement(new SupervisedTrainingElement(new double[]{0, 1}, new double[]{1}));
trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 0}, new double[]{1}));
trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 1}, new double[]{0}));
MultiLayerPerceptron nnet = new MultiLayerPerceptron( TransferFunctionType.TANH ,2, 3, 1);
MatrixMultiLayerPerceptron mnet = new MatrixMultiLayerPerceptron(nnet);
System.out.println("Training network...");