16 #ifndef MLPACK_METHODS_ANN_LAYER_ALPHA_DROPOUT_HPP 17 #define MLPACK_METHODS_ANN_LAYER_ALPHA_DROPOUT_HPP 48 template <
typename InputDataType = arma::mat,
49 typename OutputDataType = arma::mat>
60 const double alphaDash = -alpha * lambda);
69 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
79 void Backward(
const arma::Mat<eT>&& ,
94 OutputDataType
const&
Delta()
const {
return delta; }
96 OutputDataType&
Delta() {
return delta; }
104 double Ratio()
const {
return ratio; }
107 double A()
const {
return a; }
110 double B()
const {
return b; }
116 OutputDataType
const&
Mask()
const {
return mask;}
123 a = pow((1 - ratio) * (1 + ratio * pow(alphaDash, 2)), -0.5);
124 b = -a * alphaDash * ratio;
130 template<
typename Archive>
131 void serialize(Archive& ar,
const unsigned int );
135 OutputDataType delta;
138 InputDataType inputParameter;
141 OutputDataType outputParameter;
156 static constexpr
double alpha = 1.6732632423543772848170429916717;
159 static constexpr
double lambda = 1.0507009873554804934193349852946;
172 #include "alpha_dropout_impl.hpp" bool & Deterministic()
Modify the value of the deterministic parameter.
InputDataType const & InputParameter() const
Get the input parameter.
double A() const
Value to be multiplied with x for affine transformation.
AlphaDropout(const double ratio=0.5, const double alphaDash=-alpha *lambda)
Create the Alpha_Dropout object using the specified ratio.
double Ratio() const
The probability of setting a value to alphaDash.
The core includes that mlpack expects; standard C++ includes and Armadillo.
double AlphaDash() const
Value of alphaDash.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Ordinary feed forward pass of the alpha_dropout layer.
OutputDataType & OutputParameter()
Modify the output parameter.
OutputDataType const & Mask() const
Get the mask.
double B() const
Value to be added to a*x for affine transformation.
OutputDataType const & Delta() const
Get the detla.
InputDataType & InputParameter()
Modify the input parameter.
void Ratio(const double r)
Modify the probability of setting a value to alphaDash.
The alpha - dropout layer is a regularizer that randomly with probability 'ratio' sets input values t...
void serialize(Archive &ar, const unsigned int)
Serialize the layer.
bool Deterministic() const
The value of the deterministic parameter.
OutputDataType const & OutputParameter() const
Get the output parameter.
OutputDataType & Delta()
Modify the delta.
void Backward(const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
Ordinary feed backward pass of the alpha_dropout layer.