Dropout< InputDataType, OutputDataType > Class Template Reference

The dropout layer is a regularizer that randomly with probability ratio sets input values to zero and scales the remaining elements by factor 1 / (1 - ratio). More...

Public Member Functions

 Dropout (const double ratio=0.5, const bool rescale=true)
 Create the Dropout object using the specified ratio and rescale parameter. More...

 
template
<
typename
eT
>
void Backward (const arma::Mat< eT > &&, arma::Mat< eT > &&gy, arma::Mat< eT > &&g)
 Ordinary feed backward pass of the dropout layer. More...

 
OutputDataType const & Delta () const
 Get the detla. More...

 
OutputDataType & Delta ()
 Modify the delta. More...

 
bool Deterministic () const
 The value of the deterministic parameter. More...

 
bool & Deterministic ()
 Modify the value of the deterministic parameter. More...

 
template
<
typename
eT
>
void Forward (const arma::Mat< eT > &&input, arma::Mat< eT > &&output)
 Ordinary feed forward pass of the dropout layer. More...

 
InputDataType const & InputParameter () const
 Get the input parameter. More...

 
InputDataType & InputParameter ()
 Modify the input parameter. More...

 
OutputDataType const & OutputParameter () const
 Get the output parameter. More...

 
OutputDataType & OutputParameter ()
 Modify the output parameter. More...

 
double Ratio () const
 The probability of setting a value to zero. More...

 
void Ratio (const double r)
 Modify the probability of setting a value to zero. More...

 
bool Rescale () const
 The value of the rescale parameter. More...

 
bool & Rescale ()
 Modify the value of the rescale parameter. More...

 
template
<
typename
Archive
>
void serialize (Archive &ar, const unsigned int)
 Serialize the layer. More...

 

Detailed Description


template
<
typename
InputDataType
=
arma::mat
,
typename
OutputDataType
=
arma::mat
>

class mlpack::ann::Dropout< InputDataType, OutputDataType >

The dropout layer is a regularizer that randomly with probability ratio sets input values to zero and scales the remaining elements by factor 1 / (1 - ratio).

If rescale is true the input is scaled with 1 / (1-p) when deterministic is false. In the deterministic mode (during testing), the layer just scales the output.

Note: During training you should set deterministic to false and during testing you should set deterministic to true.

For more information, see the following.

@article{Hinton2012,
author = {Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky,
Ilya Sutskever, Ruslan Salakhutdinov},
title = {Improving neural networks by preventing co-adaptation of feature
detectors},
journal = {CoRR},
volume = {abs/1207.0580},
year = {2012},
}
Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Definition at line 54 of file dropout.hpp.

Constructor & Destructor Documentation

◆ Dropout()

Dropout ( const double  ratio = 0.5,
const bool  rescale = true 
)

Create the Dropout object using the specified ratio and rescale parameter.

Parameters
ratioThe probability of setting a value to zero.
rescaleIf true the input is rescaled when deterministic is False.

Member Function Documentation

◆ Backward()

void Backward ( const arma::Mat< eT > &&  ,
arma::Mat< eT > &&  gy,
arma::Mat< eT > &&  g 
)

Ordinary feed backward pass of the dropout layer.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Delta() [1/2]

OutputDataType const& Delta ( ) const
inline

Get the detla.

Definition at line 98 of file dropout.hpp.

◆ Delta() [2/2]

OutputDataType& Delta ( )
inline

Modify the delta.

Definition at line 100 of file dropout.hpp.

◆ Deterministic() [1/2]

bool Deterministic ( ) const
inline

The value of the deterministic parameter.

Definition at line 103 of file dropout.hpp.

◆ Deterministic() [2/2]

bool& Deterministic ( )
inline

Modify the value of the deterministic parameter.

Definition at line 105 of file dropout.hpp.

◆ Forward()

void Forward ( const arma::Mat< eT > &&  input,
arma::Mat< eT > &&  output 
)

Ordinary feed forward pass of the dropout layer.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

◆ InputParameter() [1/2]

InputDataType const& InputParameter ( ) const
inline

Get the input parameter.

Definition at line 88 of file dropout.hpp.

◆ InputParameter() [2/2]

InputDataType& InputParameter ( )
inline

Modify the input parameter.

Definition at line 90 of file dropout.hpp.

◆ OutputParameter() [1/2]

OutputDataType const& OutputParameter ( ) const
inline

Get the output parameter.

Definition at line 93 of file dropout.hpp.

◆ OutputParameter() [2/2]

OutputDataType& OutputParameter ( )
inline

Modify the output parameter.

Definition at line 95 of file dropout.hpp.

◆ Ratio() [1/2]

double Ratio ( ) const
inline

The probability of setting a value to zero.

Definition at line 108 of file dropout.hpp.

◆ Ratio() [2/2]

void Ratio ( const double  r)
inline

Modify the probability of setting a value to zero.

Definition at line 111 of file dropout.hpp.

◆ Rescale() [1/2]

bool Rescale ( ) const
inline

The value of the rescale parameter.

Definition at line 118 of file dropout.hpp.

◆ Rescale() [2/2]

bool& Rescale ( )
inline

Modify the value of the rescale parameter.

Definition at line 120 of file dropout.hpp.

References Dropout< InputDataType, OutputDataType >::serialize().

◆ serialize()

void serialize ( Archive &  ar,
const unsigned  int 
)

Serialize the layer.

Referenced by Dropout< InputDataType, OutputDataType >::Rescale().


The documentation for this class was generated from the following file: