Package org.neuroph.nnet.comp

Examples of org.neuroph.nnet.comp.ThresholdNeuron


   */
  @Override
  protected void updateNetworkWeights(double[] patternError) {
    int i = 0;
    for(Neuron outputNeuron : neuralNetwork.getOutputNeurons()) {
      ThresholdNeuron neuron = (ThresholdNeuron)outputNeuron;
      double outputError = patternError[i];
      double thresh = neuron.getThresh();
      double netInput = neuron.getNetInput();
      double threshError =  thresh - netInput; // distance from zero
                        // use output error to decide weathet to inrease, decrase or leave unchanged weights
                        // add errorCorrection to threshError to move above or below zero
                        double neuronError = outputError * (Math.abs(threshError) + errorCorrection);

                        // use same adjustment principle as PerceptronLearning,
                        // just with different neuronError
                        neuron.setError(neuronError);
      updateNeuronWeights(neuron);

      i++;
    } // for
  }
View Full Code Here


  protected void updateNeuronWeights(Neuron neuron) {
                // adjust the input connection weights with method from superclass
                super.updateNeuronWeights(neuron);

                // and adjust the neurons threshold
                ThresholdNeuron thresholdNeuron = (ThresholdNeuron)neuron;
                // get neurons error
                double neuronError = thresholdNeuron.getError();
                // get the neurons threshold
                double thresh = thresholdNeuron.getThresh();
                // calculate new threshold value
                thresh = thresh - this.learningRate * neuronError;
                // apply the new threshold
                thresholdNeuron.setThresh(thresh);
  }
View Full Code Here

TOP

Related Classes of org.neuroph.nnet.comp.ThresholdNeuron

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.