Beispiel #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);
            }
        }
Beispiel #2
0
 public NeuronSigma(ISlaveNode neuron, double sigma)
 {
     Neuron = neuron;
     Sigma  = sigma;
 }
Beispiel #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]));
        }
Beispiel #4
0
        private static double GetDerivative(ISlaveNode neuron)
        {
            var x = neuron.Summator.LastCalculatedValue;

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

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