| 261 | } |
| 262 | |
| 263 | void NeuralNet::removeNeuron(unsigned int hiddenLayerIndex, unsigned int neuronIndex) { |
| 264 | if(hiddenLayerIndex >= numberOfHiddenLayers()) { |
| 265 | std::cout << "Impossible hidden layer index\n"; |
| 266 | throw 1; |
| 267 | } |
| 268 | if(neuronIndex >= net[hiddenLayerIndex].neurons.size()) { |
| 269 | std::cout << "Impossible neuron index\n"; |
| 270 | throw 1; |
| 271 | } |
| 272 | net[hiddenLayerIndex].neurons.erase(net[hiddenLayerIndex].neurons.begin() + neuronIndex); |
| 273 | for(unsigned int nextLayerNeuronIndex = 0; nextLayerNeuronIndex < net[hiddenLayerIndex+1].neurons.size(); nextLayerNeuronIndex++) { |
| 274 | std::vector<double> &nextLayerWeightsRef = net[hiddenLayerIndex+1].neurons[nextLayerNeuronIndex].weights; |
| 275 | nextLayerWeightsRef.erase(nextLayerWeightsRef.begin() + neuronIndex); |
| 276 | } |
| 277 | } |
no test coverage detected