54 template <
typename GUM_SCALAR >
60 template <
typename GUM_SCALAR >
69 template <
typename GUM_SCALAR >
71 BayesNet< GUM_SCALAR >& bayesNet,
72 Tensor< GUM_SCALAR >& src,
73 Tensor< GUM_SCALAR >& marg) {
79 GUM_SCALAR potval = 0;
84 potval += src.get(i_src) * marg.get(i_marg);
87 bayesNet.cpt(node).set(i_dest, potval);
90 bayesNet.cpt(node).normalizeAsCPT();
93 template <
typename GUM_SCALAR >
95 BayesNet< GUM_SCALAR >& bayesNet,
96 Tensor< GUM_SCALAR >& src,
97 GUM_SCALAR variation) {
101 bayesNet.cpt(node).set(i, src.get(i) + GUM_SCALAR(
randomProba()) * variation);
103 bayesNet.cpt(node).normalizeAsCPT();
Class for assigning/browsing values to tuples of discrete variables.
bool end() const
Returns true if the Instantiation reached the end.
Instantiation & setVals(const Instantiation &i)
Assign the values from i in the Instantiation.
void setFirst()
Assign the first values to the tuple of the Instantiation.
SimpleCPTDisturber()
Default constructor.
~SimpleCPTDisturber() override
Destructor.
void disturbAugmCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Tensor< GUM_SCALAR > &src, GUM_SCALAR variation) override
Disturb a CPT using GUM_SCALAR when inserting a new parent new_parent.
void disturbReducCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Tensor< GUM_SCALAR > &src, Tensor< GUM_SCALAR > &marg) override
Disturb a CPT using GUM_SCALAR when removing parent varIdi.
Size NodeId
Type for node ids.
double randomProba()
Returns a random double between 0 and 1 included (i.e.
gum is the global namespace for all aGrUM entities
Source implementation of SimpleCPTDisturber.