shark::TemperedMarkovChain< Operator > Class Template Reference

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

Public Types

typedef Operator::RBM RBM
 The type of the RBM the operator is working with. More...
 
typedef Batch< detail::MarkovChainSample< HiddenSample, VisibleSample > >::type 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

 TemperedMarkovChain (RBM *rbm)
 
const Operator & transitionOperator () const
 
Operator & transitionOperator ()
 
void setNumberOfTemperatures (std::size_t temperatures)
 Sets the number of temperatures and initializes the tempered chains accordingly. More...
 
void setUniformTemperatureSpacing (std::size_t temperatures)
 Sets the number of temperatures and initializes them in a uniform spacing. More...
 
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)
 

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::TemperedMarkovChain< Operator >

Definition at line 45 of file TemperedMarkovChain.h.

Member Typedef Documentation

◆ const_reference

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

Immutable reference to an element of the batch.

Definition at line 67 of file TemperedMarkovChain.h.

◆ RBM

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

The type of the RBM the operator is working with.

Definition at line 58 of file TemperedMarkovChain.h.

◆ reference

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

Mutable reference to an element of the batch.

Definition at line 64 of file TemperedMarkovChain.h.

◆ SampleBatch

template<class Operator>
typedef Batch<detail::MarkovChainSample<HiddenSample,VisibleSample> >::type shark::TemperedMarkovChain< Operator >::SampleBatch

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

Definition at line 61 of file TemperedMarkovChain.h.

Constructor & Destructor Documentation

◆ TemperedMarkovChain()

template<class Operator>
shark::TemperedMarkovChain< Operator >::TemperedMarkovChain ( RBM rbm)
inline

Definition at line 88 of file TemperedMarkovChain.h.

Member Function Documentation

◆ batchSize()

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

Definition at line 129 of file TemperedMarkovChain.h.

◆ beta() [1/2]

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

◆ beta() [2/2]

template<class Operator>
RealVector const& shark::TemperedMarkovChain< Operator >::beta ( ) const
inline

◆ initializeChain() [1/2]

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

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

Be aware that the number of chains and the temperatures need to bee specified previously.

Parameters
dataSetthe data set

Definition at line 165 of file TemperedMarkovChain.h.

References SHARK_RUNTIME_CHECK.

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::initializeChain().

◆ initializeChain() [2/2]

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

Initializes with data points from a batch of points.

Be aware that the number of chains and the temperatures need to bee specified previously.

Parameters
sampleDatathe data set

Definition at line 180 of file TemperedMarkovChain.h.

References SHARK_RUNTIME_CHECK.

◆ numberOfTemperatures()

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

Returns the number Of temperatures.

Definition at line 122 of file TemperedMarkovChain.h.

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::numberOfTemperatures().

◆ sample()

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

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

Definition at line 148 of file TemperedMarkovChain.h.

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::sample().

◆ samples() [1/2]

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

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

Definition at line 152 of file TemperedMarkovChain.h.

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::samples().

◆ samples() [2/2]

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

Returns the current batch of samples of the Markov chain.

Definition at line 157 of file TemperedMarkovChain.h.

◆ setBatchSize()

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

Definition at line 126 of file TemperedMarkovChain.h.

References SHARK_RUNTIME_CHECK.

◆ setBeta()

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

◆ setNumberOfTemperatures()

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

Sets the number of temperatures and initializes the tempered chains accordingly.

Parameters
temperaturesnumber of temperatures

Definition at line 101 of file TemperedMarkovChain.h.

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::setNumberOfTemperatures(), and shark::TemperedMarkovChain< Operator >::setUniformTemperatureSpacing().

◆ setUniformTemperatureSpacing()

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

Sets the number of temperatures and initializes them in a uniform spacing.

Temperatures are spaced equally between 0 and 1.

Parameters
temperaturesnumber of temperatures

Definition at line 112 of file TemperedMarkovChain.h.

References shark::TemperedMarkovChain< Operator >::setBeta(), and shark::TemperedMarkovChain< Operator >::setNumberOfTemperatures().

Referenced by shark::EnergyStoringTemperedMarkovChain< Operator >::setUniformTemperatureSpacing().

◆ step()

template<class Operator>
void shark::TemperedMarkovChain< Operator >::step ( unsigned int  k)
inline

◆ transitionOperator() [1/2]

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

◆ transitionOperator() [2/2]

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

Definition at line 93 of file TemperedMarkovChain.h.

Member Data Documentation

◆ computesBatch

template<class Operator>
const bool shark::TemperedMarkovChain< 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 55 of file TemperedMarkovChain.h.


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