aGrUM 3.3.2
a C++ library for (probabilistic) graphical models
gum::GibbsOperator< GUM_SCALAR > Class Template Reference

class containing all variables and methods required for Gibbssampling More...

#include <agrum/BN/inference/gibbsOperator.h>

Inheritance diagram for gum::GibbsOperator< GUM_SCALAR >:
[legend]
Collaboration diagram for gum::GibbsOperator< GUM_SCALAR >:
[legend]

Public Member Functions

 GibbsOperator (const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false)
 constructor
 GibbsOperator (const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, const std::string &section)
 Constructor whose Gibbs parameters are read from gum::Configuration.
virtual ~GibbsOperator ()
 Destructor.
Size nbrDrawnVar () const
 Getters and setters.
void setNbrDrawnVar (Size nbr)
bool isDrawnAtRandom () const
void setDrawnAtRandom (bool atRandom)
Instantiation monteCarloSample ()
 draws a first sample with a positive probability (starting point of a Gibbs chain)
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

bool _pruneDomains_ ()
void _mask_ (NodeId node, Tensor< GUM_SCALAR > &p) const
Instantiation _forwardSample_ ()
void _drawVarMonteCarlo_ (NodeId nod, Instantiation *I)
bool _isCompatible_ (const Instantiation &I) const
void _smoothedGibbsSample_ (NodeId id, Instantiation *I, GUM_SCALAR epsilon)
void _GibbsSample_ (NodeId id, Instantiation *I)
 change in Instantiation I a new drawn value for id

Private Attributes

NodeProperty< std::vector< bool > > _allowed_
 the values of each node that may belong to a sample with a positive probability
NodeProperty< GUM_SCALAR > _minNonZero_
 the smallest positive probability of the CPT of each node (for the smoothed Gibbs moves)

Static Private Attributes

static constexpr Size _nbrRejectionTries_ = 100
 number of forward samples drawn before searching a compatible sample by smoothed Gibbs moves
static constexpr Size _nbrSmoothingRestarts_ = 10
 number of restarts (from a new forward sample) of the smoothed Gibbs moves
static constexpr std::array< double, 4 > _smoothingLevels_ = {1e-3, 1e-2, 1e-1, 0.5}
 growing smoothing levels: a null probability is replaced by epsilon times the smallest positive probability of its CPT
static constexpr Size _nbrSweepsBySmoothingLevel_ = 50
 maximal number of sweeps (over the non-evidence nodes) for each smoothing level

Detailed Description

template<GUM_Numeric GUM_SCALAR>
class gum::GibbsOperator< GUM_SCALAR >

class containing all variables and methods required for Gibbssampling

Definition at line 70 of file gibbsOperator.h.

Constructor & Destructor Documentation

◆ GibbsOperator() [1/2]

template<GUM_Numeric GUM_SCALAR>
gum::GibbsOperator< GUM_SCALAR >::GibbsOperator ( const IBayesNet< GUM_SCALAR > & BN,
const NodeProperty< Idx > * hardEv,
Size nbr = 1,
bool atRandom = false )

constructor

Definition at line 79 of file gibbsOperator_tpl.h.

82 :
85 }
class containing all variables and methods required for Gibbssampling
const IBayesNet< GUM_SCALAR > & samplingBn_
const NodeProperty< Idx > * hardEv_
GibbsOperator(const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false)
constructor

References GibbsOperator(), atRandom_, counting_, hardEv_, nbr_, and samplingBn_.

Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), GibbsOperator(), GibbsOperator(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), and ~GibbsOperator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GibbsOperator() [2/2]

template<GUM_Numeric GUM_SCALAR>
gum::GibbsOperator< GUM_SCALAR >::GibbsOperator ( const IBayesNet< GUM_SCALAR > & BN,
const NodeProperty< Idx > * hardEv,
const std::string & section )

Constructor whose Gibbs parameters are read from gum::Configuration.

The key percentDrawnSample of the section gives the percentage (0 to 100) of the variables drawn between two samples and the key drawnAtRandom tells whether they are chosen at random or in turn.

