Search in sources :

Example 96 with SimpleMatrix

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.");
}
Also used : SimpleMatrix(org.ejml.simple.SimpleMatrix) Layer(org.gitia.froog.layer.Layer) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 97 with SimpleMatrix

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);
}
Also used : SimpleMatrix(org.ejml.simple.SimpleMatrix) Layer(org.gitia.froog.layer.Layer) Test(org.junit.Test)

Example 98 with SimpleMatrix

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.");
}
Also used : SimpleMatrix(org.ejml.simple.SimpleMatrix) Layer(org.gitia.froog.layer.Layer) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 99 with SimpleMatrix

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.");
}
Also used : Backpropagation(org.gitia.froog.trainingalgorithm.Backpropagation) SimpleMatrix(org.ejml.simple.SimpleMatrix) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 100 with SimpleMatrix

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()));
}
Also used : SimpleMatrix(org.ejml.simple.SimpleMatrix)

Aggregations

SimpleMatrix (org.ejml.simple.SimpleMatrix)156 Test (org.junit.Test)30 Layer (org.gitia.froog.layer.Layer)14 Test (org.junit.jupiter.api.Test)13 Map (java.util.Map)12 ArrayList (java.util.ArrayList)11 TransferFunction (org.gitia.froog.transferfunction.TransferFunction)10 Tree (edu.stanford.nlp.trees.Tree)9 TwoDimensionalMap (edu.stanford.nlp.util.TwoDimensionalMap)9 List (java.util.List)8 LexicalizedParser (edu.stanford.nlp.parser.lexparser.LexicalizedParser)7 Pair (edu.stanford.nlp.util.Pair)6 EmbeddingExtractor (edu.stanford.nlp.coref.neural.EmbeddingExtractor)5 Embedding (edu.stanford.nlp.neural.Embedding)5 DeepTree (edu.stanford.nlp.trees.DeepTree)5 CoreLabel (edu.stanford.nlp.ling.CoreLabel)4 SimpleTensor (edu.stanford.nlp.neural.SimpleTensor)4 DVModel (edu.stanford.nlp.parser.dvparser.DVModel)4 Logsig (org.gitia.froog.transferfunction.Logsig)4 Ignore (org.junit.Ignore)4