public override void adjustWeights() { this.errorToBP = calcErrorProjectedFromNextNeurons() * NeuronActivation.Derivative(summation); double e = this.errorToBP * learningRate; for (int c = 0; c < this.weights.Length; c++) { this.weights [c] -= this.input [c] * e; } bais -= e; }
/// <summary> /// This function adjusts the weights of the Neuron. /// This function must be called after the expected value has been /// set. /// </summary> public override void adjustWeights() { if (expectedValueCalled != true) { throw new Exception("Expeected Value not given"); } errorToBP = this.error * NeuronActivation.Derivative(summation); double e = this.learningRate * errorToBP; for (int c = 0; c < this.weights.Length; c++) { this.weights [c] -= this.input [c] * e; } bais -= e; expectedValueCalled = false; }
public double Output(int inputIndexInNextNeuron, Neuron nextNeuron) { if (!ONHBS) { if (!nextNeuronAndInputIndexInNeuron.ContainsKey(nextNeuron)) { nextNeuronAndInputIndexInNeuron.Add(nextNeuron, inputIndexInNextNeuron); } else { throw new Exception("This neuron already exist in the next neuron"); } } summation = ParameterList <double> .vectorDot(weights, input) + bais; return(NeuronActivation.Function(summation)); }
/// <summary> /// This function adjusts the weights of the Neuron after getting the /// value which is expected out of the neuron /// </summary> public void adjustWeights(double expectedValue) { if (expectedValueCalled != true) { this.expectedValue(expectedValue); } errorToBP = this.error * NeuronActivation.Derivative(summation); double e = this.learningRate * errorToBP; for (int c = 0; c < this.weights.Length; c++) { this.weights [c] -= this.input [c] * e; } bais -= e; expectedValueCalled = false; }