00001 // 00002 // Copyright (c) 2005-2007 00003 // James N Knight 00004 // 00005 // Permission to use, copy, modify, distribute and sell this software 00006 // and its documentation for any purpose is hereby granted without fee, 00007 // provided that the above copyright notice appear in all copies and 00008 // that both that copyright notice and this permission notice appear 00009 // in supporting documentation. The authors make no representations 00010 // about the suitability of this software for any purpose. 00011 // It is provided "as is" without express or implied warranty. 00012 // 00013 // 00014 // See http://homepages.inf.ed.ac.uk/svijayak/publications/vijayakumar-NeuCom2005.pdf 00015 // for the original publication of this algorithm. 00016 00017 00018 00019 #ifndef LWPR_HPP 00020 #define LWPR_HPP 00021 00022 #include <list> 00023 #include <iostream> 00024 #include <fstream> 00025 00026 #include <boost/program_options.hpp> 00027 00028 #include "types.hpp" 00029 #include "rf.hpp" 00030 00037 class LWPR { 00038 00047 00052 Types::RParam w_gen; 00053 00058 Types::RParam w_update; 00059 00064 Types::RParam w_predict; 00065 00069 bool diag; 00070 00072 00076 typedef std::list<RF*> RFList; 00077 00081 LWPR::RFList receptiveFields; 00082 00086 const boost::program_options::variables_map& vm; 00087 00088 public: 00089 00091 LWPR(); 00092 00098 LWPR(const boost::program_options::variables_map& vm); 00099 00101 ~LWPR(); 00102 00103 00111 void learn(Types::Input x, Types::Output y); 00112 00120 Types::OutputT predict(Types::Input x) const; 00121 00125 //friend std::istream& operator<<(std::istream& in, LWPR& lwpr); 00126 friend std::ostream& operator<<(std::ostream& out, const LWPR& lwpr); 00127 00128 }; 00129 00130 #endif