mlpack
Public Member Functions | List of all members
mlpack::ann::Reparametrization< InputDataType, OutputDataType > Class Template Reference

Implementation of the Reparametrization layer class. More...

#include <reparametrization.hpp>

Public Member Functions

 Reparametrization ()
 Create the Reparametrization object.
 
 Reparametrization (const size_t latentSize, const bool stochastic=true, const bool includeKl=true, const double beta=1)
 Create the Reparametrization layer object using the specified sample vector size. More...
 
 Reparametrization (const Reparametrization &layer)
 Copy Constructor.
 
 Reparametrization (Reparametrization &&layer)
 Move Constructor.
 
Reparametrizationoperator= (const Reparametrization &layer)
 Copy assignment operator.
 
Reparametrizationoperator= (Reparametrization &&layer)
 Move assignment operator.
 
template<typename eT >
void Forward (const arma::Mat< eT > &input, arma::Mat< eT > &output)
 Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More...
 
template<typename eT >
void Backward (const arma::Mat< eT > &input, const arma::Mat< eT > &gy, arma::Mat< eT > &g)
 Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f. More...
 
OutputDataType const & OutputParameter () const
 Get the output parameter.
 
OutputDataType & OutputParameter ()
 Modify the output parameter.
 
OutputDataType const & Delta () const
 Get the delta.
 
OutputDataType & Delta ()
 Modify the delta.
 
size_t const & OutputSize () const
 Get the output size.
 
size_t & OutputSize ()
 Modify the output size.
 
double Loss ()
 Get the KL divergence with standard normal.
 
bool Stochastic () const
 Get the value of the stochastic parameter.
 
bool IncludeKL () const
 Get the value of the includeKl parameter.
 
double Beta () const
 Get the value of the beta hyperparameter.
 
size_t InputShape () const
 
template<typename Archive >
void serialize (Archive &ar, const uint32_t)
 Serialize the layer.
 

Detailed Description

template<typename InputDataType = arma::mat, typename OutputDataType = arma::mat>
class mlpack::ann::Reparametrization< InputDataType, OutputDataType >

Implementation of the Reparametrization layer class.

This layer samples from the given parameters of a normal distribution.

This class also supports beta-VAE, a state-of-the-art framework for automated discovery of interpretable factorised latent representations from raw image data in a completely unsupervised manner.

For more information, refer the following paper.

@article{ICLR2017,
title = {beta-VAE: Learning basic visual concepts with a constrained
variational framework},
author = {Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess,
Xavier Glorot, Matthew Botvinick, Shakir Mohamed and
Alexander Lerchner | Google DeepMind},
journal = {2017 International Conference on Learning Representations(ICLR)},
year = {2017},
url = {https://deepmind.com/research/publications/beta-VAE-Learning-Basic-Visual-Concepts-with-a-Constrained-Variational-Framework}
}
Template Parameters
InputDataTypeType of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).
OutputDataTypeType of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube).

Constructor & Destructor Documentation

◆ Reparametrization()

template<typename InputDataType , typename OutputDataType >
mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Reparametrization ( const size_t  latentSize,
const bool  stochastic = true,
const bool  includeKl = true,
const double  beta = 1 
)

Create the Reparametrization layer object using the specified sample vector size.

Parameters
latentSizeThe number of output latent units.
stochasticWhether we want random sample or constant.
includeKlWhether we want to include KL loss in backward function.
betaThe beta (hyper)parameter for beta-VAE mentioned above.

Member Function Documentation

◆ Backward()

template<typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Backward ( const arma::Mat< eT > &  input,
const arma::Mat< eT > &  gy,
arma::Mat< eT > &  g 
)

Ordinary feed backward pass of a neural network, calculating the function f(x) by propagating x backwards trough f.

Using the results from the feed forward pass.

Parameters
inputThe propagated input activation.
gyThe backpropagated error.
gThe calculated gradient.

◆ Forward()

template<typename InputDataType , typename OutputDataType >
template<typename eT >
void mlpack::ann::Reparametrization< InputDataType, OutputDataType >::Forward ( const arma::Mat< eT > &  input,
arma::Mat< eT > &  output 
)

Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.

Parameters
inputInput data used for evaluating the specified function.
outputResulting output activation.

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