radial_basis_function.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_LAYER_RBF_HPP
14 #define MLPACK_METHODS_ANN_LAYER_RBF_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 
19 #include "layer_types.hpp"
20 
21 namespace mlpack {
22 namespace ann {
23 
24 
48 template <
49  typename InputDataType = arma::mat,
50  typename OutputDataType = arma::mat,
51  typename Activation = GaussianFunction
52 >
53 class RBF
54 {
55  public:
57  RBF();
58 
68  RBF(const size_t inSize,
69  const size_t outSize,
70  arma::mat& centres,
71  double betas = 0);
72 
79  template<typename eT>
80  void Forward(const arma::Mat<eT>& input, arma::Mat<eT>& output);
81 
86  template<typename eT>
87  void Backward(const arma::Mat<eT>& /* input */,
88  const arma::Mat<eT>& /* gy */,
89  arma::Mat<eT>& /* g */);
90 
92  OutputDataType const& OutputParameter() const { return outputParameter; }
94  OutputDataType& OutputParameter() { return outputParameter; }
96 
98  InputDataType const& InputParameter() const { return inputParameter; }
100  InputDataType& InputParameter() { return inputParameter; }
101 
103  size_t InputSize() const { return inSize; }
104 
106  size_t OutputSize() const { return outSize; }
107 
109  OutputDataType const& Delta() const { return delta; }
111  OutputDataType& Delta() { return delta; }
112 
116  template<typename Archive>
117  void serialize(Archive& ar, const unsigned int /* version */);
118 
119  private:
121  size_t inSize;
122 
124  size_t outSize;
125 
127  OutputDataType delta;
128 
130  OutputDataType outputParameter;
131 
133  double sigmas;
134 
136  double betas;
137 
139  InputDataType centres;
140 
142  InputDataType inputParameter;
143 
145  OutputDataType distances;
146 }; // class RBF
147 
148 } // namespace ann
149 } // namespace mlpack
150 
151 // Include implementation.
152 #include "radial_basis_function_impl.hpp"
153 
154 #endif
OutputDataType const & OutputParameter() const
Get the output parameter.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_po.hpp:21
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType const & Delta() const
Get the detla.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType & OutputParameter()
Modify the output parameter.
InputDataType const & InputParameter() const
Get the parameters.
RBF()
Create the RBF object.
void Backward(const arma::Mat< eT > &, const arma::Mat< eT > &, arma::Mat< eT > &)
Ordinary feed backward pass of the radial basis function.
size_t OutputSize() const
Get the output size.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the radial basis function.
size_t InputSize() const
Get the input size.
OutputDataType & Delta()
Modify the delta.