// $Id$ // // File: nnann.h // Created: Fri Mar 18 19:47:27 EDT 2011 // Creator: davidl (on Darwin Amelia.local 9.8.0 i386) // #ifndef _nnann_ #define _nnann_ #include #include #include #include #include #include #include #include #include typedef std::vector nnann_layer; typedef std::vector nnann_weight_layer; // For debugging #define _DBG_ std::cout<<__FILE__<<":"<<__LINE__<<" " #define _DBG__ std::cout<<__FILE__<<":"<<__LINE__<& target_vals); virtual void FeedForward(const std::vector &inputs, std::vector &outputs); virtual double GetRMSError(std::vector &target_vals); virtual void Initialize(void); virtual void LoadFromFile(std::istream &ifs); virtual void LoadExtensionsFromFile(std::istream &ifs){} ///< Hook for user extensions from file virtual void ReadFile(std::string filename); virtual void RelinkLayers(void); virtual void SaveAs(std::string filename); virtual void TestOnFile(std::string filename); virtual unsigned int TrainFromFile(std::string filename, double max_err=0.001, unsigned int max_epochs=0); virtual double TrainOnePass(std::ifstream &ifs); virtual void WriteToFile(std::ostream &ofs); virtual void WriteExtensionsToFile(std::ostream &ofs){} ///< Hook for user extensions to file protected: std::vector layers; // array of layers of neurons std::vector weights_layers; // array of weights that connect the layers nnann_function *activation_function; nnann_neuron bias; private: bool initialized; }; #endif // _nnann_