#include <NeuralNetwork.h>
Public Member Functions | |
NeuralNetwork (const NeuralNetwork &network) | |
NeuralNetwork & | operator= (const NeuralNetwork &network) |
void | ConstructNetworkFromFile (const char *file) throw (std::invalid_argument) |
void | DeserializeData (std::istream &strm) |
void | AddNeuronLevel (int numNeurons) |
Neuron * | GetNeuron (int indx) |
int | GetNumNeurons () const |
int | GetNumInputNeurons () const |
int | GetNumOutputNeurons () const |
int | GetNumLevels () const |
int | GetNumNeuronsAtLevel (int level) const |
TestData * | GetTestData () |
void | AddData (std::vector< double > &input, std::vector< double > &output, int index) throw (std::logic_error) |
void | DefineTrainingData (int inFeatures, int outFeatures, int numSamples) |
void | AddSampleData (std::vector< double > &input, std::vector< double > &output, int index) throw (std::logic_error) |
int * | GetConnectingNeurons (int indx) const |
void | ConnectNeuron (int neuronIndex, const std::vector< double > &weightVec, const std::vector< int > &neuronFromVec) |
const NeuralNetworkBuilder & | GetBuilder () const |
void | FeedInput (const std::vector< double > &input, std::vector< double > &output) |
void | FeedInput (const double *input, double *output) |
void | FeedInput (const double *input, double *output, double *net_input) |
bool | DetectCycle () |
bool | CalibrateWeights (double eeta, int maxIter, double minResidual, double &finalResidual) |
void | ClearNetwork () |
The neurons are numbered from level 0 to level n. For example, level 0 will have neurons numbered 0 through num_neurons_in_level_0-1
The neuron connections are specified as: neuron_k : neuron_i neuron j neuron m This represents neuron numbered k to be connected to (receiving input from) neurons i, j and m. For feed forward neural networks, i,j,m must belong to previous level. The neural network is a forest.
|
Creates a neuron level comprising of numNeurons The neurons are assigned index number automatically. |
|
Add training data.
|
|
specify the weights attached to a neuron and the neurons from which a particular neuron receives connections (inputs)
|
|
Deserialize and construt the network from file throws invalid_argument exception if file could not be opened for reading. |
|
Create pData that contains the training data inFeatures: number of input features outFeatures: number of output features numSamples: number of samples in the data |
|
A feed forward neural network does not have cycles This function can be use to check if cycles are present once the neural network is defined. Returns true if cycle is present, false otherwise |
|
Overloaded version when input is provided as pointer to array and output is given in array, and total input for each neuron is needed as an output from this function. This function could have been merged with previous one by making last argument default to NULL, but that would make the fuction inefficient due to if check inside the for loop. Morover, this function is called frequently in any calibration. The output array should have sufficient size (>= number of output neurons in network) If input across all samples is in form of one array, this function can be used by providing appropriate offset into the array (avoids copying) Apply input signal to the network. Returns the output in vector output containing network response to the input.
|
|
Overloaded version when input is provided as pointer to array and output is given in array. The output array should have sufficient size (>= number of output neurons in network) If input across all samples is in form of one array, this function can be used by providing appropriate offset into the array (avoids copying) Apply input signal to the network. Returns the output in vector output containing network response to the input.
|
|
Apply input signal to the network. Returns the output in vector output containing network response to the input.
|
|
Get a neuron added to the network by index (starting from 0) |