Parameters
BNThe Bayesian network to sample.
hardEvThe hard evidence (may be nullptr).
sectionThe name of the section of the configuration.

Definition at line 63 of file gibbsOperator_tpl.h.

65 :
67 BN,
68 hardEv,
69 // number of variables drawn between two samples (percentage of the variables, in [0,100]
70 // according to the domain of the key)
71 1
72 + (BN.size()
73 * static_cast< Size >(
74 Configuration::instance().typed< std::int64_t >(section, "percentDrawnSample"))
75 / 100),
76 Configuration::instance().typed< bool >(section, "drawnAtRandom")) {}

References GibbsOperator().

Here is the call graph for this function:

◆ ~GibbsOperator()

template<GUM_Numeric GUM_SCALAR>
gum::GibbsOperator< GUM_SCALAR >::~GibbsOperator ( )
virtual

Destructor.

Definition at line 88 of file gibbsOperator_tpl.h.

88 {
90 }

References GibbsOperator().

Here is the call graph for this function:

Member Function Documentation

◆ _drawVarMonteCarlo_()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::_drawVarMonteCarlo_ ( NodeId nod,
Instantiation * I )
private

Definition at line 287 of file gibbsOperator_tpl.h.

287 {
289 Itop.erase(samplingBn_.variable(nod));
290 auto p = samplingBn_.cpt(nod).extract(Itop);
291 _mask_(nod, p);
292 // if no allowed value is possible, the sample is incompatible anyway
293 if (p.sum() == GUM_SCALAR(0)) p = samplingBn_.cpt(nod).extract(Itop);
294 else p.normalize();
295 I->chgVal(samplingBn_.variable(nod), p.draw());
296 }
void _mask_(NodeId node, Tensor< GUM_SCALAR > &p) const

References _mask_(), gum::Instantiation::chgVal(), gum::Instantiation::erase(), and samplingBn_.

Referenced by _forwardSample_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _forwardSample_()

template<GUM_Numeric GUM_SCALAR>
Instantiation gum::GibbsOperator< GUM_SCALAR >::_forwardSample_ ( )
private

Definition at line 153 of file gibbsOperator_tpl.h.

153 {
155
156 for (const auto nod: samplingBn_.topologicalOrder()) {
157 I.add(samplingBn_.variable(nod));
158 if (hardEv_ != nullptr && hardEv_->exists(nod)) {
159 I.chgVal(samplingBn_.variable(nod), (*hardEv_)[nod]);
160 } else {
162 }
163 }
164 return I;
165 }
void _drawVarMonteCarlo_(NodeId nod, Instantiation *I)

References _drawVarMonteCarlo_(), gum::Instantiation::add(), gum::Instantiation::chgVal(), hardEv_, and samplingBn_.

Referenced by monteCarloSample().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _GibbsSample_()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::_GibbsSample_ ( NodeId id,
Instantiation * I )
private

change in Instantiation I a new drawn value for id

Definition at line 312 of file gibbsOperator_tpl.h.

312 {
314 Itop.erase(samplingBn_.variable(id));
315 gum::Tensor< GUM_SCALAR > p = samplingBn_.cpt(id).extract(Itop);
316 for (const auto nod: samplingBn_.children(id))
317 p *= samplingBn_.cpt(nod).extract(Itop);
318 GUM_ASSERT(p.nbrDim() == 1);
319 if (p.sum() != 0) {
320 p.normalize();
321 I->chgVal(samplingBn_.variable(id), p.draw());
322 }
323 }

References gum::Instantiation::chgVal(), gum::Tensor< GUM_SCALAR >::draw(), gum::Instantiation::erase(), gum::Tensor< GUM_SCALAR >::extract(), gum::MultiDimDecorator< GUM_ELEMENT >::nbrDim(), gum::Tensor< GUM_SCALAR >::normalize(), samplingBn_, and gum::Tensor< GUM_SCALAR >::sum().

Referenced by nextSample().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _isCompatible_()

template<GUM_Numeric GUM_SCALAR>
bool gum::GibbsOperator< GUM_SCALAR >::_isCompatible_ ( const Instantiation & I) const
private

