13 #ifndef MLPACK_METHODS_ANN_LAYER_DROPOUT_HPP 14 #define MLPACK_METHODS_ANN_LAYER_DROPOUT_HPP 50 template<
typename InputDataType = arma::mat,
51 typename OutputDataType = arma::mat>
60 Dropout(
const double ratio = 0.5);
69 void Forward(
const arma::Mat<eT>&& input, arma::Mat<eT>&& output);
79 void Backward(
const arma::Mat<eT>&& ,
89 OutputDataType
const&
Delta()
const {
return delta; }
91 OutputDataType&
Delta() {
return delta; }
99 double Ratio()
const {
return ratio; }
105 scale = 1.0 / (1.0 - ratio);
111 template<
typename Archive>
112 void serialize(Archive& ar,
const unsigned int );
116 OutputDataType delta;
119 OutputDataType outputParameter;
138 #include "dropout_impl.hpp" void serialize(Archive &ar, const unsigned int)
Serialize the layer.
void Ratio(const double r)
Modify the probability of setting a value to zero.
OutputDataType & Delta()
Modify the delta.
The core includes that mlpack expects; standard C++ includes and Armadillo.
bool & Deterministic()
Modify the value of the deterministic parameter.
OutputDataType const & Delta() const
Get the detla.
void Backward(const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
Ordinary feed backward pass of the dropout layer.
Dropout(const double ratio=0.5)
Create the Dropout object using the specified ratio parameter.
void Forward(const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
Ordinary feed forward pass of the dropout layer.
double Ratio() const
The probability of setting a value to zero.
OutputDataType const & OutputParameter() const
Get the output parameter.
The dropout layer is a regularizer that randomly with probability 'ratio' sets input values to zero a...
OutputDataType & OutputParameter()
Modify the output parameter.
bool Deterministic() const
The value of the deterministic parameter.