shark::EnergyStoringTemperedMarkovChain< Operator > Class Template Reference

Implements parallel tempering but also stores additional statistics on the energy differences. More...

#include <shark/Unsupervised/RBM/Sampling/EnergyStoringTemperedMarkovChain.h>

Public Types

typedef Operator::RBM RBM
 The type of the RBM the operator is working with. More...
 
typedef TemperedMarkovChain< Operator >::SampleBatch SampleBatch
 A batch of samples containing hidden and visible samples as well as the energies. More...
 
typedef SampleBatch::reference reference
 Mutable reference to an element of the batch. More...
 
typedef SampleBatch::const_reference const_reference
 Immutable reference to an element of the batch. More...
 

Public Member Functions

 EnergyStoringTemperedMarkovChain (RBM *rbm, bool integrateEnergyDifferences=true)
 
const Operator & transitionOperator () const
 
Operator & transitionOperator ()
 
void setNumberOfTemperatures (std::size_t temperatures)
 
void setUniformTemperatureSpacing (std::size_t temperatures)
 
std::size_t numberOfTemperatures () const
 Returns the number Of temperatures. More...
 
void setBatchSize (std::size_t batchSize)
 
std::size_t batchSize ()
 
void setBeta (std::size_t i, double beta)
 
double beta (std::size_t i) const
 
RealVector const & beta () const
 
const_reference sample () const
 Returns the current state of the chain for beta = 1. More...
 
SampleBatch const & samples () const
 Returns the current state of the chain for all beta values. More...
 
SampleBatchsamples ()
 Returns the current batch of samples of the Markov chain. More...
 
void initializeChain (Data< RealVector > const &dataSet)
 Initializes the markov chain using samples drawn uniformly from the set. More...
 
void initializeChain (RealMatrix const &sampleData)
 Initializes with data points from a batch of points. More...
 
void step (unsigned int k)
 
RealMatrix getUpDifferences () const
 
RealMatrix getDownDifferences () const
 
void resetDifferences ()
 
bool & storeEnergyDifferences ()
 
void update ()
 

Static Public Attributes

static const bool computesBatch = false
 The MarkovChain can't be used to compute several samples at once. More...
 

Detailed Description

template<class Operator>
class shark::EnergyStoringTemperedMarkovChain< Operator >

Implements parallel tempering but also stores additional statistics on the energy differences.

Definition at line 40 of file EnergyStoringTemperedMarkovChain.h.

Member Typedef Documentation

◆ const_reference

template<class Operator >
typedef SampleBatch::const_reference shark::EnergyStoringTemperedMarkovChain< Operator >::const_reference

Immutable reference to an element of the batch.

Definition at line 62 of file EnergyStoringTemperedMarkovChain.h.

◆ RBM

template<class Operator >
typedef Operator::RBM shark::EnergyStoringTemperedMarkovChain< Operator >::RBM

The type of the RBM the operator is working with.

Definition at line 53 of file EnergyStoringTemperedMarkovChain.h.

◆ reference

template<class Operator >
typedef SampleBatch::reference shark::EnergyStoringTemperedMarkovChain< Operator >::reference

Mutable reference to an element of the batch.

Definition at line 59 of file EnergyStoringTemperedMarkovChain.h.

◆ SampleBatch

template<class Operator >
typedef TemperedMarkovChain<Operator>::SampleBatch shark::EnergyStoringTemperedMarkovChain< Operator >::SampleBatch

A batch of samples containing hidden and visible samples as well as the energies.

Definition at line 56 of file EnergyStoringTemperedMarkovChain.h.

Constructor & Destructor Documentation

◆ EnergyStoringTemperedMarkovChain()

template<class Operator >
shark::EnergyStoringTemperedMarkovChain< Operator >::EnergyStoringTemperedMarkovChain ( RBM rbm,
bool  integrateEnergyDifferences = true 
)
inline

Definition at line 74 of file EnergyStoringTemperedMarkovChain.h.

Member Function Documentation

◆ batchSize()

