cascade
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user