aGrUM  0.16.0
gibbsOperator.h
Go to the documentation of this file.
1 
31 #ifndef GUM_GIBBS_OPERATOR_H
32 #define GUM_GIBBS_OPERATOR_H
33 
34 #include <agrum/BN/IBayesNet.h>
37 
38 namespace gum {
39 
49  template < typename GUM_SCALAR >
50  class GibbsOperator {
51  public:
56  const NodeProperty< Idx >* hardEv,
57  Size nbr = 1,
58  bool atRandom = false);
59 
63  virtual ~GibbsOperator();
64 
66  Size nbrDrawnVar() const { return _nbr; }
67 
68  void setNbrDrawnVar(Size nbr) { _nbr = nbr; }
69 
70  bool isDrawnAtRandom() const { return _atRandom; }
71 
72  void setDrawnAtRandom(bool atRandom) { _atRandom = atRandom; }
73 
76 
79 
80  protected:
86 
88 
89  protected:
90  bool _atRandom;
91 
92 
93  private:
94  void __updateSamplingNodes();
95  // adds a node to current instantiation
97  void __GibbsSample(NodeId id, Instantiation* I);
98  };
99 
100 
101 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
102  extern template class GibbsOperator< double >;
103 #endif
104 
105 } // namespace gum
106 
108 #endif
bool isDrawnAtRandom() const
Definition: gibbsOperator.h:70
GibbsOperator(const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false)
constructor
Size nbrDrawnVar() const
Getters and setters.
Definition: gibbsOperator.h:66
Sequence< NodeId > _samplingNodes
Definition: gibbsOperator.h:85
void __drawVarMonteCarlo(NodeId nod, Instantiation *I)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:62
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
const IBayesNet< GUM_SCALAR > & _sampling_bn
Definition: gibbsOperator.h:83
void setDrawnAtRandom(bool atRandom)
Definition: gibbsOperator.h:72
Size _counting
number of samples drawn
Definition: gibbsOperator.h:82
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Instantiation nextSample(Instantiation prev)
draws next sample of Gibbs sampling
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __GibbsSample(NodeId id, Instantiation *I)
change in Instantiation I a new drawn value for id
virtual ~GibbsOperator()
Destructor.
const NodeProperty< Idx > * _hardEv
Definition: gibbsOperator.h:84
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Instantiation monteCarloSample()
draws a Monte Carlo sample
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
void setNbrDrawnVar(Size nbr)
Definition: gibbsOperator.h:68
Size NodeId
Type for node ids.
Definition: graphElements.h:98
class containing all variables and methods required for Gibbssampling
Definition: gibbsOperator.h:50