52#define GIBBS_SAMPLING_DEFAULT_EPSILON std::exp(-1.6)
53#define GIBBS_SAMPLING_DEFAULT_MIN_EPSILON_RATE std::exp(-5)
54#define GIBBS_SAMPLING_DEFAULT_BURNIN 300
56#define GIBBS_SAMPLING_POURCENT_DRAWN_SAMPLE 50
57#define GIBBS_SAMPLING_DRAWN_AT_RANDOM true
62 template <
typename GUM_SCALAR >
77 template <
typename GUM_SCALAR >
82 template <
typename GUM_SCALAR >
87 template <
typename GUM_SCALAR >
94 if (this->
burnIn() == 0)
return Ip;
99 Ip = this->
draw_(&w, Ip);
106 template <
typename 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)|).
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