template<class Operator >
std::size_t shark::EnergyStoringTemperedMarkovChain< Operator >::batchSize ( )
inline

Definition at line 102 of file EnergyStoringTemperedMarkovChain.h.

◆ beta() [1/2]

template<class Operator >
double shark::EnergyStoringTemperedMarkovChain< Operator >::beta ( std::size_t  i) const
inline

◆ beta() [2/2]

◆ getDownDifferences()

template<class Operator >
RealMatrix shark::EnergyStoringTemperedMarkovChain< Operator >::getDownDifferences ( ) const
inline

◆ getUpDifferences()

template<class Operator >
RealMatrix shark::EnergyStoringTemperedMarkovChain< Operator >::getUpDifferences ( ) const
inline

◆ initializeChain() [1/2]

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::initializeChain ( Data< RealVector > const &  dataSet)
inline

Initializes the markov chain using samples drawn uniformly from the set.

Parameters
dataSetthe data set

Definition at line 135 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::initializeChain().

◆ initializeChain() [2/2]

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::initializeChain ( RealMatrix const &  sampleData)
inline

Initializes with data points from a batch of points.

Parameters
sampleDatathe data set

Definition at line 142 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::initializeChain().

◆ numberOfTemperatures()

template<class Operator >
std::size_t shark::EnergyStoringTemperedMarkovChain< Operator >::numberOfTemperatures ( ) const
inline

Returns the number Of temperatures.

Definition at line 95 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::numberOfTemperatures().

◆ resetDifferences()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::resetDifferences ( )
inline

Definition at line 210 of file EnergyStoringTemperedMarkovChain.h.

◆ sample()

template<class Operator >
const_reference shark::EnergyStoringTemperedMarkovChain< Operator >::sample ( ) const
inline

Returns the current state of the chain for beta = 1.

Definition at line 119 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::sample().

◆ samples() [1/2]

template<class Operator >
SampleBatch const& shark::EnergyStoringTemperedMarkovChain< Operator >::samples ( ) const
inline

Returns the current state of the chain for all beta values.

Definition at line 123 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::samples().

◆ samples() [2/2]

template<class Operator >
SampleBatch& shark::EnergyStoringTemperedMarkovChain< Operator >::samples ( )
inline

Returns the current batch of samples of the Markov chain.

Definition at line 128 of file EnergyStoringTemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::samples().

◆ setBatchSize()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::setBatchSize ( std::size_t  batchSize)
inline

Definition at line 99 of file EnergyStoringTemperedMarkovChain.h.

References SHARK_RUNTIME_CHECK.

◆ setBeta()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::setBeta ( std::size_t  i,
double  beta 
)
inline

◆ setNumberOfTemperatures()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::setNumberOfTemperatures ( std::size_t  temperatures)
inline

◆ setUniformTemperatureSpacing()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::setUniformTemperatureSpacing ( std::size_t  temperatures)
inline

◆ step()

◆ storeEnergyDifferences()

template<class Operator >
bool& shark::EnergyStoringTemperedMarkovChain< Operator >::storeEnergyDifferences ( )
inline

◆ transitionOperator() [1/2]

template<class Operator >
const Operator& shark::EnergyStoringTemperedMarkovChain< Operator >::transitionOperator ( ) const
inline

◆ transitionOperator() [2/2]

template<class Operator >
Operator& shark::EnergyStoringTemperedMarkovChain< Operator >::transitionOperator ( )
inline

◆ update()

template<class Operator >
void shark::EnergyStoringTemperedMarkovChain< Operator >::update ( )
inline

Definition at line 221 of file EnergyStoringTemperedMarkovChain.h.

Member Data Documentation

◆ computesBatch

template<class Operator >
const bool shark::EnergyStoringTemperedMarkovChain< Operator >::computesBatch = false
static

The MarkovChain can't be used to compute several samples at once.

The tempered markov chain ues it's batch capabilities allready to compute the samples for all temperatures At the same time. Also it is much more powerfull when all samples are drawn one after another for a higher mixing rate.

Definition at line 50 of file EnergyStoringTemperedMarkovChain.h.


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