/// <summary> /// This method implements weight update procedure for the whole network for /// this learning rule /// </summary> /// <param name="outputError"> /// output error vector </param> protected internal override void updateNetworkWeights(double[] outputError) { int i = 0; // for all output neurons foreach (Neuron neuron in neuralNetwork.OutputNeurons) { // if error is zero, just set zero error and continue to next neuron if (outputError[i] == 0) { neuron.Error = 0; i++; continue; } // otherwise calculate and set error/delta for the current neuron TransferFunction transferFunction = neuron.TransferFunction; double neuronInput = neuron.NetInput; double delta = outputError[i] * transferFunction.getDerivative(neuronInput); // delta = (d-y)*df(net) neuron.Error = delta; // and update weights of the current neuron this.updateNeuronWeights(neuron); i++; } // for }
/// <summary> /// Creates an instance of neuron for Hopfield network with specified input /// and transfer functions </summary> /// <param name="inFunc"> neuron input function </param> /// <param name="transFunc"> neuron transfer function </param> public InputOutputNeuron(InputFunction inFunc, TransferFunction transFunc) : base(inFunc, transFunc) { }