aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::LoopySamplingInference< GUM_SCALAR, APPROX > Class Template Reference

<agrum/BN/inference/loopySamplingInference.h> More...

#include <loopySamplingInference.h>

+ Inheritance diagram for gum::LoopySamplingInference< GUM_SCALAR, APPROX >:
+ Collaboration diagram for gum::LoopySamplingInference< GUM_SCALAR, APPROX >:

Public Member Functions

 LoopySamplingInference (const IBayesNet< GUM_SCALAR > *bn)
 Default constructor. More...
 
virtual ~LoopySamplingInference ()
 destructor More...
 
virtual void makeInference_ ()
 makes the inference by generating samples w.r.t the mother class' sampling method after initalizing estimators with loopy belief propagation More...
 
void setVirtualLBPSize (GUM_SCALAR vlbpsize)
 

Protected Attributes

GUM_SCALAR virtualLBPSize_
 

Detailed Description

template<typename GUM_SCALAR, template< typename > class APPROX>
class gum::LoopySamplingInference< GUM_SCALAR, APPROX >

<agrum/BN/inference/loopySamplingInference.h>

class for making hybrid sampling inference with loopy belief propagation and an approximation inference method in Bayesian networks.

This class inherits of template class APPROX, which SHOULD be one of the 4 approximate inference methods (MonteCarlo, Weighted, Importance, Gibbs). It makes the inference with respect to the inherited class' method, after having initialized the estimators with the posteriors obtained by running LoopyBeliefPropagation algorithm.

Definition at line 58 of file loopySamplingInference.h.

Constructor & Destructor Documentation

◆ LoopySamplingInference()

template<typename GUM_SCALAR , template< typename > class APPROX>
gum::LoopySamplingInference< GUM_SCALAR, APPROX >::LoopySamplingInference ( const IBayesNet< GUM_SCALAR > *  bn)
explicit

Default constructor.

Definition at line 40 of file loopySamplingInference_tpl.h.

41  :
44  GUM_CONSTRUCTOR(LoopySamplingInference);
45  }
#define DEFAULT_VIRTUAL_LBP_SIZE
LoopySamplingInference(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.

◆ ~LoopySamplingInference()

template<typename GUM_SCALAR , template< typename > class APPROX>
gum::LoopySamplingInference< GUM_SCALAR, APPROX >::~LoopySamplingInference ( )
virtual

destructor

Definition at line 49 of file loopySamplingInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

49  {
50  GUM_DESTRUCTOR(LoopySamplingInference);
51  }
LoopySamplingInference(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.
+ Here is the call graph for this function:

Member Function Documentation

◆ makeInference_()

template<typename GUM_SCALAR , template< typename > class APPROX>
void gum::LoopySamplingInference< GUM_SCALAR, APPROX >::makeInference_ ( )
virtual

makes the inference by generating samples w.r.t the mother class' sampling method after initalizing estimators with loopy belief propagation

Definition at line 55 of file loopySamplingInference_tpl.h.

References gum::Set< Key, Alloc >::emplace().

55  {
56  LoopyBeliefPropagation< GUM_SCALAR > lbp(&this->BN());
57  for (const auto x: this->hardEvidence()) {
58  lbp.addEvidence(x.first, x.second);
59  }
60  lbp.makeInference();
61 
62  if (!this->isSetEstimator) { this->setEstimatorFromLBP_(&lbp, virtualLBPSize_); }
63 
64  this->loopApproxInference_();
65  }
+ Here is the call graph for this function:

◆ setVirtualLBPSize()

template<typename GUM_SCALAR , template< typename > class APPROX>
void gum::LoopySamplingInference< GUM_SCALAR, APPROX >::setVirtualLBPSize ( GUM_SCALAR  vlbpsize)
inline

Definition at line 74 of file loopySamplingInference.h.

References gum::LoopySamplingInference< GUM_SCALAR, APPROX >::virtualLBPSize_.

74  {
75  if (vlbpsize > 0) virtualLBPSize_ = vlbpsize;
76  };

Member Data Documentation

◆ virtualLBPSize_

template<typename GUM_SCALAR , template< typename > class APPROX>
GUM_SCALAR gum::LoopySamplingInference< GUM_SCALAR, APPROX >::virtualLBPSize_
protected

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