This is a class for the sparse autoencoder objective function.
SparseAutoencoderFunction (const arma::mat &data, const size_t visibleSize, const size_t hiddenSize, const double lambda=0.0001, const double beta=3, const double rho=0.01)
Construct the sparse autoencoder objective function with the given parameters. void Beta (const double b)
Sets the KL divergence parameter. double Beta () const
Gets the KL divergence parameter. double Evaluate (const arma::mat ¶meters) const
Evaluates the objective function of the sparse autoencoder model using the given parameters. const arma::mat & GetInitialPoint () const
Return the initial point for the optimization. void Gradient (const arma::mat ¶meters, arma::mat &gradient) const
Evaluates the gradient values of the objective function given the current set of parameters. void HiddenSize (const size_t hidden)
Sets size of the hidden layer. size_t HiddenSize () const
Gets the size of the hidden layer. const arma::mat InitializeWeights ()
Initializes the parameters of the model to suitable values. void Lambda (const double l)
Sets the L2-regularization parameter. double Lambda () const
Gets the L2-regularization parameter. void Rho (const double r)
Sets the sparsity parameter. double Rho () const
Gets the sparsity parameter. void Sigmoid (const arma::mat &x, arma::mat &output) const
Returns the elementwise sigmoid of the passed matrix, where the sigmoid function of a real number 'x' is [1 / (1 + exp(-x))]. void VisibleSize (const size_t visible)
Sets size of the visible layer. size_t VisibleSize () const
Gets size of the visible layer.
double beta
KL divergence parameter. const arma::mat & data
The matrix of data points. size_t hiddenSize
Size of the hidden layer. arma::mat initialPoint
Initial parameter vector. double lambda
L2-regularization parameter. double rho
Sparsity parameter. size_t visibleSize
Size of the visible layer.
This is a class for the sparse autoencoder objective function.
It can be used to create learning models like self-taught learning, stacked autoencoders, conditional random fields (CRFs), and so forth.
Definition at line 36 of file sparse_autoencoder_function.hpp.
Construct the sparse autoencoder objective function with the given parameters.
Parameters:
data The data matrix.
visibleSize Size of input vector expected at the visible layer.
hiddenSize Size of input vector expected at the hidden layer.
lambda L2-regularization parameter.
beta KL divergence parameter.
rho Sparsity parameter.
Sets the KL divergence parameter.
Definition at line 134 of file sparse_autoencoder_function.hpp.
References beta.
Gets the KL divergence parameter.
Definition at line 140 of file sparse_autoencoder_function.hpp.
References beta.
Evaluates the objective function of the sparse autoencoder model using the given parameters. The cost function has terms for the reconstruction error, regularization cost and the sparsity cost. The objective function takes a low value when the model is able to reconstruct the data well using weights which are low in value and when the average activations of neurons in the hidden layers agrees well with the sparsity parameter 'rho'.
Parameters:
parameters Current values of the model parameters.
Return the initial point for the optimization.
Definition at line 95 of file sparse_autoencoder_function.hpp.
References initialPoint.
Evaluates the gradient values of the objective function given the current set of parameters. The function performs a feedforward pass and computes the error in reconstructing the data points. It then uses the backpropagation algorithm to compute the gradient values.
Parameters:
parameters Current values of the model parameters.
gradient Matrix where gradient values will be stored.
Sets size of the hidden layer.
Definition at line 110 of file sparse_autoencoder_function.hpp.
Gets the size of the hidden layer.
Definition at line 116 of file sparse_autoencoder_function.hpp.
References hiddenSize.
Initializes the parameters of the model to suitable values.
Sets the L2-regularization parameter.
Definition at line 122 of file sparse_autoencoder_function.hpp.
References lambda.
Gets the L2-regularization parameter.
Definition at line 128 of file sparse_autoencoder_function.hpp.
References lambda.
Sets the sparsity parameter.
Definition at line 146 of file sparse_autoencoder_function.hpp.
References rho.
Gets the sparsity parameter.
Definition at line 152 of file sparse_autoencoder_function.hpp.
References rho.
Returns the elementwise sigmoid of the passed matrix, where the sigmoid function of a real number 'x' is [1 / (1 + exp(-x))].
Parameters:
x Matrix of real values for which we require the sigmoid activation.
Definition at line 89 of file sparse_autoencoder_function.hpp.
Sets size of the visible layer.
Definition at line 98 of file sparse_autoencoder_function.hpp.
Gets size of the visible layer.
Definition at line 104 of file sparse_autoencoder_function.hpp.
References visibleSize.
KL divergence parameter.
Definition at line 169 of file sparse_autoencoder_function.hpp.
Referenced by Beta().
The matrix of data points.
Definition at line 159 of file sparse_autoencoder_function.hpp.
Size of the hidden layer.
Definition at line 165 of file sparse_autoencoder_function.hpp.
Referenced by HiddenSize().
Initial parameter vector.
Definition at line 161 of file sparse_autoencoder_function.hpp.
Referenced by GetInitialPoint().
L2-regularization parameter.
Definition at line 167 of file sparse_autoencoder_function.hpp.
Referenced by Lambda().
Sparsity parameter.
Definition at line 171 of file sparse_autoencoder_function.hpp.
Referenced by Rho().
Size of the visible layer.
Definition at line 163 of file sparse_autoencoder_function.hpp.
Referenced by VisibleSize().
Generated automatically by Doxygen for MLPACK from the source code.