MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / Network

Method Network

src/RaceNet/Network.cpp:7–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "Network.h"
6
7Network::Network(std::vector<int> neurons, double learningRate) {
8 srand(time(NULL));
9
10 this->learningRate = learningRate;
11 this->hiddenLayersCount = neurons.size() - 2;
12
13 H = std::vector<Matrix<double> >(hiddenLayersCount + 2);
14 W = std::vector<Matrix<double> >(hiddenLayersCount + 1);
15 B = std::vector<Matrix<double> >(hiddenLayersCount + 1);
16 dEdW = std::vector<Matrix<double> >(hiddenLayersCount + 1);
17 dEdB = std::vector<Matrix<double> >(hiddenLayersCount + 1);
18
19 for (int i = 0; i < neurons.size() - 1; i++) {
20 W[i] = Matrix<double>(neurons[i], neurons[i + 1]);
21 B[i] = Matrix<double>(1, neurons[i + 1]);
22
23 W[i] = W[i].applyFunction(random);
24 B[i] = B[i].applyFunction(random);
25 }
26}
27
28Network::Network(const char *filepath) {
29 loadNetworkParams(filepath);

Callers

nothing calls this directly

Calls 1

applyFunctionMethod · 0.80

Tested by

no test coverage detected