The Energy function determining the Gibbs distribution of an RBM. More...
#include <shark/Unsupervised/RBM/Energy.h>
Public Types | |
typedef RBM::HiddenType | HiddenType |
typedef RBM::VisibleType | VisibleType |
typedef HiddenType::SufficientStatistics | HiddenStatistics |
typedef VisibleType::SufficientStatistics | VisibleStatistics |
typedef HiddenType::StatisticsBatch | HiddenStatisticsBatch |
typedef VisibleType::StatisticsBatch | VisibleStatisticsBatch |
Public Member Functions | |
Energy (RBM const &rbm) | |
RealVector | energy (RealMatrix const &hidden, RealMatrix const &visible) const |
Calculates the Energy given the states of batches of hidden and visible variables . More... | |
void | inputHidden (RealMatrix &inputs, RealMatrix const &visibleStates) const |
Calculates the input of the hidden neurons given the state of the visible in a batch-vise fassion. More... | |
void | inputVisible (RealMatrix &inputs, RealMatrix const &hiddenStates) const |
Calculates the input of the visible neurons given the state of the hidden. More... | |
template<class BetaVector > | |
RealVector | logUnnormalizedProbabilityHidden (RealMatrix const &hiddenState, RealMatrix const &visibleInput, BetaVector const &beta) const |
Computes the logarithm of the unnormalized probability of each state of the hidden neurons in a batch by using the precomputed input/activation of the visible neurons. More... | |
template<class BetaVector > | |
RealVector | logUnnormalizedProbabilityVisible (RealMatrix const &visibleState, RealMatrix const &hiddenInput, BetaVector const &beta) const |
Computes the logarithm of the unnormalized probability of each state of the visible neurons in a batch by using the precomputed input/activation of the hidden neurons. More... | |
template<class BetaVector > | |
RealVector | logUnnormalizedProbabilityVisible (RealMatrix const &visibleStates, BetaVector const &beta) const |
Computes the logarithm of the unnormalized probability for each state of the visible neurons from a batch. More... | |
template<class BetaVector > | |
RealVector | logUnnormalizedProbabilityHidden (RealMatrix const &hiddenStates, BetaVector const &beta) const |
Computes the logarithm of the unnormalized probability of each state of the hidden neurons from a batch. More... | |
RealVector | energyFromHiddenInput (RealMatrix const &hiddenInput, RealMatrix const &hidden, RealMatrix const &visible) const |
Optimization of the calculation of the energy, when the input of the hidden units is already available. More... | |
RealVector | energyFromVisibleInput (RealMatrix const &visibleInput, RealMatrix const &hidden, RealMatrix const &visible) const |
Optimization of the calculation of the energy, when the input of the visible units is already available. More... | |
The Energy function determining the Gibbs distribution of an RBM.
General Energy function which uses the information given by the neurons to automatize the calculation of the value of the energy for certain states, the derivative of the energy and the factorization of the probability.
Following (but slightly simplifying from the formulas given by) Welling at al. a general form of an RBM's Energy function is given by \( E(\vec v,\vec h)= f_h(\vec h) + f_v(\vec v) + \sum_{k,l} \phi_{hk}(\vec h) W_{k,l} \phi_{vl}(\vec v) \) We call \( f_h(\vec h) \) and \( f_v(\vec v) \) the term of the Energy (energy term) associated to the hidden or the visible neurons respectively. \( \sum_{k,l} \phi_{hk}(\vec h) W_{k,l} \phi_{vl}(\vec v) \) is called the interaction term. In the standard case of an binary RBM we have \( f_h(\vec h) = \vec h \vec c \) and \( f_v(\vec v) = \vec v \vec b \), where \( \vec c \) and \( \vec b \) are the vectors of the bias parameters for the hidden and the visible neurons respectively. Furthermore, the interaction term simplifies to \( \vec h W \vec v \), so we have just one singe 'phi-function' for each layer that is the identity function.
typedef HiddenType::SufficientStatistics shark::Energy< RBM >::HiddenStatistics |
typedef HiddenType::StatisticsBatch shark::Energy< RBM >::HiddenStatisticsBatch |
typedef RBM::HiddenType shark::Energy< RBM >::HiddenType |
typedef VisibleType::SufficientStatistics shark::Energy< RBM >::VisibleStatistics |
typedef VisibleType::StatisticsBatch shark::Energy< RBM >::VisibleStatisticsBatch |
typedef RBM::VisibleType shark::Energy< RBM >::VisibleType |
|
inline |
|
inline |
Calculates the Energy given the states of batches of hidden and visible variables .
Definition at line 75 of file Energy.h.
References shark::batchSize(), shark::Energy< RBM >::energyFromHiddenInput(), shark::Energy< RBM >::inputHidden(), and SIZE_CHECK.
|
inline |
Optimization of the calculation of the energy, when the input of the hidden units is already available.
hiddenInput | the vector of inputs of the hidden neurons |
hidden | the states of the hidden neurons |
visible | the states of the visible neurons |
Definition at line 192 of file Energy.h.
References shark::batchSize().
Referenced by shark::Energy< RBM >::energy().
|
inline |
Optimization of the calculation of the energy, when the input of the visible units is already available.
visibleInput | the vector of inputs of the visible neurons |
hidden | the states of the hidden neurons |
visible | the states of the visible neurons |
Definition at line 214 of file Energy.h.
References shark::batchSize().
|
inline |
Calculates the input of the hidden neurons given the state of the visible in a batch-vise fassion.
inputs | the batch of vectors the input of the hidden neurons is stored in |
visibleStates | the batch of states of the visible neurons@ |
Definition at line 90 of file Energy.h.
References shark::RBM< VisibleLayerT, HiddenLayerT, randomT >::inputHidden().
Referenced by shark::Energy< RBM >::energy(), and shark::Energy< RBM >::logUnnormalizedProbabilityVisible().
|
inline |
Calculates the input of the visible neurons given the state of the hidden.
inputs | the vector the input of the visible neurons is stored in |
hiddenStates | the state of the hidden neurons |
Definition at line 100 of file Energy.h.
References shark::RBM< VisibleLayerT, HiddenLayerT, randomT >::inputVisible().
Referenced by shark::Energy< RBM >::logUnnormalizedProbabilityHidden().
|
inline |
Computes the logarithm of the unnormalized probability of each state of the hidden neurons in a batch by using the precomputed input/activation of the visible neurons.
hiddenState | the batch of states of the hidden neurons |
visibleInput | the batch of current inputs for he visible units given hiddenState |
beta | the inverse temperature |
Definition at line 112 of file Energy.h.
References shark::batchSize(), and SIZE_CHECK.
Referenced by shark::Energy< RBM >::logUnnormalizedProbabilityHidden().
|
inline |
Computes the logarithm of the unnormalized probability of each state of the hidden neurons from a batch.
hiddenStates | a batch of states of the hidden neurons |
beta | the inverse temperature |
Definition at line 179 of file Energy.h.
References shark::Energy< RBM >::inputVisible(), shark::Energy< RBM >::logUnnormalizedProbabilityHidden(), and SIZE_CHECK.
|
inline |
Computes the logarithm of the unnormalized probability of each state of the visible neurons in a batch by using the precomputed input/activation of the hidden neurons.
visibleState | the batch of states of the hidden neurons |
hiddenInput | the batch of current inputs for he visible units given visibleState |
beta | the inverse temperature |
Definition at line 141 of file Energy.h.
References shark::batchSize(), and SIZE_CHECK.
Referenced by shark::Energy< RBM >::logUnnormalizedProbabilityVisible().
|
inline |
Computes the logarithm of the unnormalized probability for each state of the visible neurons from a batch.
visibleStates | the batch of states of the hidden neurons |
beta | the inverse temperature |
Definition at line 166 of file Energy.h.
References shark::Energy< RBM >::inputHidden(), shark::Energy< RBM >::logUnnormalizedProbabilityVisible(), and SIZE_CHECK.