53#define GIBBS_SAMPLING_DEFAULT_EPSILON std::exp(-1.6)
54#define GIBBS_SAMPLING_DEFAULT_MIN_EPSILON_RATE std::exp(-5)
55#define GIBBS_SAMPLING_DEFAULT_BURNIN 300
57#define GIBBS_SAMPLING_POURCENT_DRAWN_SAMPLE 50
58#define GIBBS_SAMPLING_DRAWN_AT_RANDOM true
63 template < GUM_Numeric GUM_SCALAR >
78 template < GUM_Numeric GUM_SCALAR >
83 template < GUM_Numeric GUM_SCALAR >
88 template < GUM_Numeric GUM_SCALAR >
95 if (this->
burnIn() == 0)
return Ip;
100 Ip = this->
draw_(&w, Ip);
107 template < GUM_Numeric GUM_SCALAR >
113 template < GUM_Numeric GUM_SCALAR >
118 template < GUM_Numeric GUM_SCALAR >
This file contains Gibbs sampling class definition.
#define GIBBS_SAMPLING_DEFAULT_MIN_EPSILON_RATE
#define GIBBS_SAMPLING_DRAWN_AT_RANDOM
#define GIBBS_SAMPLING_POURCENT_DRAWN_SAMPLE
#define GIBBS_SAMPLING_DEFAULT_EPSILON
#define GIBBS_SAMPLING_DEFAULT_BURNIN
void setMinEpsilonRate(double rate) override
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
Size burn_in_
Number of iterations before checking stopping criteria.
void setEpsilon(double eps) override
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
Instantiation nextSample(Instantiation prev)
draws next sample of Gibbs sampling
Instantiation monteCarloSample()
draws a Monte Carlo sample
GibbsOperator(const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false)
constructor
void updateSamplingNodes_()
~GibbsSampling() override
Destructor.
Instantiation draw_(GUM_SCALAR *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
Instantiation monteCarloSample_()
draws a Monte Carlo sample
void setBurnIn(Size b)
Number of burn in for one iteration.
Size burnIn() const
Returns the number of burn in.
GibbsSampling(const IBayesNet< GUM_SCALAR > *bn)
Default constructor.
const NodeProperty< Idx > & hardEvidence() const
indicate for each node with hard evidence which value it took
Class representing the minimal interface for Bayesian network with no numerical data.
Class for assigning/browsing values to tuples of discrete variables.
SamplingInference(const IBayesNet< GUM_SCALAR > *bn)
default constructor
std::size_t Size
In aGrUM, hashed values are unsigned long int.
gum is the global namespace for all aGrUM entities