コード例 #1
0
        public void Learn(double difference, double learningRate, double momentum)
        {
            if (Type == NeuronType.Input)
            {
                return;
            }

            var prevDelta = BiasDelta;

            BiasDelta = learningRate * Gradient;
            Bias     += BiasDelta + momentum * prevDelta;

            Gradient = difference * Function.Derivation(Output);

            for (var i = 0; i < Weights.Count; i++)
            {
                prevDelta = WeightsDelta[i];
                var input = Inputs[i];
                WeightsDelta[i] = input * Gradient * learningRate;
                Weights[i]     += WeightsDelta[i] + momentum * prevDelta;
            }
        }