Definition at line 168 of file gibbsOperator_tpl.h.

168 {
169 for (const auto node: samplingBn_.nodes())
170 if (samplingBn_.cpt(node).get(I) == GUM_SCALAR(0)) return false;
171 return true;
172 }

References samplingBn_.

Referenced by monteCarloSample().

Here is the caller graph for this function:

◆ _mask_()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::_mask_ ( NodeId node,
Tensor< GUM_SCALAR > & p ) const
private

Definition at line 278 of file gibbsOperator_tpl.h.

278 {
279 const auto allowed = _allowed_.tryGet(node);
280 if (!allowed) return;
282 for (J.setFirst(); !J.end(); J.inc())
283 if (!(*allowed)[J.val(0)]) p.set(J, GUM_SCALAR(0));
284 }
NodeProperty< std::vector< bool > > _allowed_
the values of each node that may belong to a sample with a positive probability

References _allowed_, gum::Instantiation::end(), gum::Instantiation::inc(), gum::Instantiation::setFirst(), and gum::Instantiation::val().

Referenced by _drawVarMonteCarlo_(), and _smoothedGibbsSample_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _pruneDomains_()

template<GUM_Numeric GUM_SCALAR>
bool gum::GibbsOperator< GUM_SCALAR >::_pruneDomains_ ( )
private

Definition at line 198 of file gibbsOperator_tpl.h.

198 {
199 _allowed_.clear();
200 for (const auto node: samplingBn_.nodes()) {
201 const auto domainSize = samplingBn_.variable(node).domainSize();
202 if (hardEv_ != nullptr && hardEv_->exists(node)) {
204 allowed[(*hardEv_)[node]] = true;
206 } else {
208 }
209 }
210
211 // only the CPTs with null probabilities may prune values
215 for (const auto node: samplingBn_.nodes())
216 if (samplingBn_.cpt(node).min() == GUM_SCALAR(0)) {
217 withZeros.insert(node);
218 inQueue.insert(node);
219 queue.push_back(node);
220 }
221
222 while (!queue.empty()) {
223 const NodeId f = queue.back();
224 queue.pop_back();
225 inQueue.erase(f);
226
227 // the supported values: those in a positive entry of the CPT whose values are all allowed
228 const auto& cpt = samplingBn_.cpt(f);
229 const auto& vars = cpt.variablesSequence();
232 for (const auto var: vars) {
233 ids.push_back(samplingBn_.nodeId(*var));
234 supported.emplace_back(var->domainSize(), false);
235 }
237 for (I.setFirst(); !I.end(); I.inc()) {
238 if (cpt[I] == GUM_SCALAR(0)) continue;
239 bool allowed = true;
240 for (Idx k = 0; k < ids.size() && allowed; ++k)
241 allowed = _allowed_[ids[k]][I.val(k)];
242 if (allowed)
243 for (Idx k = 0; k < ids.size(); ++k)
244 supported[k][I.val(k)] = true;
245 }
246
247 // removing the unsupported values
248 for (Idx k = 0; k < ids.size(); ++k) {
249 auto& allowed = _allowed_[ids[k]];
250 bool changed = false;
251 bool empty = true;
252 for (Idx val = 0; val < allowed.size(); ++val) {
253 if (allowed[val] && !supported[k][val]) {
254 allowed[val] = false;
255 changed = true;
256 }
257 if (allowed[val]) empty = false;
258 }
259 if (empty) return false;
260
261 if (changed) { // the CPTs containing this node have to be revised
262 auto revise = [&](NodeId g) {
263 if (withZeros.contains(g) && !inQueue.contains(g)) {
264 inQueue.insert(g);
265 queue.push_back(g);
266 }
267 };
268 revise(ids[k]);
269 for (const auto child: samplingBn_.children(ids[k]))
270 revise(child);
271 }
272 }
273 }
274 return true;
275 }

References _allowed_, gum::Set< Key >::contains(), gum::Instantiation::end(), gum::Set< Key >::erase(), hardEv_, gum::Instantiation::inc(), gum::Set< Key >::insert(), samplingBn_, gum::Instantiation::setFirst(), and gum::Instantiation::val().

