示例#1
0
        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;
        }
示例#2
0
        /// <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;
        }
示例#3
0
        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));
        }
示例#4
0
        /// <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;
        }