Package com.neuralnetwork.shared.values

Examples of com.neuralnetwork.shared.values.DoubleValue


  public final void testEqualsObject() {
    Pair<Object, Object> p = new Pair<Object, Object>(null, null);
    Pair<Object, Object> p1 = new Pair<Object, Object>(null, null);
    assertEquals(p, p1);
   
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertEquals(p, p1);
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    p1 = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    assertEquals(p, p1);
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertFalse(p.equals(p1));
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    p1 = new Pair<Object, Object>(new DoubleValue(D_0_1),
        new DoubleValue(D_0_1));
    assertFalse(p.equals(p1));
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1),
        new DoubleValue(D_2_1));
    p1 = new Pair<Object, Object>(new DoubleValue(D_0_1),
        new DoubleValue(D_0_1));
    assertFalse(p.equals(p1));

    //Test (first == null)
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    assertFalse(p.equals(p1));
   
    //Test (obj == null)
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    p1 = null;
    assertFalse(p.equals(p1));
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    HiddenNeuron n = new HiddenNeuron();
    assertFalse(p.equals(n));
   
    p = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    p1 = new Pair<Object, Object>(new DoubleValue(D_0_1), null);
    assertEquals(p, p1);
    assertEquals(p, p);
  }
View Full Code Here


  @Test
  public final void testGetSecond() {
    Pair<Object, Object> p;
    Pair<Object, Object> p1;
   
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertEquals(p.getSecond(), p1.getSecond());
  }
View Full Code Here

  @Test
  public final void testSetSecond() {
    Pair<Object, Object> p;
    Pair<Object, Object> p1;
   
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertEquals(p.getSecond(), p1.getSecond());
   
    p.setSecond(new DoubleValue(D_1_1));
    p1.setSecond(new DoubleValue(D_1_1));
   
    assertEquals(p.getSecond(), new DoubleValue(D_1_1));
    assertEquals(p1.getSecond(), new DoubleValue(D_1_1));
  }
View Full Code Here

  @Test
  public final void testGetFirst() {
    Pair<Object, Object> p;
    Pair<Object, Object> p1;
   
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertEquals(p.getFirst(), p1.getFirst());
  }
View Full Code Here

  @Test
  public final void testSetFirst() {
    Pair<Object, Object> p;
    Pair<Object, Object> p1;
   
    p = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    p1 = new Pair<Object, Object>(null, new DoubleValue(D_0_1));
    assertEquals(p.getFirst(), p1.getFirst());
   
    p.setFirst(new DoubleValue(D_1_1));
    p1.setFirst(new DoubleValue(D_1_1));
   
    assertEquals(p.getFirst(), new DoubleValue(D_1_1));
    assertEquals(p1.getFirst(), new DoubleValue(D_1_1));
  }
View Full Code Here

   */
  @Test
  public final void testAddInputLinkINeuronIValueOfQ() {
    Neuron n = new InputNeuron();
    Neuron m = new InputNeuron();
    n.addInputLink(m, new DoubleValue(TEST_VALUE1));
    ILink l = n.getInputLink(0);
    assertEquals(l.getWeight(), new DoubleValue(TEST_VALUE1));
    assertEquals(l.getHead(), n);
    assertEquals(l.getTail(), m);
  }
View Full Code Here

    Neuron n = new InputNeuron()
    Neuron n1 = new InputNeuron();
    Neuron m = new HiddenNeuron();
    Neuron o = new OutputNeuron();
    Neuron o1 = new OutputNeuron();
    n.addOutputLink(m, new DoubleValue(TEST_VALUE1));
    n1.addOutputLink(m, new DoubleValue(TEST_VALUE1));
    assertEquals(n.getOutputLink(0).getWeight(),
                 new DoubleValue(TEST_VALUE1));
    assertEquals(n1.getOutputLink(0).getWeight(),
                 new DoubleValue(TEST_VALUE1));
    m.addOutputLink(o);
    m.addOutputLink(o1);
  }
View Full Code Here

    Neuron o1 = new OutputNeuron();
    m.addOutputLink(o);
    m.addOutputLink(o1);
   
    ILink[] l = m.getOutputLinks(0, 1);
    DoubleValue v = l[0].getWeight();
    DoubleValue v1 = l[1].getWeight();
   
    m.reset();
   
    ILink[] l1 = m.getOutputLinks(0, 1);
    DoubleValue v2 = l1[0].getWeight();
    DoubleValue v3 = l1[1].getWeight();
    return v.equals(v2) && v1.equals(v3);
  }
View Full Code Here

     * Test method for {@link com.neuralnetwork
     * .shared.neurons.Neuron#feedforward()}.
     */
    @Test
    public final void testFeedforward() {
        Neuron n = new InputNeuron(new DoubleValue(D_0_1));
        Neuron n1 = new InputNeuron(new DoubleValue(D_0_1));
        Neuron m = new HiddenNeuron();
        Neuron o = new OutputNeuron();
        Neuron o1 = new OutputNeuron();
        n.addOutputLink(m);
        n1.addOutputLink(m);
        m.addOutputLink(o);
        m.addOutputLink(o1);

        assertEquals(m.getInputLink(0), n.getOutputLink(0));

        LOGGER.debug("====== Before Feedforward ======");
        LOGGER.debug(n + " " + n1);
        LOGGER.debug(m.toString());
        LOGGER.debug(o + " " + o1);
        LOGGER.debug("================================");
       
        n.feedforward(new DoubleValue(D_0_1),
            new NeuralNetContext(null));
       
        LOGGER.debug("======= After Feedforward =======");
        LOGGER.debug(n + " " + n1);
        LOGGER.debug(m.toString());
View Full Code Here

    Neuron l = new OutputNeuron();
    Neuron l1 = new InputNeuron();
    assertFalse(l.equals(l1));
   
    Neuron p = new OutputNeuron();
    p.setValue(new DoubleValue());
    Neuron p1 = new OutputNeuron();
    p1.setValue(new DoubleValue(Constants.TEN));
    assertFalse(p.equals(p1));
   
    p.setValue(null);
    p1.setValue(new DoubleValue(Constants.ELEVEN_D));
    assertFalse(p.equals(p1));
   
    p.setValue(null);
    p1.setValue(null);
    assertEquals(p, p1);
View Full Code Here

TOP

Related Classes of com.neuralnetwork.shared.values.DoubleValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.