Referenced by monteCarloSample().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _smoothedGibbsSample_()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::_smoothedGibbsSample_ ( NodeId id,
Instantiation * I,
GUM_SCALAR epsilon )
private

Definition at line 175 of file gibbsOperator_tpl.h.

177 {
179 Itop.erase(samplingBn_.variable(id));
180 // a null probability is replaced by epsilon times the smallest positive probability of its CPT:
181 // a null probability always weighs less than any positive probability of the same CPT
185 for (J.setFirst(); !J.end(); J.inc())
186 if (t[J] == GUM_SCALAR(0)) t.set(J, replacement);
187 return t;
188 };
189 gum::Tensor< GUM_SCALAR > p = smoothed(id, samplingBn_.cpt(id).extract(Itop));
190 for (const auto nod: samplingBn_.children(id))
191 p *= smoothed(nod, samplingBn_.cpt(nod).extract(Itop));
192 _mask_(id, p);
193 p.normalize();
194 I->chgVal(samplingBn_.variable(id), p.draw());
195 }
NodeProperty< GUM_SCALAR > _minNonZero_
the smallest positive probability of the CPT of each node (for the smoothed Gibbs moves)

References _mask_(), _minNonZero_, gum::Instantiation::chgVal(), gum::Tensor< GUM_SCALAR >::draw(), gum::Instantiation::end(), gum::Instantiation::erase(), gum::Instantiation::inc(), gum::Tensor< GUM_SCALAR >::normalize(), samplingBn_, and gum::Instantiation::setFirst().

Referenced by monteCarloSample().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDrawnAtRandom()

template<GUM_Numeric GUM_SCALAR>
bool gum::GibbsOperator< GUM_SCALAR >::isDrawnAtRandom ( ) const

Definition at line 336 of file gibbsOperator_tpl.h.

336 {
337 return atRandom_;
338 }

References atRandom_.

◆ monteCarloSample()

template<GUM_Numeric GUM_SCALAR>
Instantiation gum::GibbsOperator< GUM_SCALAR >::monteCarloSample ( )

draws a first sample with a positive probability (starting point of a Gibbs chain)

From a sample with a null probability, every Gibbs move may have a null mass: the chain would never leave it. Hence the search for a sample with a positive probability, which is a constraint satisfaction problem (NP-hard in general). The search is heuristic:

  1. the domains are pruned by generalized arc consistency on the null probabilities of the CPTs, starting from the hard evidence. An empty domain proves that the evidence is incompatible with the model;
  2. up to nbrRejectionTries forward samples are drawn in the pruned domains;
  3. then, Gibbs moves are performed in a smoothed model (a null probability is replaced by epsilon times the smallest positive probability of its CPT), with growing smoothing levels (smoothingLevels, nbrSweepsBySmoothingLevel sweeps each) and nbrSmoothingRestarts restarts from new forward samples.

Limits: arc consistency is not complete (it may not detect an incompatibility involving several CPTs together, e.g. a parity constraint over a chain of XOR), and the search is stochastic and bounded. Hence, when the compatible samples are very rare (long chains of deterministic constraints, several deterministic plateaus), the search may fail even though such a sample exists, and the result may depend on the random seed. OperationNotAllowed then means "not found", not "does not exist". An exact inference (e.g. LazyPropagation) can decide whether the evidence is compatible (evidence probability > 0).

Exceptions
IncompatibleEvidenceif the pruning proves that the evidence has a null probability
OperationNotAllowedif no sample with a positive probability is found

Definition at line 105 of file gibbsOperator_tpl.h.

