9 #ifndef NEURALNETWORK_H
10 #define NEURALNETWORK_H
16 #include "../dependencies/json/json.h"
29 const std::vector<size_t>& which_inputs,
30 const size_t& num_hidden_layers,
31 const size_t& num_hidden_nodes,
32 const std::vector<T>& weights,
33 const std::vector<T>& wHiddenOutput,
34 const std::vector<T>& inRanges,
35 const std::vector<T>& inBases,
49 const std::vector<size_t>& which_inputs,
50 const size_t& num_hidden_layer,
51 const size_t& num_hidden_nodes);
60 T
run(
const std::vector<T>& inputVector)
override;
62 void reset()
override;
92 std::vector<size_t> whichInputs;
93 size_t numHiddenLayers;
94 size_t numHiddenNodes;
97 std::vector<T> inputNeurons;
98 std::vector<std::vector<T> > hiddenNeurons;
102 std::vector<std::vector<std::vector<T> > > weights;
103 std::vector<T> wHiddenOutput;
106 std::vector<T> inRanges;
107 std::vector<T> inBases;
112 inline T activationFunction(T);
138 T learningRate { 0.3 };
140 size_t numEpochs { 500 };
141 size_t currentEpoch { 0 };
144 std::vector<std::vector< std::vector<T> > > deltaWeights;
145 std::vector<T> deltaHiddenOutput;
148 T outputErrorGradient;
149 inline T getHiddenErrorGradient(
size_t layer,
size_t neuron);
156 void backpropagate(
const T& desiredOutput);
159 void updateWeights();
Definition: baseModel.h:42
Definition: neuralNetwork.h:25
std::vector< T > getInBases() const
Definition: neuralNetwork.cpp:289
T getOutRange() const
Definition: neuralNetwork.cpp:295
std::vector< T > getWeights() const
Definition: neuralNetwork.cpp:260
T getOutBase() const
Definition: neuralNetwork.cpp:301
void train(const std::vector< trainingExampleTemplate< T > > &trainingSet) override
These pertain to the training, and aren't need to run a trained model //.
Definition: neuralNetwork.cpp:402
neuralNetwork(const size_t &num_inputs, const std::vector< size_t > &which_inputs, const size_t &num_hidden_layers, const size_t &num_hidden_nodes, const std::vector< T > &weights, const std::vector< T > &wHiddenOutput, const std::vector< T > &inRanges, const std::vector< T > &inBases, const T &outRange, const T &outBase)
Definition: neuralNetwork.cpp:41
void setNumHiddenNodes(size_t num_hidden_nodes)
Definition: neuralNetwork.cpp:241
void reset() override
Definition: neuralNetwork.cpp:146
size_t getNumInputs() const override
Definition: neuralNetwork.cpp:209
void setNumHiddenLayers(size_t num_hidden_layers)
Definition: neuralNetwork.cpp:227
void getJSONDescription(Json::Value ¤tModel) override
Definition: neuralNetwork.cpp:308
std::vector< size_t > getWhichInputs() const override
Definition: neuralNetwork.cpp:215
size_t getNumHiddenNodes() const
Definition: neuralNetwork.cpp:235
T run(const std::vector< T > &inputVector) override
Definition: neuralNetwork.cpp:357
~neuralNetwork()
Definition: neuralNetwork.cpp:141
void setEpochs(const size_t &epochs)
Definition: neuralNetwork.cpp:254
std::vector< T > getInRanges() const
Definition: neuralNetwork.cpp:283
size_t getNumHiddenLayers() const
Definition: neuralNetwork.cpp:221
size_t getEpochs() const
Definition: neuralNetwork.cpp:248
std::vector< T > getWHiddenOutput() const
Definition: neuralNetwork.cpp:277
size_t getCurrentEpoch() const
Definition: neuralNetwork.cpp:526
Definition: trainingExample.h:19