use of org.gitia.froog.layer.Layer in project froog by mroodschild.
the class LayerTest method testOutputZ.
/**
* Test of outputZ method, of class Layer.
*/
@Test
public void testOutputZ() {
SimpleMatrix w1 = new SimpleMatrix(2, 2, true, 0.1, 0.2, 0.3, 0.4);
SimpleMatrix b1 = new SimpleMatrix(2, 1, true, 0.5, 0.1);
Layer layer = new Layer(w1, b1, "tansig");
SimpleMatrix entrada = new SimpleMatrix(2, 1, true, 0.2, 0.6);
double[] esperado = { 0.64, 0.4 };
assertArrayEquals(esperado, layer.outputZ(entrada).getMatrix().getData(), 0.0001);
}
use of org.gitia.froog.layer.Layer in project froog by mroodschild.
the class LayerTest method testOutputZ.
/**
* Test of outputZ method, of class Layer.
*/
@Test
@Ignore
public void testOutputZ() {
System.out.println("outputZ");
SimpleMatrix a = null;
Layer instance = new Layer();
SimpleMatrix expResult = null;
SimpleMatrix result = instance.outputZ(a);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
use of org.gitia.froog.layer.Layer in project froog by mroodschild.
the class LayerTest method testOutput_doubleArr.
/**
* Test of output method, of class Layer.
*/
@Test
public void testOutput_doubleArr() {
System.out.println("output");
SimpleMatrix w = new SimpleMatrix(2, 3, true, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6);
SimpleMatrix b = new SimpleMatrix(2, 1, true, 0.1, 0.2);
double[] input = { 0.2, 0.4, 0.6 };
Layer instance = new Layer(w, b, TransferFunction.LOGSIG);
double[] expResult = { 0.5938731029341, 0.6984652160025 };
double[] result = instance.output(input).getMatrix().getData();
assertArrayEquals(expResult, result, 0.0000000000001);
}
use of org.gitia.froog.layer.Layer in project froog by mroodschild.
the class LayerTest method testOutputN.
/**
* Test of outputN method, of class Layer.
*/
@Test
@Ignore
public void testOutputN() {
System.out.println("outputN");
SimpleMatrix z = null;
Layer instance = new Layer();
SimpleMatrix expResult = null;
SimpleMatrix result = instance.outputN(z);
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
use of org.gitia.froog.layer.Layer in project froog by mroodschild.
the class Save method process.
private static void process(Feedforward net) {
for (int i = 0; i < net.getLayers().size(); i++) {
Layer layer = net.getLayers().get(i);
formatter.format("\n<layer>");
formatter.format("\n\t<transferFunction>%s</transferFunction>", layer.getFunction().toString());
formatter.format("\n\t<w>%s</w>", Arrays.toString(layer.getW().getMatrix().data).replace("[", "").replace("]", ""));
formatter.format("\n\t<bias>%s</bias>", Arrays.toString(layer.getB().getMatrix().data).replace("[", "").replace("]", ""));
formatter.format("\n</layer>");
}
}
Aggregations