RapidLib  v0.1.2
A simple library for interactive machine learning
neuralNetwork Class Reference

#include <neuralNetwork.h>

Inheritance diagram for neuralNetwork:
Inheritance graph
Collaboration diagram for neuralNetwork:
Collaboration graph

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 &currentModel)
 
void train (const std::vector< trainingExample > &trainingSet)
 
- Public Member Functions inherited from baseModel
virtual ~baseModel ()
 

Additional Inherited Members

- Protected Member Functions inherited from baseModel
template<typename T >
Json::Value vector2json (T vec)
 

Detailed Description

Class for implementing a Neural Network.

This class includes both running and training, and constructors for reading trained models from JSON.

Constructor & Destructor Documentation

§ neuralNetwork() [1/2]

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() [2/2]

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.

Parameters
num_inputsis the number of inputs the network will process
which_inputsis an vector of which values in the input vector are being fed to the network. ex: {0,2,4}
num_hidden_layeris the number of hidden layers in the network. Must be at least 1.
num_hidden_nodesis the number of hidden nodes in each hidden layer. Often, this is the same as num_inputs
Returns
A neuralNetwork instance with randomized weights and no normalization values. These will be set or adjusted during training.

This is the constructor for a model that needs to be trained.

§ ~neuralNetwork()

neuralNetwork::~neuralNetwork ( )

destructor

This destructor is not needed.

Member Function Documentation

§ getInBases()

std::vector< double > neuralNetwork::getInBases ( )

§ getInRanges()

std::vector< double > neuralNetwork::getInRanges ( )

§ getJSONDescription()

void neuralNetwork::getJSONDescription ( Json::Value &  currentModel)
virtual

Implements baseModel.

§ getNumHiddenLayers()

int neuralNetwork::getNumHiddenLayers ( )

§ getNumHiddenNodes()

int neuralNetwork::getNumHiddenNodes ( )

§ getNumInputs()

int neuralNetwork::getNumInputs ( )
virtual

Implements baseModel.

§ getOutBase()

double neuralNetwork::getOutBase ( )

§ getOutRange()

double neuralNetwork::getOutRange ( )

§ getWeights()

std::vector< double > neuralNetwork::getWeights ( )

§ getWhichInputs()

std::vector< int > neuralNetwork::getWhichInputs ( )
virtual

Implements baseModel.

§ getWHiddenOutput()

std::vector< double > neuralNetwork::getWHiddenOutput ( )

§ process()

double neuralNetwork::process ( const std::vector< double > &  inputVector)
virtual

Generate an output value from a single input vector.

Parameters
Astandard vector of doubles that feed-forward regression will run on.
Returns
A single double, which is the result of the feed-forward operation

Implements baseModel.

§ train()

void neuralNetwork::train ( const std::vector< trainingExample > &  trainingSet)
virtual

These pertain to the training, and aren't need to run a trained model Train a model using backpropagation.

Parameters
Thetraining set is a vector of training examples that contain both a vector of input values and a double specifying desired output.

Implements baseModel.


The documentation for this class was generated from the following files: