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

Method setWeights

src/NeuralNet.cpp:91–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void NeuralNet::setWeights(std::vector<double> w) {
92 unsigned int counter = 0;
93 for(unsigned int a = 0; a < net.size(); a++) {
94 for(unsigned int b = 0; b < net[a].neurons.size(); b++) {
95 for(unsigned int c = 0; c < net[a].neurons[b].weights.size(); c++) {
96 net[a].neurons[b].weights[c] = w[counter];
97 counter++;
98 }
99 }
100 }
101 if(counter != w.size()) {
102 std::cout << "Not the right number of weights\n";
103 throw 1;
104 }
105}
106
107void NeuralNet::setWeights3D(std::vector< std::vector< std::vector<double> > > w) {
108 for(unsigned int a = 0; a < net.size(); a++) {

Callers 2

crossoverMethod · 0.80
mutateMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected