@Test public void testPropagateOnes() throws Exception { MLP mlp = new MLP(2, 2, 1); double[][] output = mlp.propagate(new double[] { 1, 1 }); Assert.assertArrayEquals(new double[] { 0, 0 }, output[0], 0.001); Assert.assertArrayEquals(new double[] { 0 }, output[1], 0.001); double[][] output2 = mlp2.propagate(new double[] { 1, 1 }); Assert.assertArrayEquals(new double[] { 3, 3 }, output2[0], 0.001); Assert.assertArrayEquals(new double[] { 7 }, output2[1], 0.001); }
public double[][] propagate(double[] input) { Preconditions.checkArgument(input.length == layers[0].getNumInputs()); double[][] outputs = new double[layers.length][]; for (int i = 0; i < layers.length; i++) { outputs[i] = layers[i].propagate((i == 0) ? input : outputs[i - 1]); } return outputs; }
MLP implements RealFunction, Serializable { public double[][] propagate(double[] input) { Preconditions.checkArgument(input.length == layers[0].getNumInputs()); double[][] outputs = new double[layers.length][]; for (int i = 0; i < layers.length; i++) { outputs[i] = layers[i].propagate((i == 0) ? input : outputs[i - 1]); } return outputs; } }
MLP implements RealFunction, Serializable { public double[][] propagate(double[] input) { Preconditions.checkArgument(input.length == layers[0].getNumInputs()); double[][] outputs = new double[layers.length][]; for (int i = 0; i < layers.length; i++) { outputs[i] = layers[i].propagate((i == 0) ? input : outputs[i - 1]); } return outputs; } @AccessedViaReflection  MLP(int numInputs, int numHiddenNeurons, int numOutputs);  MLP(Layer[] layers); }
MLP implements RealFunction, Serializable { public double[][] propagate(double[] input) { Preconditions.checkArgument(input.length == layers[0].getNumInputs()); double[][] outputs = new double[layers.length][]; for (int i = 0; i < layers.length; i++) { outputs[i] = layers[i].propagate((i == 0) ? input : outputs[i - 1]); } return outputs; } @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 { public double[][] propagate(double[] input) { Preconditions.checkArgument(input.length == layers[0].getNumInputs()); double[][] outputs = new double[layers.length][]; for (int i = 0; i < layers.length; i++) { outputs[i] = layers[i].propagate((i == 0) ? input : outputs[i - 1]); } return outputs; } @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);  }