NNetCpp
Neural network implementation in C++
 All Classes Namespaces Functions Variables
Public Member Functions | List of all members
ConnectedNet Class Reference

#include <ConnectedNet.h>

Public Member Functions

 ConnectedNet (int inputNodes, std::vector< int > hiddenLayers, int outputNodes, WeightGenerator *weightGen=nullptr)
 
 ~ConnectedNet ()
 
std::vector< double > getOutput (std::vector< double > inputValues)
 
void train (TrainingData &tData, double learningRate)
 
std::vector< double > getDifference ()
 

Detailed Description

A fully connected Neural Network

Constructor & Destructor Documentation

ConnectedNet::ConnectedNet ( int  inputNodes,
std::vector< int >  hiddenLayers,
int  outputNodes,
WeightGenerator weightGen = nullptr 
)

Create a new ConnectedNet of given dimensions.

For example: For a 3x5x4x4x2 network one would put
inputNodes - 3
hiddenLayers - [5, 4, 4]
outputNodes - 2

Parameters
inputNodesamount of inputs to the network
hiddenLayersvector of dimensions of hidden layers, number at each index becomes amount of neurons in hidden layer at that index
outputNodesamount of outputs from the network
weightGengenerator to use for initializing weights in the network, if left a nullptr it is replaced with a default random generator
ConnectedNet::~ConnectedNet ( )

Destructor for ConnectedNet, clears all memory allocated

Member Function Documentation

std::vector< double > ConnectedNet::getDifference ( )

Get a vector of difference between target and output

Returns
the difference vector
std::vector< double > ConnectedNet::getOutput ( std::vector< double >  inputValues)

Present an input to the ConnectedNet and get the output

Parameters
inputValuesinput vector to the net
Returns
the output vector of the net
void ConnectedNet::train ( TrainingData tData,
double  learningRate 
)

Train the net on one input - target vector pair with speed learningrate returns the error

Parameters
tDataa piece of training data to use for training the net
learningRaterate to adjust weights in training

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