12 #ifndef MLPACK_METHODS_SPARSE_AUTOENCODER_SPARSE_AUTOENCODER_HPP 13 #define MLPACK_METHODS_SPARSE_AUTOENCODER_SPARSE_AUTOENCODER_HPP 16 #include <ensmallen.hpp> 81 template<
typename OptimizerType = ens::L_BFGS>
83 const size_t visibleSize,
84 const size_t hiddenSize,
85 const double lambda = 0.0001,
86 const double beta = 3,
87 const double rho = 0.01,
88 OptimizerType optimizer = OptimizerType());
108 template<
typename OptimizerType,
typename... CallbackTypes>
110 const size_t visibleSize,
111 const size_t hiddenSize,
115 OptimizerType optimizer,
116 CallbackTypes&&... callbacks);
135 void Sigmoid(
const arma::mat& x, arma::mat& output)
const 137 output = (1.0 / (1 + arma::exp(-x)));
143 this->visibleSize = visible;
155 this->hiddenSize = hidden;
202 arma::mat parameters;
219 #include "sparse_autoencoder_impl.hpp" Linear algebra utility functions, generally performed on matrices or vectors.
size_t VisibleSize() const
Gets size of the visible layer.
void GetNewFeatures(arma::mat &data, arma::mat &features)
Transforms the provided data into the representation learned by the sparse autoencoder.
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Rho(const double r)
Sets the sparsity parameter.
size_t HiddenSize() const
Gets the size of the hidden layer.
double Lambda() const
Gets the L2-regularization parameter.
A sparse autoencoder is a neural network whose aim to learn compressed representations of the data...
double Rho() const
Gets the sparsity parameter.
SparseAutoencoder(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, OptimizerType optimizer=OptimizerType())
Construct the sparse autoencoder model with the given training data.
void Lambda(const double l)
Sets the L2-regularization parameter.
void Beta(const double b)
Sets the KL divergence parameter.
double Beta() const
Gets the KL divergence parameter.
void HiddenSize(const size_t hidden)
Sets size of the hidden layer.
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'...
void VisibleSize(const size_t visible)
Sets size of the visible layer.