use of org.gitia.froog.Feedforward in project froog by mroodschild.
the class Feedforward2Test method testLayer.
@Test
public void testLayer() {
Feedforward net = new Feedforward();
net.addLayer(new Layer(4, 2, "tansig"));
net.addLayer(new Layer(2, 2, "purelim"));
assertEquals("Dimensiones Entrada", 8, net.getLayers().get(0).getW().getNumElements());
assertEquals("Dimensiones Entrada", 4, net.getLayers().get(1).getW().getNumElements());
}
use of org.gitia.froog.Feedforward in project froog by mroodschild.
the class Feedforward2Test method testSalida2.
@Test
public void testSalida2() {
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);
SimpleMatrix w2 = new SimpleMatrix(3, 2, true, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6);
SimpleMatrix b2 = new SimpleMatrix(3, 1, true, 0.5, 0.1, 0.2);
SimpleMatrix w3 = new SimpleMatrix(2, 3, true, 0.5, 0.6, 0.9, 0.7, 0.8, 1.0);
SimpleMatrix b3 = new SimpleMatrix(2, 1, true, 0.2, 0.4);
Feedforward net = new Feedforward();
net.addLayer(new Layer(w1, b1, "tansig"));
net.addLayer(new Layer(w2, b2, "tansig"));
net.addLayer(new Layer(w3, b3, "purelim"));
double[] entrada = { 0.2, 0.6 };
double[] esperado = { 1.2686148090686, 1.7212904026294 };
// List<Layer> layers = net.getLayers();
// for (int i = 0; i < layers.size(); i++) {
// Layer l = layers.get(i);
// System.out.println("Layer: " + i + " tipo: " + l.toString());
// l.getW().print();
// }
// System.out.println("Salida:");
// net.output(entrada).print("%.4f");
assertArrayEquals(esperado, net.output(entrada).getMatrix().getData(), 0.000000000001);
}
use of org.gitia.froog.Feedforward in project froog by mroodschild.
the class Open method getNet.
public static Feedforward getNet(String file, String folder) {
net = new Feedforward();
archivo = new File(folder + "/" + file);
if (archivo != null) {
agregarCapas();
}
return net;
}
use of org.gitia.froog.Feedforward in project froog by mroodschild.
the class BackpropagationBachTest method testEntrenar.
/**
* Test of entrenar method, of class BackpropagationBach.
*/
@Ignore
@Test
public void testEntrenar() {
System.out.println("entrenar");
Feedforward net = null;
double[][] input = null;
double[][] output = null;
int iteraciones = 0;
Backpropagation instance = new Backpropagation();
instance.setEpoch(iteraciones);
instance.entrenar(net, input, output);
// 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.Feedforward in project froog by mroodschild.
the class Feedforward2Test method testSalida.
@Test
public void testSalida() {
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);
SimpleMatrix w2 = new SimpleMatrix(2, 2, true, 0.5, 0.6, 0.7, 0.8);
SimpleMatrix b2 = new SimpleMatrix(2, 1, true, 0.2, 0.4);
Feedforward net = new Feedforward();
net.addLayer(new Layer(w1, b1, "tansig"));
net.addLayer(new Layer(w2, b2, "purelim"));
double[] entrada = { 0.2, 0.6 };
double[] esperado = { 0.7104, 1.0993 };
assertArrayEquals(esperado, net.output(entrada).getMatrix().getData(), 0.0001);
}
Aggregations