Vector error = new Vector(1);
error.setValue(0, 1.261);
double learningRate = 0.1;
double momentumFactor = 0.5;
FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(
hiddenLayerWeightMatrix, hiddenLayerBiasVector,
outputLayerWeightMatrix, outputLayerBiasVector);
ffnn.setTrainingScheme(new BackPropLearning(learningRate,
momentumFactor));
ffnn.processInput(input);
ffnn.processError(error);
Matrix finalHiddenLayerWeights = ffnn.getHiddenLayerWeights();
Assert.assertEquals(-0.2675, finalHiddenLayerWeights.get(0, 0), 0.001);
Assert.assertEquals(-0.4149, finalHiddenLayerWeights.get(1, 0), 0.001);
Vector hiddenLayerBias = ffnn.getHiddenLayerBias();
Assert.assertEquals(-0.4775, hiddenLayerBias.getValue(0), 0.001);
Assert.assertEquals(-0.1349, hiddenLayerBias.getValue(1), 0.001);
Matrix finalOutputLayerWeights = ffnn.getOutputLayerWeights();
Assert.assertEquals(0.1304, finalOutputLayerWeights.get(0, 0), 0.001);
Assert.assertEquals(-0.1235, finalOutputLayerWeights.get(0, 1), 0.001);
Vector outputLayerBias = ffnn.getOutputLayerBias();
Assert.assertEquals(0.6061, outputLayerBias.getValue(0), 0.001);
}