Package com.neuralnetwork.shared.network

Examples of com.neuralnetwork.shared.network.Network


     * @param numOutputs
     *      the number of outputs to the neural network to build
     */

    public NeuralNetBuilder(final int numInputs, final int numOutputs) {
        network = new Network(numInputs, numOutputs);
    }
View Full Code Here


     *
     * @param networkConfig
     *      the new network configuration settings
     */
    private void buildWithSettings(final NetworkConfig networkConfig) {
        network = new Network(networkConfig.getNumInputs(),
                              networkConfig.getNumOuputs());
        for (int layerSize : networkConfig.getLayerSizes()) {
            network.addHiddenLayer(new HiddenLayer(layerSize));
        }
    }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#Network(int, int, int)}.
   */
  @Test
    public final void testNetworkIntIntIntIntArray() {
    INetwork n = new Network(TWO, THREE, ONE, new int[] {THREE});
    n.build();
    assertNotNull(n);
   
    try {
      n = new Network(TWO, THREE, -ONE, new int[] {THREE});
    } catch (IllegalArgumentException e) {
      assertEquals(e.getMessage(),
          "Error cannot have negative amount of hidden layers.");
    }
   
    try {
      n = new Network(TWO, -THREE, ONE, new int[] {THREE});
    } catch (IllegalArgumentException e) {
      assertEquals(e.getMessage(),
          "Error cannot have negative amount of output layers.");
    }
   
    try {
      n = new Network(-TWO, THREE, ONE, new int[] {THREE});
    } catch (IllegalArgumentException e) {
      assertEquals(e.getMessage(),
          "Error cannot have negative amount of input layers.");
    }
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#Network(int, int)}.
   */
  @Test
    public final void testNetworkIntInt() {
    INetwork n = new Network(FIVE, FIVE);
    n.build();
    assertNotNull(n);
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#getNeuron(int, int)}.
   */
  @Test
    public final void testGetNeuron() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    assertNotNull(n);
    assertNotNull(n.getNeuron(0, 0));
    assertNotNull(n.getNeuron(ONE, 0));
    assertNotNull(n.getNeuron(TWO, 0));
    assertNotNull(n.getNeuron(THREE, 0));
    assertNotNull(n.getNeuron(FOUR, 0));
    assertNotNull(n.getNeuron(0, ONE));
    assertNotNull(n.getNeuron(ONE, ONE));
    assertNotNull(n.getNeuron(TWO, ONE));
    assertNotNull(n.getNeuron(THREE, ONE));
    assertNotNull(n.getNeuron(0, TWO));
    assertNotNull(n.getNeuron(ONE, TWO));
    assertNotNull(n.getNeuron(0, THREE));
    assertNotNull(n.getNeuron(ONE, THREE));
    assertNotNull(n.getNeuron(TWO, THREE));
    assertNotNull(n.getNeuron(THREE, THREE));
    assertNotNull(n.getNeuron(0, FOUR));
    assertNotNull(n.getNeuron(ONE, FOUR));
    assertNotNull(n.getNeuron(TWO, FOUR));
    assertNotNull(n.getNeuron(THREE, FOUR));
    assertNotNull(n.getNeuron(FOUR, FOUR));

    assertNull(n.getNeuron(Integer.MAX_VALUE, 0));

    assertNull(n.getNeuron(-TWO, 0));
    assertNull(n.getNeuron(0, -TWO));
    assertNull(n.getNeuron(ONE, -TWO));
    assertNull(n.getNeuron(0, THREE * TWO));
    assertNull(n.getNeuron(-ONE, -ONE));
    assertNull(n.getNeuron(-ONE, THREE * TWO));
   
  }
 
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#getOutputNeuron(int)}.
   */
  @Test
    public final void testGetOutputNeuron() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    assertEquals(n.getOutputNeuron(0).getType(), NeuronType.OUTPUT);
    assertEquals(n.getOutputNeuron(ONE).getType(), NeuronType.OUTPUT);
    assertEquals(n.getOutputNeuron(TWO).getType(), NeuronType.OUTPUT);
    assertEquals(n.getOutputNeuron(THREE).getType(), NeuronType.OUTPUT);
    assertEquals(n.getOutputNeuron(FOUR).getType(), NeuronType.OUTPUT);
    assertNull(n.getOutputNeuron(-TWO));
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#getInputNeuron(int)}.
   */
  @Test
    public final void testGetInputNeuron() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    assertEquals(n.getInputNeuron(0).getType(), NeuronType.INPUT);
    assertEquals(n.getInputNeuron(ONE).getType(), NeuronType.INPUT);
    assertEquals(n.getInputNeuron(TWO).getType(), NeuronType.INPUT);
    assertEquals(n.getInputNeuron(THREE).getType(), NeuronType.INPUT);
    assertEquals(n.getInputNeuron(FOUR).getType(), NeuronType.INPUT);
    assertNull(n.getInputNeuron(-TWO));
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#getHeight()}.
   */
  @Test
    public final void testGetHeight() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    assertEquals(FIVE, n.getHeight());
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#runInputs(java.util.Vector)}.
   */
  @Test
    public final void testRunInputs() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    Vector<Double> values = new Vector<Double>();
    values.add(NN_INPUT_VALUE);
        values.add(NN_INPUT_VALUE);
        values.add(NN_INPUT_VALUE);
        values.add(NN_INPUT_VALUE);
        values.add(NN_INPUT_VALUE);
    LOGGER.debug(n.runInputs(values).toString());
   
  }
View Full Code Here

   * Test method for {@link com.neuralnetwork
   * .shared.network.Network#reset()}.
   */
  @Test
    public final void testReset() {
    INetwork n = new Network(FIVE, FIVE, THREE,
        new int[] {FOUR, TWO, FOUR});
    n.build();
    n.reset();
  }
View Full Code Here

TOP

Related Classes of com.neuralnetwork.shared.network.Network

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.