![]() |
aGrUM
0.16.0
|
class containing all variables and methods required for Gibbssampling More...
#include <agrum/BN/inference/gibbsOperator.h>
Public Member Functions | |
GibbsOperator (const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false) | |
constructor More... | |
virtual | ~GibbsOperator () |
Destructor. More... | |
Size | nbrDrawnVar () const |
Getters and setters. More... | |
void | setNbrDrawnVar (Size nbr) |
bool | isDrawnAtRandom () const |
void | setDrawnAtRandom (bool atRandom) |
Instantiation | monteCarloSample () |
draws a Monte Carlo sample More... | |
Instantiation | nextSample (Instantiation prev) |
draws next sample of Gibbs sampling More... | |
Protected Attributes | |
Size | _counting |
number of samples drawn More... | |
const IBayesNet< GUM_SCALAR > & | _sampling_bn |
const NodeProperty< Idx > * | _hardEv |
Sequence< NodeId > | _samplingNodes |
Size | _nbr |
bool | _atRandom |
class containing all variables and methods required for Gibbssampling
Definition at line 50 of file gibbsOperator.h.
gum::GibbsOperator< GUM_SCALAR >::GibbsOperator | ( | const IBayesNet< GUM_SCALAR > & | BN, |
const NodeProperty< Idx > * | hardEv, | ||
Size | nbr = 1 , |
||
bool | atRandom = false |
||
) |
constructor
Definition at line 37 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::__updateSamplingNodes().
|
virtual |
Destructor.
Definition at line 48 of file gibbsOperator_tpl.h.
|
private |
Definition at line 85 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::_sampling_bn, gum::Instantiation::chgVal(), and gum::Instantiation::erase().
Referenced by gum::GibbsOperator< GUM_SCALAR >::monteCarloSample().
|
private |
change in Instantiation I a new drawn value for id
Definition at line 107 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::_sampling_bn, gum::Instantiation::chgVal(), gum::Potential< GUM_SCALAR >::draw(), gum::Instantiation::erase(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), gum::Potential< GUM_SCALAR >::normalize(), and gum::Potential< GUM_SCALAR >::sum().
Referenced by gum::GibbsOperator< GUM_SCALAR >::nextSample().
|
private |
Definition at line 53 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::_hardEv, gum::GibbsOperator< GUM_SCALAR >::_nbr, gum::GibbsOperator< GUM_SCALAR >::_sampling_bn, gum::GibbsOperator< GUM_SCALAR >::_samplingNodes, gum::SequenceImplementation< Key, Alloc, Gen >::clear(), GUM_ERROR, gum::SequenceImplementation< Key, Alloc, Gen >::insert(), and gum::SequenceImplementation< Key, Alloc, Gen >::size().
Referenced by gum::GibbsOperator< GUM_SCALAR >::GibbsOperator().
|
inline |
Definition at line 70 of file gibbsOperator.h.
References gum::GibbsOperator< GUM_SCALAR >::_atRandom.
Instantiation gum::GibbsOperator< GUM_SCALAR >::monteCarloSample | ( | ) |
draws a Monte Carlo sample
returns a MC sample This is not a really sample since we take into account evidence without care about parent of evidence, etc. This is just a not-so-bad first sample for GibbsSampler
Definition at line 70 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::__drawVarMonteCarlo(), gum::GibbsOperator< GUM_SCALAR >::_hardEv, gum::GibbsOperator< GUM_SCALAR >::_sampling_bn, gum::Instantiation::add(), and gum::Instantiation::chgVal().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::GibbsSampling< GUM_SCALAR >::_monteCarloSample(), and gum::GibbsOperator< GUM_SCALAR >::setDrawnAtRandom().
|
inline |
Getters and setters.
Definition at line 66 of file gibbsOperator.h.
References gum::GibbsOperator< GUM_SCALAR >::_nbr.
Instantiation gum::GibbsOperator< GUM_SCALAR >::nextSample | ( | Instantiation | prev | ) |
draws next sample of Gibbs sampling
Definition at line 95 of file gibbsOperator_tpl.h.
References gum::GibbsOperator< GUM_SCALAR >::__GibbsSample(), gum::GibbsOperator< GUM_SCALAR >::_atRandom, gum::GibbsOperator< GUM_SCALAR >::_counting, gum::GibbsOperator< GUM_SCALAR >::_nbr, gum::GibbsOperator< GUM_SCALAR >::_samplingNodes, gum::randomValue(), and gum::SequenceImplementation< Key, Alloc, Gen >::size().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::_computeKL(), gum::GibbsSampling< GUM_SCALAR >::_draw(), and gum::GibbsOperator< GUM_SCALAR >::setDrawnAtRandom().
|
inline |
Definition at line 72 of file gibbsOperator.h.
References gum::GibbsOperator< GUM_SCALAR >::_atRandom, gum::GibbsOperator< GUM_SCALAR >::monteCarloSample(), and gum::GibbsOperator< GUM_SCALAR >::nextSample().
|
inline |
|
protected |
Definition at line 90 of file gibbsOperator.h.
Referenced by gum::GibbsOperator< GUM_SCALAR >::isDrawnAtRandom(), gum::GibbsOperator< GUM_SCALAR >::nextSample(), and gum::GibbsOperator< GUM_SCALAR >::setDrawnAtRandom().
|
protected |
number of samples drawn
Definition at line 82 of file gibbsOperator.h.
Referenced by gum::GibbsOperator< GUM_SCALAR >::nextSample().
|
protected |
Definition at line 84 of file gibbsOperator.h.
Referenced by gum::GibbsOperator< GUM_SCALAR >::__updateSamplingNodes(), and gum::GibbsOperator< GUM_SCALAR >::monteCarloSample().
|
protected |
Definition at line 87 of file gibbsOperator.h.
Referenced by gum::GibbsOperator< GUM_SCALAR >::__updateSamplingNodes(), gum::GibbsOperator< GUM_SCALAR >::nbrDrawnVar(), gum::GibbsOperator< GUM_SCALAR >::nextSample(), and gum::GibbsOperator< GUM_SCALAR >::setNbrDrawnVar().
|
protected |
|
protected |
Definition at line 85 of file gibbsOperator.h.
Referenced by gum::GibbsOperator< GUM_SCALAR >::__updateSamplingNodes(), and gum::GibbsOperator< GUM_SCALAR >::nextSample().