NetworkUtil { public static void activateLayer(double[][] nodes, int ftype) { for (int i = 0; i < nodes.length; i++) { for (int j = 0; j < nodes[0].length; j++) { nodes[i][j] = ActivationFunctions.activation(ftype, nodes[i][j]); } } }  static double calculateWeight(double originalOutput); static double[] propagateOneStep(double[] fromLayer, double[] toLayer, double[][] connections); static void propagateOneStep(double[][] fromLayer, double[][] toLayer, double[][][][] connections); static void activateLayer(double[][] nodes, int ftype);  }
@Test public void activateLayerTest() { double[][] originalValue = {{0.1, 0.2}, {0.3, 0.4}}; double[][] changedValue = originalValue.clone(); NetworkUtil.activateLayer(changedValue, ActivationFunctions.FTYPE_TANH); double[][] actualValue = {{Math.tanh(.1), Math.tanh(.2)}, {Math.tanh(.3), Math.tanh(.4)}}; assertEquals(changedValue.length, actualValue.length); assertEquals(changedValue[0].length, actualValue[0].length); for(int i = 0; i < changedValue.length; i++) { for(int j = 0; j < changedValue[0].length; j++) { assertEquals(changedValue[i][j], actualValue[i][j], .00000001); } } }