Package com.neuralnetwork.shared.links

Examples of com.neuralnetwork.shared.links.Link


    }
   
    @Override
    public final ILink addInputLink(
            final INeuron inode, final DoubleValue weight) {
        this.inputLinks.add(++numInputLinks, new Link(this, inode, weight));
        return inputLinks.get(numInputLinks);
    }
View Full Code Here


    }

    @Override
    public final ILink addOutputLink(
            final INeuron inode, final DoubleValue weight) {
        ILink l = new Link(this, inode, weight);
        this.getOutputs().add(++numOutputLinks, l);
        inode.addInputLink(this, weight);
        return getOutputs().get(numOutputLinks);
    }
View Full Code Here

   * com.neuralnetwork.shared.values.IValue)}.
   */
  @Test
    public final void testLink() {
    INeuron n = new HiddenNeuron();
    ILink l = new Link(n, n, new OneValue());
    assertNotNull(l);
   
    try {
      new Link(null, n, new OneValue());
    } catch (NeuronLinkException e) {
      assertEquals(e.getMessage(), "Head link was null.");
    }
   
    try {
      new Link(n, null, new OneValue());
    } catch (NeuronLinkException e) {
      assertEquals(e.getMessage(), "Tail link was null.");
    }
   
    l = new Link(n, n, null);
    assertEquals(l.getWeight(), new ZeroValue());
  }
View Full Code Here

   */
  @Test
  public final void testGetHead() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    assertEquals(l.getHead(), h);
  }
View Full Code Here

   */
  @Test
    public final void testGetTail() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    assertEquals(l.getTail(), t);
  }
View Full Code Here

   */
  @Test
    public final void testGetWeight() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    assertEquals(l.getWeight(), new OneValue());
  }
View Full Code Here

   */
  @Test
    public final void testSetHead() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    l.setHead(t);
    assertEquals(l.getHead(), t);
   
    try {
      l.setHead(null);
    } catch (NeuronLinkException e) {
      assertEquals(e.getMessage(), "Error cannot set null head.");
    }
  }
View Full Code Here

   */
  @Test
    public final void testSetTail() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    l.setTail(h);
    assertEquals(l.getTail(), h);
   
    try {
      l.setTail(null);
    } catch (NeuronLinkException e) {
      assertEquals(e.getMessage(), "Error cannot set null tail.");
    }
  }
View Full Code Here

   */
  @Test
    public final void testUpdateWeight() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new ZeroValue());
    l.updateWeight(new DoubleValue(WEIGHT_TEST_VALUE));
    assertEquals(l.getWeight(), new DoubleValue(WEIGHT_TEST_VALUE));
    l.updateWeight(new DoubleValue(-WEIGHT_TEST_VALUE));
    assertEquals(l.getWeight(), new DoubleValue(0.0));
  }
View Full Code Here

   */
  @Test
    public final void testSetWeight() {
    IHiddenNeuron h = new HiddenNeuron();
    IHiddenNeuron t = new HiddenNeuron();
    ILink l = new Link(h, t, new OneValue());
    l.setWeight(new DoubleValue(WEIGHT_TEST_VALUE3));
    assertEquals(l.getWeight(), new DoubleValue(WEIGHT_TEST_VALUE3));
  }
View Full Code Here

TOP

Related Classes of com.neuralnetwork.shared.links.Link

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.