105 {
106 // From a sample with a null probability, every Gibbs move may have a null mass: the chain would
107 // stay there forever. Hence the first sample must have a positive probability.
108
109 // 0. the values that cannot belong to such a sample are pruned
110 if (!_pruneDomains_()) {
112 "The hard evidence has a null probability (incompatible with the model)")
113 }
114
115 // 1. a few forward samples (in the pruned domains)
117 for (Size tries = 0; tries < _nbrRejectionTries_; ++tries) {
118 I = _forwardSample_();
119 if (_isCompatible_(I)) return I;
120 }
121
122 // 2. Gibbs moves in a smoothed model (null probabilities replaced by epsilon): the chain is
123 // attracted by the samples with fewer null probabilities. A small epsilon gives a strong
124 // attraction, a larger one helps to get through samples with more null probabilities: epsilon
125 // grows only when the chain is stuck. The sampled distribution does not matter here: we stop as
126 // soon as the sample is compatible. The chain may still be stuck on a plateau, depending on its
127 // start: hence a few restarts from new forward samples.
129 for (const auto node: samplingBn_.nodes())
130 if (hardEv_ == nullptr || !hardEv_->exists(node)) sampled.push_back(node);
131
132 // the smallest positive probability of each CPT (used by the smoothing) is computed once
133 _minNonZero_.clear();
134 for (const auto node: samplingBn_.nodes())
135 _minNonZero_.insert(node, samplingBn_.cpt(node).minNonZero());
136
138 if (restart > 0) I = _forwardSample_();
139 for (const auto epsilon: _smoothingLevels_) {
141 for (const auto node: sampled)
143 if (_isCompatible_(I)) return I;
144 }
145 }
146 }
148 "No sample with a positive probability found: the evidence may be incompatible "
149 "with the model")
150 }
void _smoothedGibbsSample_(NodeId id, Instantiation *I, GUM_SCALAR epsilon)
static constexpr Size _nbrSweepsBySmoothingLevel_
maximal number of sweeps (over the non-evidence nodes) for each smoothing level
bool _isCompatible_(const Instantiation &I) const
static constexpr std::array< double, 4 > _smoothingLevels_
growing smoothing levels: a null probability is replaced by epsilon times the smallest positive proba...
Instantiation _forwardSample_()
static constexpr Size _nbrSmoothingRestarts_
number of restarts (from a new forward sample) of the smoothed Gibbs moves
static constexpr Size _nbrRejectionTries_
number of forward samples drawn before searching a compatible sample by smoothed Gibbs moves

References _forwardSample_(), _isCompatible_(), _minNonZero_, _nbrRejectionTries_, _nbrSmoothingRestarts_, _nbrSweepsBySmoothingLevel_, _pruneDomains_(), _smoothedGibbsSample_(), _smoothingLevels_, GUM_ERROR, hardEv_, and samplingBn_.

Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::GibbsSampling< GUM_SCALAR >::monteCarloSample_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nbrDrawnVar()

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::nbrDrawnVar ( ) const

Getters and setters.

Definition at line 326 of file gibbsOperator_tpl.h.

326 {
327 return nbr_;
328 }

References nbr_.

◆ nextSample()

template<GUM_Numeric GUM_SCALAR>
Instantiation gum::GibbsOperator< GUM_SCALAR >::nextSample ( Instantiation prev)

draws next sample of Gibbs sampling

Definition at line 299 of file gibbsOperator_tpl.h.

299 {
300 for (Idx i = 0; i < nbr_; i++) {
301 auto pos
304 counting_++;
305 }
306 return prev;
307 }
void _GibbsSample_(NodeId id, Instantiation *I)
change in Instantiation I a new drawn value for id
Sequence< NodeId > samplingNodes_

References _GibbsSample_(), atRandom_, counting_, nbr_, gum::randomValue(), and samplingNodes_.

Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::GibbsSampling< GUM_SCALAR >::draw_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDrawnAtRandom()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::setDrawnAtRandom ( bool atRandom)

Definition at line 341 of file gibbsOperator_tpl.h.

341 {
343 }

References atRandom_.

◆ setNbrDrawnVar()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::setNbrDrawnVar ( Size nbr)

Definition at line 331 of file gibbsOperator_tpl.h.

331 {
332 nbr_ = nbr;
333 }

References nbr_.

◆ updateSamplingNodes_()

template<GUM_Numeric GUM_SCALAR>
void gum::GibbsOperator< GUM_SCALAR >::updateSamplingNodes_ ( )
protected

Definition at line 93 of file gibbsOperator_tpl.h.

