MCPcopy Create free account
hub / github.com/FidoProject/Fido / removeNeuron

Method removeNeuron

src/NeuralNet.cpp:263–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263void 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}

Callers 2

pruneRandomnlyMethod · 0.80
pruneMethod · 0.80

Calls 2

beginMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected