cascade: remove neuron

This commit is contained in:
2016-05-13 20:16:53 +02:00
parent 0f68dbf68d
commit a40b6fad88

View File

@@ -58,6 +58,18 @@ namespace NeuralNetwork {
return std::vector<std::shared_ptr<NeuronInterface>>(_neurons.end()-_outputs,_neurons.end()); return std::vector<std::shared_ptr<NeuronInterface>>(_neurons.end()-_outputs,_neurons.end());
} }
void removeLastHiddenNeuron() {
_neurons.erase(_neurons.begin()+_neurons.size()-outputs()-1);
std::size_t maxIndexOfHiddenNeuron = _neurons.size() - outputs();
std::size_t maxIndexOfNeuron = _neurons.size() - 1;
for(std::size_t i = 0; i < _outputs; i++) {
_neurons[maxIndexOfNeuron-i]->setInputSize(maxIndexOfHiddenNeuron);
}
}
std::shared_ptr<NeuronInterface> addNeuron() { std::shared_ptr<NeuronInterface> addNeuron() {
_neurons.push_back(std::make_shared<Neuron>()); _neurons.push_back(std::make_shared<Neuron>());
auto neuron = _neurons.back(); auto neuron = _neurons.back();