aGrUM  0.13.2
GibbsSampling.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
28 #ifndef GUM_GIBBS_SAMPLING_H
29 #define GUM_GIBBS_SAMPLING_H
30 
33 
34 
35 namespace gum {
36 
51  template < typename GUM_SCALAR >
53  : public SamplingInference< GUM_SCALAR >
54  , public GibbsOperator< GUM_SCALAR > {
55  public:
59  explicit GibbsSampling(const IBayesNet< GUM_SCALAR >* bn);
60 
64  ~GibbsSampling() override;
65 
71  void setBurnIn(Size b) { this->_burn_in = b; };
72 
77  Size burnIn() const { return this->_burn_in; };
78 
79  protected:
81  Instantiation _burnIn() override;
82 
84 
97  Instantiation _draw(float* w, Instantiation prev) override;
98 
100 
111  };
112 
113  extern template class GibbsSampling< float >;
114  extern template class GibbsSampling< double >;
115 } // namespace gum
116 
118 #endif
~GibbsSampling() override
Destructor.
unsigned long Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:50
This file contains Gibbs sampling (for BNs) class definitions.
GibbsSampling(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.
void setBurnIn(Size b)
Number of burn in for one iteration.
Definition: GibbsSampling.h:71
Class representing the minimal interface for Bayesian Network.
Definition: IBayesNet.h:59
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
<agrum/BN/inference/gibbsSampling.h>
Definition: GibbsSampling.h:52
Size _burn_in
Number of iterations before checking stopping criteria.
Implementation of Gibbs Sampling for inference in Bayesian Networks.
This file contains general methods for simulation-oriented approximate inference. ...
Size burnIn() const
Returns the number of burn in.
Definition: GibbsSampling.h:77
Instantiation _monteCarloSample()
draws a Monte Carlo sample
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:80
Instantiation _draw(float *w, Instantiation prev) override
draws a sample given previous one according to Gibbs sampling
Instantiation _burnIn() override
draws a defined number of samples without updating the estimators
class containing all variables and methods required for Gibbssampling
Definition: gibbsOperator.h:47