Package com.greentea.relaxation.jnmf.lib.functions

Examples of com.greentea.relaxation.jnmf.lib.functions.IFunction


   private double calcNextE(Neuron candidate, DoubleList weights)
   {
      int pCount = outputNeuronsInfo.values().iterator().next().size();

      IFunction func = outputNeuronsInfo.keySet().iterator().next().getActivationFunction();

      List<NeuronStepInfo> candidateSteps = candidateNeuronsInfo.get(candidate);

      double e = 0;
      for (int j = 0; j < getOutputNeurons().size(); ++j)
      {
         double w = weights.get(j);
         List<NeuronStepInfo> neuronSteps = outputNeuronsInfo.get(getOutputNeurons().get(j));

         for (int i = 0; i < neuronSteps.size(); ++i)
         {
            NeuronStepInfo outputNeuronStepInfo = neuronSteps.get(i);
            NeuronStepInfo candidateStepInfo = candidateSteps.get(i);
            e += Math.pow(func.calc(outputNeuronStepInfo.net + candidateStepInfo.activation * w) -
                    outputNeuronStepInfo.targetValue, 2);
         }
      }

      return e / (2 * pCount);
 
View Full Code Here


   public void collectInfoFromOutput(Neuron outputNeuron, double targetValue)
   {
      double net = outputNeuron.getNet();
      double act = outputNeuron.getActivation();
      IFunction deriviative = outputNeuron.getActivationFunction().getDerivative();
      double e = (act - targetValue) * deriviative.calc(net);

      NeuronStepInfo neuronStepInfo = new NeuronStepInfo(act, e, net, targetValue);
      addOutputNeuronInfo(outputNeuron, neuronStepInfo);
   }
View Full Code Here

               List<NeuronStepInfo> outputInfo = outputNeuronsInfo.get(getOutputNeurons().get(j));

               double avE = calcAvE(outputInfo);

               NeuronStepInfo stepPInfo = outputInfo.get(p);
               IFunction deriviative = candidateNeuron.getActivationFunction().getDerivative();
               sigmaP += Math.signum(calcCj(j, candidateNeuron)) * (stepPInfo.e - avE) *
                       deriviative.calc(candidateInfo.get(p).net);
            }

            sigmas.add(sigmaP);
         }

View Full Code Here

   }

   private double calcSigma(Neuron neuron, double target)
   {
      double net = neuron.getNet();
      IFunction derivative = neuron.getActivationFunction().getDerivative();
      double currentSigma = derivative.calc(net);

      if (neuron.getOutputSynapses().size() == 0)
      {
         // neuron is in last layer
         currentSigma *= (target - neuron.getActivation());
View Full Code Here

         {
            builder.addSynapseGenerative(0, i, 1, 1, j);
         }
      }

      IFunction weightGenerator = new IFunction() {
         @Override
         public double calc(double x)
         {
            return 1;
         }
View Full Code Here

                    currentLayerIndex + 1, j);
         }
      }


      IFunction weightGenerator = new IFunction() {
         @Override
         public double calc(double x)
         {
            return nextRandomSynapseWeight();
         }
View Full Code Here

         double activation = neuron.getActivation();
         double e = calcError(targetValues.get(i), activation);
         double net = neuron.getNet();

         IFunction deriviative = neuron.getActivationFunction().getDerivative();
         double deriviativeValue = deriviative.calc(net);

         for (Synapse s : neuron.getInputSynapses())
         {
            slopes.put(s, getSlope(s) + (e * deriviativeValue * s.getSource().getActivation()));
         }
View Full Code Here

TOP

Related Classes of com.greentea.relaxation.jnmf.lib.functions.IFunction

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.