rf_full.hpp

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 RF_FULL_HPP
00020 #define RF_FULL_HPP
00021 
00022 #include <math.h>
00023 
00024 #include <boost/numeric/ublas/vector_expression.hpp>
00025 #include <boost/numeric/ublas/io.hpp>
00026 #include <boost/program_options.hpp>
00027 
00028 #include <fstream>
00029 
00030 #include "types.hpp"
00031 #include "rf.hpp"
00032 
00039 class RFFull : public RF {
00040 
00049     
00053     //Types::UTMatrix alpha;
00054     Types::Matrix alpha;
00055 
00059     //Types::UTMatrix meta_h,b;
00060     Types::Matrix meta_h,b;
00061 
00063     
00064 
00073     
00075     //Types::SymMatrix D;
00076     Types::Matrix D;
00077 
00079     //Types::UTMatrix M;
00080     Types::Matrix M;
00081     
00083 
00084     // temp variables
00085     //Types::UTMatrix dwdM, dJ2dM, dJdM;
00086     Types::Matrix dwdM, dJ2dM, dJdM;
00087 
00088     // meta learning temp vars
00089     //Types::UTMatrix dJ2_2dM_2, aux, dw_2dM_2, dJ_2dM_2;
00090     Types::Matrix dJ2_2dM_2, aux, dw_2dM_2, dJ_2dM_2;
00091 
00092 public:
00093 
00095     RFFull();
00096 
00102     RFFull(Types::Input c);
00103 
00107     RFFull(Types::Input c, const boost::program_options::variables_map& vm);
00108 
00112     RFFull(const RFFull&, Types::Input c, const boost::program_options::variables_map& vm);
00113 
00114 
00121     virtual Types::RValue getActivation(Types::Input x) const
00122     { 
00123         const_cast<Types::vector&>(temp2) = prod(M,(x-center));
00124         return exp(-0.5 * ublas::prec_inner_prod(temp2,temp2)); 
00125     };
00126 
00127 
00138     virtual Types::RValue learn(Types::Input x, Types::Output y, Types::RValueP w);
00139 
00143     friend std::ostream& operator<<(std::ostream& out, const RFFull& rf);
00144 
00148     Types::Matrix getAlpha() const { return alpha; };
00149     Types::Matrix getD() const { return D; };
00150     Types::Matrix getM() const { return M; };
00151     Types::Input getCenter() const { return center; };
00152 
00153 };
00154 
00155 #endif

Generated on Fri Jul 27 00:24:01 2007 for LWPR by  doxygen 1.5.1