This commit is contained in:
2016-05-21 13:32:28 +02:00
parent 4a29fe792a
commit 5343751e7c
3 changed files with 5 additions and 3 deletions

View File

@@ -39,7 +39,7 @@ namespace NeuralNetwork {
} else {
error = trainOutputs(network, patterns);
}
while(_epoch++ < _maxEpochs && _neurons++ < _maxHiddenUnits && error > _errorTreshold) {
while(_epoch++ < _maxEpochs && _neurons < _maxHiddenUnits && error > _errorTreshold) {
std::vector<std::shared_ptr<Neuron>> candidates = createCandidates(network.getNeuronSize() - outputs);
std::pair<std::shared_ptr<Neuron>, std::vector<float>> candidate = trainCandidates(network, candidates, patterns);

View File

@@ -66,8 +66,6 @@ std::pair<std::shared_ptr<NeuralNetwork::Neuron>, std::vector<float>> Cascade2::
float weight = candidateWeights[candidateIndex][output];
float diff = activationValue * weight - errors[patternIndex][output];
float goalDir= pattern.second[output] <0.0? -1.0 :1.0;
float diffDir= diff >0.0? -1.0 :1.0;
score -= (diff * diff);
outSlopes[output] -= 2.0 * diff * activationValue;
errSum += diff * weight;

View File

@@ -190,6 +190,10 @@ std::pair <std::shared_ptr<NeuralNetwork::Neuron>, std::vector<float>> CascadeCo
}
}
if(sumSquareError < 0.01) {
sumSquareError=0.01;
}
std::for_each(meanErrors.begin(), meanErrors.end(), [&patterns](float &n) { n /= patterns.size(); });
struct CAND {