#include <neuralNetwork.h>
Public Member Functions | |
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) | |
neuralNetwork (const size_t &num_inputs, const std::vector< size_t > &which_inputs, const size_t &num_hidden_layer, const size_t &num_hidden_nodes) | |
~neuralNetwork () | |
T | run (const std::vector< T > &inputVector) override |
void | reset () override |
size_t | getNumInputs () const override |
std::vector< size_t > | getWhichInputs () const override |
size_t | getNumHiddenLayers () const |
void | setNumHiddenLayers (size_t num_hidden_layers) |
size_t | getNumHiddenNodes () const |
void | setNumHiddenNodes (size_t num_hidden_nodes) |
size_t | getEpochs () const |
void | setEpochs (const size_t &epochs) |
std::vector< T > | getWeights () const |
std::vector< T > | getWHiddenOutput () const |
std::vector< T > | getInRanges () const |
std::vector< T > | getInBases () const |
T | getOutRange () const |
T | getOutBase () const |
void | getJSONDescription (Json::Value ¤tModel) override |
void | train (const std::vector< trainingExampleTemplate< T > > &trainingSet) override |
These pertain to the training, and aren't need to run a trained model //. More... | |
void | train (const std::vector< trainingExampleTemplate< T > > &trainingSet, const std::size_t whichOutput) override |
size_t | getCurrentEpoch () const |
Public Member Functions inherited from baseModel< T > | |
virtual | ~baseModel () |
Additional Inherited Members | |
Protected Member Functions inherited from baseModel< T > | |
template<typename TT , class Dummy = int> | |
Json::Value | vector2json (TT vec) |
template<class Dummy = int> | |
Json::Value | vector2json (std::vector< unsigned long > vec) |
Class for implementing a Neural Network.
This class includes both running and training, and constructors for reading trained models from JSON.
neuralNetwork< T >::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 > & | w_hidden_output, | ||
const std::vector< T > & | in_ranges, | ||
const std::vector< T > & | in_bases, | ||
const T & | out_range, | ||
const T & | out_base | ||
) |
This is the constructor for building a trained model from JSON.
This is the constructor for a model imported from JSON.
neuralNetwork< T >::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 | ||
) |
This constructor creates a neural network that needs to be trained.
num_inputs | is the number of inputs the network will process |
which_inputs | is an vector of which values in the input vector are being fed to the network. ex: {0,2,4} |
num_hidden_layer | is the number of hidden layers in the network. Must be at least 1. |
num_hidden_nodes | is the number of hidden nodes in each hidden layer. Often, this is the same as num_inputs |
This is the constructor for a model that needs to be trained.
neuralNetwork< T >::~neuralNetwork |
destructor
This destructor is not needed.
size_t neuralNetwork< T >::getCurrentEpoch |
Returns current training epoch.
size_t neuralNetwork< T >::getEpochs |
std::vector< T > neuralNetwork< T >::getInBases |
std::vector< T > neuralNetwork< T >::getInRanges |
|
overridevirtual |
Implements baseModel< T >.
size_t neuralNetwork< T >::getNumHiddenLayers |
size_t neuralNetwork< T >::getNumHiddenNodes |
|
overridevirtual |
Implements baseModel< T >.
T neuralNetwork< T >::getOutBase |
T neuralNetwork< T >::getOutRange |
std::vector< T > neuralNetwork< T >::getWeights |
|
overridevirtual |
Implements baseModel< T >.
std::vector< T > neuralNetwork< T >::getWHiddenOutput |
|
overridevirtual |
Implements baseModel< T >.
|
overridevirtual |
Generate an output value from a single input vector.
vector | A standard vector of type T that feed-forward regression will run on. |
Implements baseModel< T >.
void neuralNetwork< T >::setEpochs | ( | const size_t & | epochs | ) |
void neuralNetwork< T >::setNumHiddenLayers | ( | size_t | num_hidden_layers | ) |
void neuralNetwork< T >::setNumHiddenNodes | ( | size_t | num_hidden_nodes | ) |
|
overridevirtual |
These pertain to the training, and aren't need to run a trained model //.
Train a model using backpropagation.
The | training set is a vector of training examples that contain both a vector of input values and a value specifying desired output. |
Implements baseModel< T >.
|
overridevirtual |
Train a model using backpropagation. This function is used when the model is part of a modelSet.
This | triaining function takes examples that contain a vector of input values and a vector of output values. |
The | second argument specifies which output this model is using. |
Implements baseModel< T >.