![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
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 | |
| virtual | ~GibbsOperator () |
| Destructor. | |
| Size | nbrDrawnVar () const |
| Getters and setters. | |
| void | setNbrDrawnVar (Size nbr) |
| bool | isDrawnAtRandom () const |
| void | setDrawnAtRandom (bool atRandom) |
| Instantiation | monteCarloSample () |
| draws a Monte Carlo sample | |
| Instantiation | nextSample (Instantiation prev) |
| draws next sample of Gibbs sampling | |
Protected Member Functions | |
| void | updateSamplingNodes_ () |
Protected Attributes | |
| Size | counting_ |
| const IBayesNet< GUM_SCALAR > & | samplingBn_ |
| const NodeProperty< Idx > * | hardEv_ |
| Sequence< NodeId > | samplingNodes_ |
| Size | nbr_ |
| bool | atRandom_ |
Private Member Functions | |
| void | _drawVarMonteCarlo_ (NodeId nod, Instantiation *I) |
| void | _GibbsSample_ (NodeId id, Instantiation *I) |
| change in Instantiation I a new drawn value for id | |
class containing all variables and methods required for Gibbssampling
Definition at line 67 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 58 of file gibbsOperator_tpl.h.
References GibbsOperator(), atRandom_, counting_, hardEv_, nbr_, and samplingBn_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), GibbsOperator(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), and ~GibbsOperator().
|
virtual |
Destructor.
Definition at line 67 of file gibbsOperator_tpl.h.
References GibbsOperator().
|
private |
Definition at line 102 of file gibbsOperator_tpl.h.
References gum::Instantiation::chgVal(), gum::Instantiation::erase(), and samplingBn_.
Referenced by monteCarloSample().
|
private |
change in Instantiation I a new drawn value for id
Definition at line 122 of file gibbsOperator_tpl.h.
References gum::Instantiation::chgVal(), gum::Tensor< GUM_SCALAR >::draw(), gum::Instantiation::erase(), gum::MultiDimDecorator< GUM_SCALAR >::nbrDim(), gum::Tensor< GUM_SCALAR >::normalize(), samplingBn_, and gum::Tensor< GUM_SCALAR >::sum().
Referenced by nextSample().
|
inline |
| 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 87 of file gibbsOperator_tpl.h.
References _drawVarMonteCarlo_(), gum::Instantiation::add(), gum::Instantiation::chgVal(), hardEv_, and samplingBn_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::GibbsSampling< GUM_SCALAR >::monteCarloSample_().
|
inline |
| Instantiation gum::GibbsOperator< GUM_SCALAR >::nextSample | ( | Instantiation | prev | ) |
draws next sample of Gibbs sampling
Definition at line 109 of file gibbsOperator_tpl.h.
References _GibbsSample_(), atRandom_, counting_, nbr_, gum::randomValue(), and samplingNodes_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::GibbsSampling< GUM_SCALAR >::draw_().
|
inline |
|
inline |
|
protected |
Definition at line 72 of file gibbsOperator_tpl.h.
References GUM_ERROR, hardEv_, nbr_, samplingBn_, and samplingNodes_.
Referenced by gum::GibbsSampling< GUM_SCALAR >::burnIn_(), and gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().
|
protected |
Definition at line 104 of file gibbsOperator.h.
Referenced by GibbsOperator(), isDrawnAtRandom(), nextSample(), and setDrawnAtRandom().
|
protected |
Definition at line 98 of file gibbsOperator.h.
Referenced by GibbsOperator(), and nextSample().
|
protected |
Definition at line 100 of file gibbsOperator.h.
Referenced by GibbsOperator(), monteCarloSample(), and updateSamplingNodes_().
|
protected |
Definition at line 103 of file gibbsOperator.h.
Referenced by GibbsOperator(), nbrDrawnVar(), nextSample(), setNbrDrawnVar(), and updateSamplingNodes_().
|
protected |
Definition at line 99 of file gibbsOperator.h.
Referenced by GibbsOperator(), _drawVarMonteCarlo_(), _GibbsSample_(), monteCarloSample(), and updateSamplingNodes_().
|
protected |
Definition at line 101 of file gibbsOperator.h.
Referenced by nextSample(), and updateSamplingNodes_().