Examples of Neuron


Examples of org.neuroph.core.Neuron

  // get unit with closetst weight vector
  private Neuron getClosest() {
    Iterator<Neuron> i = this.neuralNetwork.getLayerAt(1)
        .getNeuronsIterator();
    Neuron winner = new Neuron();
    double minOutput = 100;
    while (i.hasNext()) {
      Neuron n = i.next();
      double out = n.getOutput();
      if (out < minOutput) {
        minOutput = out;
        winner = n;
      } // if
    } // while
View Full Code Here

Examples of org.neuroph.core.Neuron

  public double[] getOutput(List<Connection> inputConnections) {
    double[] output = new double[inputConnections.size()];

                int i = 0;
    for(Connection connection : inputConnections) {
      Neuron neuron = connection.getFromNeuron();
      Weight weight = connection.getWeight();
      output[i++] = neuron.getOutput() - weight.getValue();
    }

    return output;
  }
View Full Code Here

Examples of org.neuroph.core.Neuron

  }

  @Test
  public void testOnRandomConnections() {
    // arrange
    Neuron Fromneuron = new Neuron();
    Fromneuron.setInput(.9d);
    Fromneuron.calculate();
    Neuron toneuron1 = new Neuron(), toneuron2 = new Neuron(), toneuron3 = new Neuron();
    List<Connection> inputConnections = new ArrayList<Connection>();
    {
      {
        Connection connection = new Connection(Fromneuron, toneuron1,
            0.5d);
View Full Code Here

Examples of org.neuroph.core.Neuron

  }

  @Test
  public void testOnRandomConnections() {
    // arrange
            Neuron Fromneuron=new Neuron();
    List<Connection> inputConnections = new ArrayList<Connection>();
    {
      {
        Connection connection = new Connection(Fromneuron,new Neuron(), 0.5d);
        inputConnections.add(connection);
      }
      {
        Connection connection = new Connection(Fromneuron,new Neuron(), 0.25d);
        inputConnections.add(connection);
      }
      {
        Connection connection = new Connection(Fromneuron,new Neuron(), -0.25d);
        inputConnections.add(connection);
      }
    }
   
    // act
View Full Code Here

Examples of tv.floe.metronome.classification.neuralnetworks.core.neurons.Neuron

  @Test
  public void testCalculate() throws Exception {
   
   
    Neuron input_layer_neuron_0 = new InputNeuron();
    Neuron input_layer_neuron_1 = new InputNeuron();
    Neuron input_layer_neuron_2 = new InputNeuron();
   
   
    Neuron middle_layer_neuron_0 = new Neuron();
    Neuron middle_layer_neuron_1 = new Neuron();
    Neuron middle_layer_neuron_2 = new Neuron();
   

    middle_layer_neuron_0.addInConnection(input_layer_neuron_0, 1.0);
   
    middle_layer_neuron_1.addInConnection(input_layer_neuron_0, 1.0);
    middle_layer_neuron_1.addInConnection(input_layer_neuron_1, 1.0);
   
    middle_layer_neuron_2.addInConnection(input_layer_neuron_0, 1.0);
    middle_layer_neuron_2.addInConnection(input_layer_neuron_1, 1.0);
    middle_layer_neuron_2.addInConnection(input_layer_neuron_2, 1.0);
   
   
   
   
    input_layer_neuron_0.setInput(0.2d);
    input_layer_neuron_1.setInput(0.2d);
   
    input_layer_neuron_2.setInput(0.3d);
   
   
/*   
   
    assertEquals( 0.2f, input_layer_neuron_0.getNetInput(), 0.0001f );
   
    input_layer_neuron_0.calcOutput();
    double n0_out = input_layer_neuron_0.getOutput();
   
    assertEquals(0.2f, n0_out, 0.000001f);
*/
    // ------ test: Middle Layer > Neuron 1 ----------
   
    input_layer_neuron_0.calcOutput();
    input_layer_neuron_1.calcOutput();
   
//    System.out.println("\n\n\n> CalcOutput --------");
    middle_layer_neuron_1.calcOutput();
    double n1_1_out = middle_layer_neuron_1.getOutput();
   
//    System.out.println("> CalcOutput --------\n\n");
//    assertEquals(0.4f, n1_1_out, 0.000001f);
   
    System.out.println("out: " + n1_1_out );

    // ------ test: Middle Layer > Neuron 2 ----------
   
    input_layer_neuron_2.calcOutput();

    middle_layer_neuron_2.calcOutput();
    double n2_1_out = middle_layer_neuron_2.getOutput();
   
//    System.out.println("> CalcOutput --------\n\n");
//    assertEquals(0.7d, n2_1_out, 0.000001f);
   
    System.out.println("out: " + n2_1_out );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.