DMP_BBO library
FunctionApproximatorRBFN.hpp
Go to the documentation of this file.
1 
24 #ifndef _FUNCTION_APPROXIMATOR_RBFN_H_
25 #define _FUNCTION_APPROXIMATOR_RBFN_H_
26 
28 
33 namespace DmpBbo {
34 
35 // Forward declarations
36 class MetaParametersRBFN;
37 class ModelParametersRBFN;
38 
44 {
45 public:
46 
55  FunctionApproximatorRBFN(const MetaParametersRBFN *const meta_parameters, const ModelParametersRBFN *const model_parameters=NULL);
56 
60  FunctionApproximatorRBFN(const ModelParametersRBFN *const model_parameters);
61 
62  FunctionApproximator* clone(void) const;
63 
64  void train(const Eigen::Ref<const Eigen::MatrixXd>& inputs, const Eigen::Ref<const Eigen::MatrixXd>& targets);
65 
66  void predict(const Eigen::Ref<const Eigen::MatrixXd>& inputs, Eigen::MatrixXd& output);
67 
71  void preallocateMemory(int n_basis_functions);
72 
73  inline std::string getName(void) const {
74  return std::string("RBFN");
75  };
76 
77  bool saveGridData(const Eigen::VectorXd& min, const Eigen::VectorXd& max, const Eigen::VectorXi& n_samples_per_dim, std::string directory, bool overwrite=false) const;
78 
79 private:
86  FunctionApproximatorRBFN(void) {};
87 
89  mutable Eigen::VectorXd weights_prealloc_;
90 
92  mutable Eigen::MatrixXd activations_one_prealloc_;
93 
95  mutable Eigen::MatrixXd activations_prealloc_;
96 
99 
105  template<class Archive>
106  void serialize(Archive & ar, const unsigned int version);
107 
108 };
109 
110 }
111 
112 
113 #include <boost/serialization/export.hpp>
116 
117 
118 BOOST_CLASS_IMPLEMENTATION(DmpBbo::FunctionApproximatorRBFN,boost::serialization::object_serializable);
119 
120 #endif // _FUNCTION_APPROXIMATOR_RBFN_H_
121 
122 
Meta-parameters for the Radial Basis Function Network (RBFN) function approximator.
RBFN (Radial Basis Function Network) function approximator.
FunctionApproximator class header file.
void predict(const Eigen::Ref< const Eigen::MatrixXd > &inputs, Eigen::MatrixXd &output)
Query the function approximator to make a prediction.
void train(const Eigen::Ref< const Eigen::MatrixXd > &inputs, const Eigen::Ref< const Eigen::MatrixXd > &targets)
Train the function approximator with corresponding input and target examples.
BOOST_CLASS_EXPORT_KEY2(DmpBbo::TimeSystem,"TimeSystem")
Register this derived class.
std::string getName(void) const
Get the name of this function approximator.
void preallocateMemory(int n_basis_functions)
Preallocate memory to make certain functions real-time.
Base class for all function approximators.
FunctionApproximator * clone(void) const
Return a pointer to a deep copy of the FunctionApproximator object.
Model parameters for the Radial Basis Function Network (RBFN) function approximator.
bool saveGridData(const Eigen::VectorXd &min, const Eigen::VectorXd &max, const Eigen::VectorXi &n_samples_per_dim, std::string directory, bool overwrite=false) const
Generate a grid of inputs, and output the response of the basis functions and line segments for these...
BOOST_CLASS_IMPLEMENTATION(DmpBbo::FunctionApproximatorRBFN, boost::serialization::object_serializable)
Register this derived class.
friend class boost::serialization::access
Give boost serialization access to private members.