55 template < GUM_Numeric GUM_SCALAR >
61 template < GUM_Numeric GUM_SCALAR >
70 template < GUM_Numeric GUM_SCALAR >
72 BayesNet< GUM_SCALAR >& bayesNet,
73 Tensor< GUM_SCALAR >& src,
74 Tensor< GUM_SCALAR >& marg) {
80 GUM_SCALAR potval = 0;
85 potval += src.get(i_src) * marg.get(i_marg);
88 bayesNet.cpt(node).set(i_dest, potval);
91 bayesNet.cpt(node).normalizeAsCPT();
94 template < GUM_Numeric GUM_SCALAR >
96 BayesNet< GUM_SCALAR >& bayesNet,
97 Tensor< GUM_SCALAR >& src,
98 GUM_SCALAR variation) {
102 bayesNet.cpt(node).set(i, src.get(i) + GUM_SCALAR(
randomProba()) * variation);
104 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.
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.
~SimpleCPTDisturber() override
Destructor.
SimpleCPTDisturber()
Default constructor.
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.