@Test public void testUpdate() throws Exception { mlp2.updateWeights(mlp2.getWeightUpdates(new double[] { 0, 0 }, 1, 0.1)); for (int i = 0; i < 3; i++) { Assert.assertEquals(0.8, outputNeurons[0].getWeight(i), 0.001); } Assert.assertEquals(0.8, hiddenNeurons[0].getWeight(0), 0.001); Assert.assertEquals(0.8, hiddenNeurons[1].getWeight(0), 0.001); Assert.assertEquals(1, hiddenNeurons[0].getWeight(1), 0.001); Assert.assertEquals(1, hiddenNeurons[1].getWeight(1), 0.001); Assert.assertEquals(1, hiddenNeurons[0].getWeight(2), 0.001); Assert.assertEquals(1, hiddenNeurons[1].getWeight(2), 0.001); }
@Override public void update(double[] input, double correctValue, double alpha) { double[][] outputs = propagate(input); double[][] errors = backPropagate(outputs, correctValue); layers[0].updateWeights(input, outputs[0], errors[0], alpha); for (int layer = 1; layer < layers.length; layer++) { layers[layer].updateWeights(outputs[layer - 1], outputs[layer], errors[layer], alpha); } }
MLP implements RealFunction, Serializable { @Override public void update(double[] input, double correctValue, double alpha) { double[][] outputs = propagate(input); double[][] errors = backPropagate(outputs, correctValue); layers[0].updateWeights(input, outputs[0], errors[0], alpha); for (int layer = 1; layer < layers.length; layer++) { layers[layer].updateWeights(outputs[layer - 1], outputs[layer], errors[layer], alpha); } } }
MLP implements RealFunction, Serializable { @Override public void update(double[] input, double correctValue, double alpha) { double[][] outputs = propagate(input); double[][] errors = backPropagate(outputs, correctValue); layers[0].updateWeights(input, outputs[0], errors[0], alpha); for (int layer = 1; layer < layers.length; layer++) { layers[layer].updateWeights(outputs[layer - 1], outputs[layer], errors[layer], alpha); } } @AccessedViaReflection  MLP(int numInputs, int numHiddenNeurons, int numOutputs);  MLP(Layer[] layers); }
MLP implements RealFunction, Serializable { @Override public void update(double[] input, double correctValue, double alpha) { double[][] outputs = propagate(input); double[][] errors = backPropagate(outputs, correctValue); layers[0].updateWeights(input, outputs[0], errors[0], alpha); for (int layer = 1; layer < layers.length; layer++) { layers[layer].updateWeights(outputs[layer - 1], outputs[layer], errors[layer], alpha); } } @AccessedViaReflection  MLP(int numInputs, int numHiddenNeurons, int numOutputs);  MLP(Layer[] layers); @Override double getValue(double[] input); double[][] propagate(double[] input); double[] getWeightUpdates(double[] input, double targetValue, double alpha); void updateWeights(double[] updates); @Override void update(double[] input, double correctValue, double alpha); double[][] backPropagate(double[][] outputs, double correctValue); double[] getWeights(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static MLP fromWeights(double[] weights, MLP template); static MLP createRandomizedMLP(MLP template, double minWeight, double maxWeight, RandomDataGenerator random); static MLP createRandomizedMLP(int numInputs, int numHiddenNeurons, int numOutputs, double minWeight,
			double maxWeight, RandomDataGenerator random); }
MLP implements RealFunction, Serializable { @Override public void update(double[] input, double correctValue, double alpha) { double[][] outputs = propagate(input); double[][] errors = backPropagate(outputs, correctValue); layers[0].updateWeights(input, outputs[0], errors[0], alpha); for (int layer = 1; layer < layers.length; layer++) { layers[layer].updateWeights(outputs[layer - 1], outputs[layer], errors[layer], alpha); } } @AccessedViaReflection  MLP(int numInputs, int numHiddenNeurons, int numOutputs);  MLP(Layer[] layers); @Override double getValue(double[] input); double[][] propagate(double[] input); double[] getWeightUpdates(double[] input, double targetValue, double alpha); void updateWeights(double[] updates); @Override void update(double[] input, double correctValue, double alpha); double[][] backPropagate(double[][] outputs, double correctValue); double[] getWeights(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static MLP fromWeights(double[] weights, MLP template); static MLP createRandomizedMLP(MLP template, double minWeight, double maxWeight, RandomDataGenerator random); static MLP createRandomizedMLP(int numInputs, int numHiddenNeurons, int numOutputs, double minWeight,
			double maxWeight, RandomDataGenerator random);  }