// This file contains the declarations of the classes used in the program // This class contains a single input data vector as well as a pointer to the // next data vector in line. class CDataVector { public: char m_output; char *m_pInputs; CDataVector *m_pNext; CDataVector(void) : m_pInputs(NULL), m_pNext(NULL) {} CDataVector(unsigned short numInputs); ~CDataVector(void); CDataVector* Add(unsigned short numInputs); CDataVector* Add(char *pBitmapFile, char output); CDataVector* getNthVector(unsigned short n); }; // The node class. It contains the parameters of the neuron as well as // the input vectors. The vectors are stored as a linked list in the CDataVector // class. The m_dataVectors never stores any actual vectors, but acts as the // start of the linked list. It also should be noted that the value stored in // m_MSE is computed as the network trains (on-line) so m_MSE will be a bit off // from its real value. class CNode { unsigned short m_numInputs; unsigned short m_numEqConnections; struct SEqConnection { double m_weight; } *m_pEqConnections; unsigned long m_numTuples; unsigned short *m_pTuplePointers; double m_fracTrainingVectors; CDataVector *m_pLastTrainingVector; unsigned short m_lastTrainingVector; CDataVector m_dataVectors; unsigned short m_numVectors; bool m_bConverged; double m_MSE; unsigned short m_width; public: static double learningRate; CNode(unsigned short width, double fracTrainingVectors, char *pWeightsFile); ~CNode(void); bool ReadDataVectors(char *pFileName); double ProcessVector(CDataVector *pData); bool ProcessEpoch(double MSEgoal); inline double run(CDataVector *pData=NULL); void print(void); bool converged(void) { return m_bConverged; } unsigned short getNumVectors(void) { return m_numVectors; } double getMSE(void) { return m_MSE; } }; double CNode::learningRate;