#include <neuralNetwork.h>
Public Member Functions | |
neuralNetwork (const int &num_inputs, const std::vector< int > &which_inputs, const int &num_hidden_layers, const int &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 int &num_inputs, const std::vector< int > &which_inputs, const int &num_hidden_layer, const int &num_hidden_nodes) | |
~neuralNetwork () | |
T | run (const std::vector< T > &inputVector) |
void | reset () |
int | getNumInputs () const |
std::vector< int > | getWhichInputs () const |
int | getNumHiddenLayers () const |
void | setNumHiddenLayers (int num_hidden_layers) |
int | getNumHiddenNodes () const |
void | setEpochs (const int &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) |
void | train (const std::vector< trainingExampleTemplate< T > > &trainingSet) |
These pertain to the training, and aren't need to run a trained model //. More... | |
![]() | |
virtual | ~baseModel () |
Additional Inherited Members | |
![]() | |
template<typename TT > | |
Json::Value | vector2json (TT 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 int & | num_inputs, |
const std::vector< int > & | which_inputs, | ||
const int & | num_hidden_layers, | ||
const int & | 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 int & | num_inputs, |
const std::vector< int > & | which_inputs, | ||
const int & | num_hidden_layers, | ||
const int & | 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.
std::vector< T > neuralNetwork< T >::getInBases | ( | ) | const |
std::vector< T > neuralNetwork< T >::getInRanges | ( | ) | const |
|
virtual |
Implements baseModel< T >.
int neuralNetwork< T >::getNumHiddenLayers | ( | ) | const |
int neuralNetwork< T >::getNumHiddenNodes | ( | ) | const |
|
virtual |
Implements baseModel< T >.
T neuralNetwork< T >::getOutBase | ( | ) | const |
T neuralNetwork< T >::getOutRange | ( | ) | const |
std::vector< T > neuralNetwork< T >::getWeights | ( | ) | const |
|
virtual |
Implements baseModel< T >.
std::vector< T > neuralNetwork< T >::getWHiddenOutput | ( | ) | const |
|
virtual |
Implements baseModel< T >.
|
virtual |
Generate an output value from a single input vector.
A | standard vector of type T that feed-forward regression will run on. |
Implements baseModel< T >.
void neuralNetwork< T >::setEpochs | ( | const int & | epochs | ) |
void neuralNetwork< T >::setNumHiddenLayers | ( | int | num_hidden_layers | ) |
|
virtual |
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 >.