use of org.ejml.simple.SimpleMatrix 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.ejml.simple.SimpleMatrix 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.ejml.simple.SimpleMatrix 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.ejml.simple.SimpleMatrix in project froog by mroodschild.
the class BackpropagationBachTest method testComputeCost_SimpleMatrix_SimpleMatrix.
// /**
// * Test of calcularGradientes method, of class BackpropagationBach.
// */
// @Ignore
// @Test
// public void testCalcularGradientes() {
// System.out.println("calcularGradientes");
// Backpropagation instance = new Backpropagation();
// double expResult = 0.0;
// double result = instance.calcularGradientes();
// assertEquals(expResult, result, 0.0);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
/**
* Test of computeCost method, of class BackpropagationBach.
*/
@Ignore
@Test
public void testComputeCost_SimpleMatrix_SimpleMatrix() {
System.out.println("computeCost");
SimpleMatrix input = null;
SimpleMatrix Yobs = null;
Backpropagation instance = new Backpropagation();
double expResult = 0.0;
double result = instance.cost(input, Yobs);
assertEquals(expResult, result, 0.0);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
use of org.ejml.simple.SimpleMatrix in project froog by mroodschild.
the class RMSE method costAll.
/**
* Ingresan matrices donde cada columna representa una caracterÃstica de salida
* y cada fila representa un nuevo registro, luego se implementa el mse
* entre las "y<sub>observadas</sub>" y las "y<sub>calculadas</sub>" <br>
* <br>
* [Y<sub>11</sub>, Y<sub>12</sub>, Y<sub>13</sub>]<br>
* [Y<sub>21</sub>, Y<sub>22</sub>, Y<sub>23</sub>]<br>
* [Y<sub>31</sub>, Y<sub>32</sub>, Y<sub>33</sub>]<br>
* [..., ..., ...]<br>
* [Y<sub>n1</sub>, Y<sub>n2</sub>, Y<sub>n3</sub>]<br>
*
* @param Ycalc
* @param Yobs
* @return RMSE = sqrt(∑[(||(Yobs - Ycalc)||^2)/2]/m)
*/
@Override
public double costAll(SimpleMatrix Ycalc, SimpleMatrix Yobs) {
SimpleMatrix y = Yobs.minus(Ycalc);
// elementos al cuadrado, sumamos y realizamos la media
double sum2 = y.elementMult(y).elementSum();
return Math.sqrt(sum2 / (2 * y.numRows()));
}
Aggregations