93 {
94 samplingNodes_.clear();
95 for (const auto node: samplingBn_.nodes())
96 if (hardEv_ == nullptr || !hardEv_->exists(node)) { samplingNodes_.insert(node); }
97 if (samplingNodes_.size() == 0) {
98 GUM_ERROR(InvalidArgument, "No node to sample (too many nodes or too much evidence)!")
99 }
100 if (nbr_ > samplingNodes_.size()) nbr_ = samplingNodes_.size();
101 }

References GUM_ERROR, hardEv_, nbr_, samplingBn_, and samplingNodes_.

Referenced by gum::GibbsSampling< GUM_SCALAR >::burnIn_(), and gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().

Here is the caller graph for this function:

Member Data Documentation

◆ _allowed_

template<GUM_Numeric GUM_SCALAR>
NodeProperty< std::vector< bool > > gum::GibbsOperator< GUM_SCALAR >::_allowed_
private

the values of each node that may belong to a sample with a positive probability

Definition at line 166 of file gibbsOperator.h.

Referenced by _mask_(), and _pruneDomains_().

◆ _minNonZero_

template<GUM_Numeric GUM_SCALAR>
NodeProperty< GUM_SCALAR > gum::GibbsOperator< GUM_SCALAR >::_minNonZero_
private

the smallest positive probability of the CPT of each node (for the smoothed Gibbs moves)

Definition at line 169 of file gibbsOperator.h.

Referenced by _smoothedGibbsSample_(), and monteCarloSample().

◆ _nbrRejectionTries_

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::_nbrRejectionTries_ = 100
staticconstexprprivate

number of forward samples drawn before searching a compatible sample by smoothed Gibbs moves

Definition at line 153 of file gibbsOperator.h.

Referenced by monteCarloSample().

◆ _nbrSmoothingRestarts_

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::_nbrSmoothingRestarts_ = 10
staticconstexprprivate

number of restarts (from a new forward sample) of the smoothed Gibbs moves

Definition at line 156 of file gibbsOperator.h.

Referenced by monteCarloSample().

◆ _nbrSweepsBySmoothingLevel_

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::_nbrSweepsBySmoothingLevel_ = 50
staticconstexprprivate

maximal number of sweeps (over the non-evidence nodes) for each smoothing level

Definition at line 163 of file gibbsOperator.h.

Referenced by monteCarloSample().

◆ _smoothingLevels_

template<GUM_Numeric GUM_SCALAR>
std::array< double, 4 > gum::GibbsOperator< GUM_SCALAR >::_smoothingLevels_ = {1e-3, 1e-2, 1e-1, 0.5}
staticconstexprprivate

growing smoothing levels: a null probability is replaced by epsilon times the smallest positive probability of its CPT

Definition at line 160 of file gibbsOperator.h.

Referenced by monteCarloSample().

◆ atRandom_

template<GUM_Numeric GUM_SCALAR>
bool gum::GibbsOperator< GUM_SCALAR >::atRandom_
protected

Definition at line 147 of file gibbsOperator.h.

Referenced by GibbsOperator(), isDrawnAtRandom(), nextSample(), and setDrawnAtRandom().

◆ counting_

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::counting_
protected

Definition at line 141 of file gibbsOperator.h.

Referenced by GibbsOperator(), and nextSample().

◆ hardEv_

template<GUM_Numeric GUM_SCALAR>
const NodeProperty< Idx >* gum::GibbsOperator< GUM_SCALAR >::hardEv_
protected

◆ nbr_

template<GUM_Numeric GUM_SCALAR>
Size gum::GibbsOperator< GUM_SCALAR >::nbr_
protected

◆ samplingBn_

template<GUM_Numeric GUM_SCALAR>
const IBayesNet< GUM_SCALAR >& gum::GibbsOperator< GUM_SCALAR >::samplingBn_
protected

◆ samplingNodes_

template<GUM_Numeric GUM_SCALAR>
Sequence< NodeId > gum::GibbsOperator< GUM_SCALAR >::samplingNodes_
protected

Definition at line 144 of file gibbsOperator.h.

Referenced by nextSample(), and updateSamplingNodes_().


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