SYNOPSIS

Public Member Functions

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.

Private Attributes

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.

Detailed Description

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.

Constructor & Destructor Documentation

mlpack::nn::SparseAutoencoderFunction::SparseAutoencoderFunction (const arma::mat &data, const size_tvisibleSize, const size_thiddenSize, const doublelambda = \fC0.0001\fP, const doublebeta = \fC3\fP, const doublerho = \fC0.01\fP)

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.

Member Function Documentation

void mlpack::nn::SparseAutoencoderFunction::Beta (const doubleb)\fC [inline]\fP

Sets the KL divergence parameter.

Definition at line 134 of file sparse_autoencoder_function.hpp.

References beta.

double mlpack::nn::SparseAutoencoderFunction::Beta () const\fC [inline]\fP

Gets the KL divergence parameter.

Definition at line 140 of file sparse_autoencoder_function.hpp.

References beta.

double mlpack::nn::SparseAutoencoderFunction::Evaluate (const arma::mat ¶meters) const

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.

const arma::mat& mlpack::nn::SparseAutoencoderFunction::GetInitialPoint () const\fC [inline]\fP

Return the initial point for the optimization.

Definition at line 95 of file sparse_autoencoder_function.hpp.

References initialPoint.

void mlpack::nn::SparseAutoencoderFunction::Gradient (const arma::mat ¶meters, arma::mat &gradient) const

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.

void mlpack::nn::SparseAutoencoderFunction::HiddenSize (const size_thidden)\fC [inline]\fP

Sets size of the hidden layer.

Definition at line 110 of file sparse_autoencoder_function.hpp.

size_t mlpack::nn::SparseAutoencoderFunction::HiddenSize () const\fC [inline]\fP

Gets the size of the hidden layer.

Definition at line 116 of file sparse_autoencoder_function.hpp.

References hiddenSize.

const arma::mat mlpack::nn::SparseAutoencoderFunction::InitializeWeights ()

Initializes the parameters of the model to suitable values.

void mlpack::nn::SparseAutoencoderFunction::Lambda (const doublel)\fC [inline]\fP

Sets the L2-regularization parameter.

Definition at line 122 of file sparse_autoencoder_function.hpp.

References lambda.

double mlpack::nn::SparseAutoencoderFunction::Lambda () const\fC [inline]\fP

Gets the L2-regularization parameter.

Definition at line 128 of file sparse_autoencoder_function.hpp.

References lambda.

void mlpack::nn::SparseAutoencoderFunction::Rho (const doubler)\fC [inline]\fP

Sets the sparsity parameter.

Definition at line 146 of file sparse_autoencoder_function.hpp.

References rho.

double mlpack::nn::SparseAutoencoderFunction::Rho () const\fC [inline]\fP

Gets the sparsity parameter.

Definition at line 152 of file sparse_autoencoder_function.hpp.

References rho.

void mlpack::nn::SparseAutoencoderFunction::Sigmoid (const arma::mat &x, arma::mat &output) const\fC [inline]\fP

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.

void mlpack::nn::SparseAutoencoderFunction::VisibleSize (const size_tvisible)\fC [inline]\fP

Sets size of the visible layer.

Definition at line 98 of file sparse_autoencoder_function.hpp.

size_t mlpack::nn::SparseAutoencoderFunction::VisibleSize () const\fC [inline]\fP

Gets size of the visible layer.

Definition at line 104 of file sparse_autoencoder_function.hpp.

References visibleSize.

Member Data Documentation

double mlpack::nn::SparseAutoencoderFunction::beta\fC [private]\fP

KL divergence parameter.

Definition at line 169 of file sparse_autoencoder_function.hpp.

Referenced by Beta().

const arma::mat& mlpack::nn::SparseAutoencoderFunction::data\fC [private]\fP

The matrix of data points.

Definition at line 159 of file sparse_autoencoder_function.hpp.

size_t mlpack::nn::SparseAutoencoderFunction::hiddenSize\fC [private]\fP

Size of the hidden layer.

Definition at line 165 of file sparse_autoencoder_function.hpp.

Referenced by HiddenSize().

arma::mat mlpack::nn::SparseAutoencoderFunction::initialPoint\fC [private]\fP

Initial parameter vector.

Definition at line 161 of file sparse_autoencoder_function.hpp.

Referenced by GetInitialPoint().

double mlpack::nn::SparseAutoencoderFunction::lambda\fC [private]\fP

L2-regularization parameter.

Definition at line 167 of file sparse_autoencoder_function.hpp.

Referenced by Lambda().

double mlpack::nn::SparseAutoencoderFunction::rho\fC [private]\fP

Sparsity parameter.

Definition at line 171 of file sparse_autoencoder_function.hpp.

Referenced by Rho().

size_t mlpack::nn::SparseAutoencoderFunction::visibleSize\fC [private]\fP

Size of the visible layer.

Definition at line 163 of file sparse_autoencoder_function.hpp.

Referenced by VisibleSize().

Author

Generated automatically by Doxygen for MLPACK from the source code.