mlpack  master
reinforce_normal.hpp
Go to the documentation of this file.
1 
8 #ifndef MLPACK_METHODS_ANN_LAYER_REINFORCE_NORMAL_HPP
9 #define MLPACK_METHODS_ANN_LAYER_REINFORCE_NORMAL_HPP
10 
11 #include <mlpack/prereqs.hpp>
12 
13 namespace mlpack {
14 namespace ann {
15 
25 template <
26  typename InputDataType = arma::mat,
27  typename OutputDataType = arma::mat
28 >
30 {
31  public:
37  ReinforceNormal(const double stdev);
38 
46  template<typename eT>
47  void Forward(const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
48 
58  template<typename DataType>
59  void Backward(const DataType&& input, DataType&& /* gy */, DataType&& g);
60 
62  InputDataType& InputParameter() const { return inputParameter; }
64  InputDataType& InputParameter() { return inputParameter; }
65 
67  OutputDataType& OutputParameter() const { return outputParameter; }
69  OutputDataType& OutputParameter() { return outputParameter; }
70 
72  OutputDataType& Delta() const { return delta; }
74  OutputDataType& Delta() { return delta; }
75 
77  bool Deterministic() const { return deterministic; }
79  bool& Deterministic() { return deterministic; }
80 
82  double Reward() const { return reward; }
84  double& Reward() { return reward; }
85 
89  template<typename Archive>
90  void Serialize(Archive& /* ar */, const unsigned int /* version */);
91 
92  private:
94  const double stdev;
95 
97  double reward;
98 
100  OutputDataType delta;
101 
103  InputDataType inputParameter;
104 
106  OutputDataType outputParameter;
107 
109  std::vector<arma::mat> moduleInputParameter;
110 
113 }; // class ReinforceNormal
114 
115 } // namespace ann
116 } // namespace mlpack
117 
118 // Include implementation.
119 #include "reinforce_normal_impl.hpp"
120 
121 #endif
bool deterministic
If true use maximum a posteriori during the forward pass.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: binarize.hpp:18
OutputDataType & Delta() const
Get the delta.
bool Deterministic() const
Get the value of the deterministic parameter.
double reward
Locally-stored reward parameter.
Implementation of the reinforce normal layer.
The core includes that mlpack expects; standard C++ includes and Armadillo.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType delta
Locally-stored delta object.
OutputDataType outputParameter
Locally-stored output parameter object.
double Reward() const
Get the value of the reward parameter.
ReinforceNormal(const double stdev)
Create the ReinforceNormal object.
bool & Deterministic()
Modify the value of the deterministic parameter.
const double stdev
Standard deviation used during the forward and backward pass.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activ...
double & Reward()
Modify the value of the deterministic parameter.
OutputDataType & OutputParameter() const
Get the output parameter.
std::vector< arma::mat > moduleInputParameter
Locally-stored output module parameter parameters.
InputDataType inputParameter
Locally-stored input parameter object.
OutputDataType & Delta()
Modify the delta.
void Backward(const DataType &&input, DataType &&, DataType &&g)
Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backw...
void Serialize(Archive &, const unsigned int)
Serialize the layer.
InputDataType & InputParameter()
Modify the input parameter.
InputDataType & InputParameter() const
Get the input parameter.