Package com.neuralnetwork.shared.values

Examples of com.neuralnetwork.shared.values.DoubleValue


        final INeuralNetContext nnctx) {
        double sum = 0.0;
        for (ILink il : getInputs()) {
            sum += il.getWeight().getValue() * v.getValue();
        }
        DoubleValue n = new DoubleValue(getActivationFunction().activate(sum));
        setValue(n);
    return new ErrorValue(n.getValue());
    }
View Full Code Here


        double sum = 0.0;
        for (ILink il : getInputs()) {
            sum += il.getWeight().getValue() * v.getValue();
        }
       
        DoubleValue n = new DoubleValue(getActivationFunction().activate(sum));
        setValue(n);
        ErrorValue e = ErrorValue.ZERO;
        for (ILink ol : getOutputs()) {
            e.updateValue(ol.getTail().feedforward(n, nnctx));
        }
View Full Code Here

    }
   
    @Override
    public void addValues(final Vector<Double> values) {
        for (int i = 0; i < values.size(); i++) {
            set(i, new InputNeuron(new DoubleValue(values.get(i))));
        }
    }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.values.DoubleValue#DoubleValue(double)}.
   */
  @Test
  public final void testDoubleValueDouble() {
    DoubleValue v = new DoubleValue(D_10_32432);
    assertEquals(v.getValue(),
        D_10_32432, Constants.TEN * Math.ulp(v.getValue()));
  }
 
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.values.DoubleValue#setSign(boolean)}.
   */
  @Test
  public final void testSetSign() {
    DoubleValue v = new DoubleValue(D_10_32432);
    assertEquals(v.getValue(), D_10_32432, Constants.TEN
        * Math.ulp(v.getValue()));
    v.setSign(true);
    assertTrue(v.getSign());
    v.setSign(false);
    assertFalse(v.getSign());
    v = new DoubleValue(-1.0);
    v.setSign(true);
    assertTrue(v.getSign());
    v.setSign(false);
    assertFalse(v.getSign());
   
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.values.DoubleValue#getSign()}.
   */
  @Test
  public final void testGetSign() {
    DoubleValue v = new DoubleValue(D_10_32432);
    assertEquals(v.getValue(), D_10_32432, Constants.TEN
        * Math.ulp(v.getValue()));
    v.setSign(true);
    assertTrue(v.getSign());
  }
 
View Full Code Here

   * .shared.values.DoubleValue#updateValue(
   * com.neuralnetwork.shared.values.IValue)}.
   */
  @Test
  public final void testUpdateValue() {   
    DoubleValue v = new DoubleValue(D_10_32432);
    assertEquals(v.getValue(), D_10_32432, Constants.TEN
        * Math.ulp(v.getValue()));
    v.updateValue(new OneValue());
    assertEquals(v.getValue(), D_11_32432, Constants.TEN
        * Math.ulp(v.getValue()));
    v.updateValue(new DoubleValue(INITIAL_VALUE));
    assertEquals(v.getValue(), D_0_32432, Constants.TEN
        * Math.ulp(v.getValue()));
  }
 
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.values.DoubleValue#toString()}.
   */
  @Test
  public final void testToString() {
    assertEquals(new DoubleValue(D_123_123234442).toString(),
        "123.123234442");
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.values.GenericValue#hashCode()}.
   */
  @Test
  public final void testHashCode() {
    GenericValue<?> v = new DoubleValue();
    GenericValue<?> v1 = new DoubleValue();
    assertEquals(v.hashCode(), v1.hashCode());
    v.setValue(null);
    v1.setValue(null);
    assertEquals(v.hashCode(), v1.hashCode());
  }
View Full Code Here

   * .shared.values.GenericValue#setValue(
   * java.lang.Number)}.
   */
  @Test
  public final void testSetValue() {
    GenericValue<Double> v = new DoubleValue();
    GenericValue<Double> v1 = new DoubleValue();
    assertEquals(v.hashCode(), v1.hashCode());
    v.setValue(D_0_1);
    v1.setValue(D_0_1);
    assertEquals(v.getValue(), v1.getValue(),
        Constants.TEN * Math.ulp(v.getValue()));
  }
 
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.