#ifndef __AINNETHPP__ #define __AINNETHPP__ #include typedef struct { double *weights; // size is num_inputs double *deltas; // size is num_inputs } Back_Node; class Back_Layer { public: Back_Layer *next,*prev; Back_Node *thenodes; int num_nodes; int num_inputs; // this should equal number of nodes from lower layer double *inputs; double *outputs; double *errors; Back_Layer (int nodes,int inputs,bool first); ~Back_Layer (void); void Create (int nodes,int inputs,bool first); void Destroy (void); void propagate_forward (void); void propagate_error (void); }; class Back_Network { public: Back_Layer *thelayers; int num_layers; double *input; double *output; double *wanted_output; double eta,alpha; int num_outputs,num_inputs; Back_Network (int layers,int *num_nodes,double neta,double nalpha); ~Back_Network (void); void propagate_forward (double *inputs); // This function does not work, the net will not stabalize to a solution void Learn (bool iscorrect,bool finetune = false,double percent = 0); void correct (bool finetune = false); void compute_error (bool finetune); void propagate_error (void); void adjust_weights (void); double *get_answer (void) { return thelayers[num_layers-1].outputs;} double *get_wanted (void) { return wanted_output;} }; #endif