parity + debug output
This commit is contained in:
@@ -52,6 +52,8 @@ namespace NeuralNetwork {
|
||||
error = trainOutputs(network, patterns);
|
||||
}
|
||||
|
||||
std::cout << error << "\n";
|
||||
|
||||
if(_prunningStatus && error*1.01 >= lastError) { // it is not getting bettter
|
||||
network.removeLastHiddenNeuron();
|
||||
error=lastError;
|
||||
|
||||
@@ -6,15 +6,15 @@ namespace NeuralNetwork {
|
||||
namespace ProblemSets {
|
||||
typedef std::pair<std::vector<float>, std::vector<float>> TrainingPattern;
|
||||
|
||||
std::vector<TrainingPattern> Parity3() {
|
||||
std::vector<TrainingPattern> Parity3(float min = 0.0) {
|
||||
return {
|
||||
{{0,0,0},{0}},
|
||||
{{0,0,1},{1}},
|
||||
{{0,1,0},{1}},
|
||||
{{0,1,1},{0}},
|
||||
{{1,0,0},{1}},
|
||||
{{1,0,1},{0}},
|
||||
{{1,1,0},{0}},
|
||||
{{min,min,min},{min}},
|
||||
{{min,min,1},{1}},
|
||||
{{min,1,min},{1}},
|
||||
{{min,1,1},{min}},
|
||||
{{1,min,min},{1}},
|
||||
{{1,min,1},{min}},
|
||||
{{1,1,min},{min}},
|
||||
{{1,1,1},{1}},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ float CascadeCorrelation::trainOutputs(Cascade::Network &network, const std::vec
|
||||
}
|
||||
while(iteration++ < _maxOutputLearningIterations && iterWithoutImporvement < _maxOutputLearningIterationsWithoutChange);
|
||||
|
||||
std::cout << "outputLearning: " << error << ", last: " << lastError << ", iters: " << iteration << "\n";
|
||||
// std::cout << "outputLearning: " << error << ", last: " << lastError << ", iters: " << iteration << "\n";
|
||||
|
||||
for(std::size_t neuron = 0; neuron < outputs; neuron++) {
|
||||
network.getOutputNeurons()[neuron]->setWeights(p[1][neuron + 1].getWeights());
|
||||
}
|
||||
@@ -144,7 +145,7 @@ float CascadeCorrelation::trainOutputsRandom(std::size_t step, Cascade::Network
|
||||
|
||||
FeedForward::Network &p = *possibleOutputs[bestNetwork];
|
||||
|
||||
std::cout << "network: " << bestNetwork << ", error: " << bestScore << "\n";
|
||||
std::cout << "network: " << bestNetwork << "\n";
|
||||
|
||||
for(std::size_t neuron = 0; neuron < outputs; neuron++) {
|
||||
network.getNeuron(network.getNeuronSize() - outputs + neuron)->setWeights(p[1][neuron + 1].getWeights());
|
||||
|
||||
Reference in New Issue
Block a user