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); } }
public NeuronSigma(ISlaveNode neuron, double sigma) { Neuron = neuron; Sigma = sigma; }
private static double SigmaCalcForOutputLayer(IReadOnlyList <double> expectation, ISlaveNode neuron, IReadOnlyList <double> output, int oIndex) { var derivative = GetDerivative(neuron); return(derivative * (expectation[oIndex] - output[oIndex])); }
private static double GetDerivative(ISlaveNode neuron) { var x = neuron.Summator.LastCalculatedValue; return(neuron.Function.GetDerivative(x)); }
private static double SigmaCalcForInnerLayers(ISimpleNetwork network, IEnumerable <NeuronSigma> sigmas, ISlaveNode neuron) { var derivative = GetDerivative(neuron); return(derivative * GetChildSigmas(network, sigmas, neuron)); }