示例#1
0
        private static void ChangeWeights(ISimpleNetwork network, ISlaveNode neuron, double sigma, double force)
        {
            var synapses = network.Synapses.Where(x => x.SlaveNode == neuron);

            foreach (var synapse in synapses)
            {
                var masterNodeOutput = synapse.MasterNode.LastCalculatedValue;
                synapse.ChangeWeight(force * sigma * masterNodeOutput);
            }
        }
示例#2
0
 public NeuronSigma(ISlaveNode neuron, double sigma)
 {
     Neuron = neuron;
     Sigma  = sigma;
 }
示例#3
0
        private static double SigmaCalcForOutputLayer(IReadOnlyList <double> expectation, ISlaveNode neuron, IReadOnlyList <double> output, int oIndex)
        {
            var derivative = GetDerivative(neuron);

            return(derivative * (expectation[oIndex] - output[oIndex]));
        }
示例#4
0
        private static double GetDerivative(ISlaveNode neuron)
        {
            var x = neuron.Summator.LastCalculatedValue;

            return(neuron.Function.GetDerivative(x));
        }
示例#5
0
        private static double SigmaCalcForInnerLayers(ISimpleNetwork network, IEnumerable <NeuronSigma> sigmas, ISlaveNode neuron)
        {
            var derivative = GetDerivative(neuron);

            return(derivative * GetChildSigmas(network, sigmas, neuron));
        }