private void UpdateNetwork()
{
// current neuron
ActivationNeuron neuron;
// current layer
Layer layer;
// layer's weights updates
double[][] layerWeightsUpdates;
// layer's thresholds updates
double[] layerThresholdUpdates;
// neuron's weights updates
double[] neuronWeightUpdates;
// for each layer of the network
for (int i = 0; i < network.Layers.Length; i++)
{
layer = network.Layers[i];
layerWeightsUpdates = weightsUpdates[i];
layerThresholdUpdates = thresholdsUpdates[i];
// for each neuron of the layer
for (int j = 0; j < layer.Neurons.Length; j++)
{
neuron = layer.Neurons[j] as ActivationNeuron;
neuronWeightUpdates = layerWeightsUpdates[j];
// for each weight of the neuron
for (int k = 0; k < neuron.Weights.Length; k++)
{
// update weight
neuron.Weights[k] += neuronWeightUpdates[k];
}
// update treshold
neuron.Threshold += layerThresholdUpdates[j];
}
}
}
}