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;
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
void HiddenSize(const size_t hidden)
Sets size of the hidden layer.
Definition: sparse_autoencoder.hpp:153
The core includes that mlpack expects; standard C++ includes and Armadillo.
double Beta() const
Gets the KL divergence parameter.
Definition: sparse_autoencoder.hpp:183
double Rho() const
Gets the sparsity parameter.
Definition: sparse_autoencoder.hpp:195
A sparse autoencoder is a neural network whose aim to learn compressed representations of the data...
Definition: sparse_autoencoder.hpp:63
void VisibleSize(const size_t visible)
Sets size of the visible layer.
Definition: sparse_autoencoder.hpp:141
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'...
Definition: sparse_autoencoder.hpp:135
void GetNewFeatures(arma::mat &data, arma::mat &features)
Transforms the provided data into the representation learned by the sparse autoencoder.
Definition: sparse_autoencoder.cpp:18
size_t HiddenSize() const
Gets the size of the hidden layer.
Definition: sparse_autoencoder.hpp:159
void Lambda(const double l)
Sets the L2-regularization parameter.
Definition: sparse_autoencoder.hpp:165
size_t VisibleSize() const
Gets size of the visible layer.
Definition: sparse_autoencoder.hpp:147
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.
Definition: sparse_autoencoder_impl.hpp:22
double Lambda() const
Gets the L2-regularization parameter.
Definition: sparse_autoencoder.hpp:171
void Rho(const double r)
Sets the sparsity parameter.
Definition: sparse_autoencoder.hpp:189
void Beta(const double b)
Sets the KL divergence parameter.
Definition: sparse_autoencoder.hpp:177