NeuralNet 1.0
Loading...
Searching...
No Matches
NeuralNet::Dropout Class Reference
Inheritance diagram for NeuralNet::Dropout:
NeuralNet::Layer

Public Member Functions

 Dropout (float rate, unsigned int seed=0)
 The Dropout layer randomly sets input units to 0 with a frequency of rate at each step during training time, which helps prevent overfitting. Inputs not set to 0 are scaled up by 1 / (1 - rate) such that the sum over all inputs is unchanged.
 
std::string getSlug () const override
 Dropout layer slug.
 
Eigen::MatrixXd feedInputs (Eigen::MatrixXd inputs, bool training=false) override
 This method is used to feed the inputs to the layer.
 
- Public Member Functions inherited from NeuralNet::Layer
Eigen::MatrixXd getOutputs () const
 This method get the layer's outputs.
 
int getNumNeurons () const
 This method get the number of neurons actually in the layer.
 
void printOutputs ()
 Method to print layer's outputs.
 
virtual Eigen::MatrixXd feedInputs (std::vector< double > inputs, bool training=false)
 This method is used to feed the inputs to the layer.
 
virtual void feedInputs (std::vector< std::vector< std::vector< double > > > inputs, bool training=false)
 This method is used to feed the inputs to the layer.
 
const std::string typeStr ()
 

Public Attributes

float rate
 
float scaleRate
 
unsigned int seed
 
Eigen::MatrixXd mask
 

Protected Member Functions

void init (int numNeurons) override
 
Eigen::MatrixXd computeOutputs (Eigen::MatrixXd inputs, bool training) override
 Drop some of the inputs randomly at the given rate.
 
- Protected Member Functions inherited from NeuralNet::Layer
void setOutputs (Eigen::MatrixXd outputs)
 
void setOutputs (std::vector< double > outputs)
 This method is used to set the outputs of the layer.
 
 Layer (std::tuple< int, int > inputShape)
 

Friends

class cereal::access
 

Additional Inherited Members

- Protected Attributes inherited from NeuralNet::Layer
int nNeurons
 
Eigen::MatrixXd outputs
 
LayerType type = LayerType::DEFAULT
 
bool trainingOnly = false
 

Constructor & Destructor Documentation

◆ Dropout()

NeuralNet::Dropout::Dropout ( float rate,
unsigned int seed = 0 )
inline

The Dropout layer randomly sets input units to 0 with a frequency of rate at each step during training time, which helps prevent overfitting. Inputs not set to 0 are scaled up by 1 / (1 - rate) such that the sum over all inputs is unchanged.

Parameters
rateFrequency of units set to 0
seedAn integer to use as a random seed

Member Function Documentation

◆ computeOutputs()

Eigen::MatrixXd NeuralNet::Dropout::computeOutputs ( Eigen::MatrixXd inputs,
bool training )
inlineoverrideprotectedvirtual

Drop some of the inputs randomly at the given rate.

Parameters
inputsA matrix representing the inputs (features)
Returns
Inputs with some dropped values (zero-ed values) randomly

Implements NeuralNet::Layer.

◆ feedInputs()

Eigen::MatrixXd NeuralNet::Dropout::feedInputs ( Eigen::MatrixXd inputs,
bool training = false )
inlineoverridevirtual

This method is used to feed the inputs to the layer.

Parameters
inputsAn Eigen::MatrixXd representing the inputs (features)
Returns
an Eigen::MatrixXd representing the outputs of the layer

Implements NeuralNet::Layer.

◆ getSlug()

std::string NeuralNet::Dropout::getSlug ( ) const
inlineoverridevirtual

Dropout layer slug.

Implements NeuralNet::Layer.

◆ init()

void NeuralNet::Dropout::init ( int numNeurons)
inlineoverrideprotectedvirtual
Parameters
numNeuronsNumber of neurons of the previous layers

Reimplemented from NeuralNet::Layer.


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