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
21namespace mlpack {
22namespace ann {
23
24
48template <
49 typename InputDataType = arma::mat,
50 typename OutputDataType = arma::mat,
51 typename Activation = GaussianFunction
52>
53class 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
Implementation of the Radial Basis Function layer.
OutputDataType const & Delta() const
Get the detla.
void Backward(const arma::Mat< eT > &, const arma::Mat< eT > &, arma::Mat< eT > &)
Ordinary feed backward pass of the radial basis function.
void Forward(const arma::Mat< eT > &input, arma::Mat< eT > &output)
Ordinary feed forward pass of the radial basis function.
InputDataType & InputParameter()
Modify the input parameter.
OutputDataType const & OutputParameter() const
Get the output parameter.
size_t InputSize() const
Get the input size.
size_t OutputSize() const
Get the output size.
InputDataType const & InputParameter() const
Get the parameters.
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.
OutputDataType & OutputParameter()
Modify the output parameter.
RBF()
Create the RBF object.
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
OutputDataType & Delta()
Modify the delta.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.