57 template <
typename GUM_SCALAR >
66 template <
typename GUM_SCALAR >
71 template <
typename GUM_SCALAR >
86 template <
typename GUM_SCALAR >
90 for (
const auto nod:
samplingBn_.topologicalOrder()) {
101 template <
typename GUM_SCALAR >
108 template <
typename GUM_SCALAR >
110 for (
Idx i = 0; i <
nbr_; i++) {
121 template <
typename GUM_SCALAR >
128 GUM_ASSERT(p.
nbrDim() == 1);
void _drawVarMonteCarlo_(NodeId nod, Instantiation *I)
const IBayesNet< GUM_SCALAR > & samplingBn_
void _GibbsSample_(NodeId id, Instantiation *I)
change in Instantiation I a new drawn value for id
Instantiation nextSample(Instantiation prev)
draws next sample of Gibbs sampling
Sequence< NodeId > samplingNodes_
Instantiation monteCarloSample()
draws a Monte Carlo sample
const NodeProperty< Idx > * hardEv_
GibbsOperator(const IBayesNet< GUM_SCALAR > &BN, const NodeProperty< Idx > *hardEv, Size nbr=1, bool atRandom=false)
constructor
virtual ~GibbsOperator()
Destructor.
void updateSamplingNodes_()
Class representing the minimal interface for Bayesian network with no numerical data.
Class for assigning/browsing values to tuples of discrete variables.
Instantiation & chgVal(const DiscreteVariable &v, Idx newval)
Assign newval to variable v in the Instantiation.
void add(const DiscreteVariable &v) final
Adds a new variable in the Instantiation.
void erase(const DiscreteVariable &v) final
Removes a variable from the Instantiation.
Exception: at least one argument passed to a function is not what was expected.
virtual Idx nbrDim() const final
Returns the number of vars in the multidimensional container.
aGrUM's Tensor is a multi-dimensional array with tensor operators.
Idx draw() const
get a value at random from a 1-D distribution
const Tensor< GUM_SCALAR > & normalize() const
normalisation of this do nothing if sum is 0
GUM_SCALAR sum() const
sum of all elements in the Tensor
#define GUM_ERROR(type, msg)
This file contains Gibbs sampling (for BNs) class definitions.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Idx randomValue(const Size max=2)
Returns a random Idx between 0 and max-1 included.
gum is the global namespace for all aGrUM entities
Contains useful methods for random stuff.