MLP implements Network { @Override public double[] process(double[] inputs) { return propagate(inputs); } MLP(MLPGenotype genotype);  MLP(int numberOfInputs, int numberOfHidden, int numberOfOutputs);  MLP(double[][] firstConnectionLayer, double[][] secondConnectionLayer);  MLP(double[][] firstConnectionLayer, double[][] secondConnectionLayer, int numberOfHidden,
			int numberOfOutputs); @Override /** * returns number of inputs */ int numInputs(); @Override /** * returns number of outputs */ int numOutputs(); @Override /** * processes inputs via propagation */ double[] process(double[] inputs); @Override /** * Clears MLP so SRN can be reused */ void flush(); @Override /** * Unwritten method, will become useful * once mulitask learning is developed for MLPs */ boolean isMultitask(); @Override /** * Chooses the node corresponding to the input */ void chooseMode(int mode); double[] propagate(double[] inputIn); final void initializeAllLayersRandom(); MLP copy(); double sum(); void println(); double backPropagate(double[] targetOutputs); String info(); @Override /** * default toString method */ String toString(); @Override /** * Not supported yet */ int effectiveNumOutputs(); @Override /** * not supported yet */ double[] moduleOutput(int mode); @Override /** * not supported yet */ int lastModule(); @Override /** *not supported yet */ int numModules(); @Override /** * not supported yet */ int[] getModuleUsage(); public double[][] firstConnectionLayer; public double[][] secondConnectionLayer; public double learningRate; }
@Test public void testProcess() { double[] calculatedOutputs = mlp.process(new double[] {0.5}); double[] realOutputs = {Math.tanh(Math.tanh(mlp.inputs[0]*mlp.firstConnectionLayer[0][0])*mlp.secondConnectionLayer[0][0])}; assertEquals(calculatedOutputs[0], realOutputs[0], .000001); }