#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< double > &weights, const std::vector< double > &wHiddenOutput, const std::vector< double > &inRanges, const std::vector< double > &inBases, const double &outRange, const double &outBase) | |
neuralNetwork (const int &num_inputs, const std::vector< int > &which_inputs, const int &num_hidden_layer, const int &num_hidden_nodes) | |
~neuralNetwork () | |
double | process (const std::vector< double > &inputVector) |
int | getNumInputs () |
std::vector< int > | getWhichInputs () |
int | getNumHiddenLayers () |
int | getNumHiddenNodes () |
std::vector< double > | getWeights () |
std::vector< double > | getWHiddenOutput () |
std::vector< double > | getInRanges () |
std::vector< double > | getInBases () |
double | getOutRange () |
double | getOutBase () |
void | getJSONDescription (Json::Value ¤tModel) |
void | train (const std::vector< trainingExample > &trainingSet) |
![]() | |
virtual | ~baseModel () |
Additional Inherited Members | |
![]() | |
template<typename T > | |
Json::Value | vector2json (T vec) |
Class for implementing a Neural Network.
This class includes both running and training, and constructors for reading trained models from JSON.
neuralNetwork::neuralNetwork | ( | const int & | num_inputs, |
const std::vector< int > & | which_inputs, | ||
const int & | num_hidden_layers, | ||
const int & | num_hidden_nodes, | ||
const std::vector< double > & | _weights, | ||
const std::vector< double > & | w_hidden_output, | ||
const std::vector< double > & | in_ranges, | ||
const std::vector< double > & | in_bases, | ||
const double & | out_range, | ||
const double & | out_base | ||
) |
This is the constructor for building a trained model from JSON.
This is the constructor for a model imported from JSON.
neuralNetwork::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::~neuralNetwork | ( | ) |
destructor
This destructor is not needed.
std::vector< double > neuralNetwork::getInBases | ( | ) |
std::vector< double > neuralNetwork::getInRanges | ( | ) |
|
virtual |
Implements baseModel.
int neuralNetwork::getNumHiddenLayers | ( | ) |
int neuralNetwork::getNumHiddenNodes | ( | ) |
|
virtual |
Implements baseModel.
double neuralNetwork::getOutBase | ( | ) |
double neuralNetwork::getOutRange | ( | ) |
std::vector< double > neuralNetwork::getWeights | ( | ) |
|
virtual |
Implements baseModel.
std::vector< double > neuralNetwork::getWHiddenOutput | ( | ) |
|
virtual |
Generate an output value from a single input vector.
A | standard vector of doubles that feed-forward regression will run on. |
Implements baseModel.
|
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 double specifying desired output. |
Implements baseModel.