private double calcNextE(Neuron candidate, DoubleList weights)
{
int pCount = outputNeuronsInfo.values().iterator().next().size();
IFunction func = outputNeuronsInfo.keySet().iterator().next().getActivationFunction();
List<NeuronStepInfo> candidateSteps = candidateNeuronsInfo.get(candidate);
double e = 0;
for (int j = 0; j < getOutputNeurons().size(); ++j)
{
double w = weights.get(j);
List<NeuronStepInfo> neuronSteps = outputNeuronsInfo.get(getOutputNeurons().get(j));
for (int i = 0; i < neuronSteps.size(); ++i)
{
NeuronStepInfo outputNeuronStepInfo = neuronSteps.get(i);
NeuronStepInfo candidateStepInfo = candidateSteps.get(i);
e += Math.pow(func.calc(outputNeuronStepInfo.net + candidateStepInfo.activation * w) -
outputNeuronStepInfo.targetValue, 2);
}
}
return e / (2 * pCount);