mlpack  3.4.2
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
mlpack::ann::RBF::RBF
RBF()
Create the RBF object.
mlpack::ann::RBF::serialize
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
mlpack::ann::RBF::Backward
void Backward(const arma::Mat< eT > &, const arma::Mat< eT > &, arma::Mat< eT > &)
Ordinary feed backward pass of the radial basis function.
prereqs.hpp
The core includes that mlpack expects; standard C++ includes and Armadillo.
mlpack::ann::RBF::OutputParameter
OutputDataType & OutputParameter()
Modify the output parameter.
Definition: radial_basis_function.hpp:94
mlpack::ann::RBF::Delta
OutputDataType const & Delta() const
Get the detla.
Definition: radial_basis_function.hpp:109
mlpack::ann::RBF::OutputSize
size_t OutputSize() const
Get the output size.
Definition: radial_basis_function.hpp:106
gaussian_function.hpp
mlpack::ann::RBF::Delta
OutputDataType & Delta()
Modify the delta.
Definition: radial_basis_function.hpp:111
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: add_to_cli11.hpp:21
mlpack::ann::RBF::OutputParameter
OutputDataType const & OutputParameter() const
Get the output parameter.
Definition: radial_basis_function.hpp:92
mlpack::ann::RBF::InputSize
size_t InputSize() const
Get the input size.
Definition: radial_basis_function.hpp:103
mlpack::ann::RBF::RBF
RBF(const size_t inSize, const size_t outSize, arma::mat &centres, double betas=0)
Create the Radial Basis Function layer object using the specified parameters.
mlpack::ann::RBF::Forward
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the radial basis function.
mlpack::ann::RBF
Implementation of the Radial Basis Function layer.
Definition: radial_basis_function.hpp:54
mlpack::ann::RBF::InputParameter
InputDataType & InputParameter()
Modify the input parameter.
Definition: radial_basis_function.hpp:100
layer_types.hpp
mlpack::ann::RBF::InputParameter
InputDataType const & InputParameter() const
Get the parameters.
Definition: radial_basis_function.hpp:98