Package org.neuroph.core

Examples of org.neuroph.core.Weight


      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          if (index >= weights.length)
            throw new EncogEngineError("Weight size mismatch.");

          Weight weight = connection.getWeight();
          FlatWeight flatWeight = new FlatWeight(weights, index++);
          flatWeight.setValue(weight.getValue());
          connection.setWeight(flatWeight);
        }
      }
    }
  }
View Full Code Here


    for (int layerIndex = network.getLayers().size() - 1; layerIndex > 0; layerIndex--) {
      Layer layer = network.getLayers().get(layerIndex);

      for (Neuron neuron : layer.getNeurons()) {
        for (Connection connection : neuron.getInputConnections()) {
          Weight weight = connection.getWeight();

          if (weight instanceof FlatWeight) {
            Weight weight2 = new Weight(weight.getValue());
            //weight2.setPreviousValue(weight.getPreviousValue());
                                                weight2.getTrainingData().set(TrainingData.PREVIOUS_WEIGHT, weight.getTrainingData().get(TrainingData.PREVIOUS_WEIGHT));
            connection.setWeight(weight2);
          }
        }
      }
    }
View Full Code Here

            // iterate neurons at each layer
            for (Neuron neuron : layer.getNeurons()) {
                // iterate connections/weights for each neuron
                for (Connection connection : neuron.getInputConnections()) {
                    // for each connection weight apply accumulated weight change
                    Weight weight = connection.getWeight();
                    // get deltaWeightSum
                    double deltaWeightSum = weight.getTrainingData().get(TrainingData.DELTA_WEIGHT_SUM);
                    // apply the deltaWeightSum
                    weight.inc(deltaWeightSum);
                    // reset the deltaWeightSum to prepare it for next epoch
                    weight.getTrainingData().set(TrainingData.DELTA_WEIGHT_SUM, 0);
                }
            }
        }
    }
View Full Code Here

    protected void initTrainingDataBuffer() {
        for (int i = neuralNetwork.getLayersCount() - 1; i > 0; i--) {
            Layer layer = neuralNetwork.getLayers().get(i);
            for (Neuron neuron : layer.getNeurons()) {
                for (Connection connection : neuron.getInputConnections()) {
                    Weight weight = connection.getWeight();
                    weight.initTrainingDataBuffer(this.trainingDataBufferSize);
                }
            }
        }
    }
View Full Code Here

    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

                        // tanh can be used to minimise the impact of big error values, which can cause network instability
                        // suggested at https://sourceforge.net/tracker/?func=detail&atid=1107579&aid=3130561&group_id=238532
                        // double neuronError = Math.tanh(neuron.getError());
     
      Weight weight = connection.getWeight();
     
      double currentWeighValue = weight.getValue();
      double previousWeightValue = weight.getTrainingData().get(TrainingData.PREVIOUS_WEIGHT);
      double deltaWeight = this.learningRate * neuronError * input +
        momentum * (currentWeighValue - previousWeightValue);
                        // save previous weight value
                        weight.getTrainingData().set(TrainingData.PREVIOUS_WEIGHT, currentWeighValue);
                        this.applyWeightChange(weight, deltaWeight);
    }
  }
View Full Code Here

TOP

Related Classes of org.neuroph.core.Weight

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.