31 template <
typename GUM_SCALAR >
33 ICPTDisturber< GUM_SCALAR >() {
38 template <
typename GUM_SCALAR >
47 template <
typename GUM_SCALAR >
57 for (i_dest.setFirst(); !i_dest.end(); ++i_dest) {
58 GUM_SCALAR potval = 0;
61 for (i_marg.setFirst(); !i_marg.end(); ++i_marg) {
63 potval += src.
get(i_src) * marg.
get(i_marg);
66 bayesNet.
cpt(node).set(i_dest, potval);
69 bayesNet.
cpt(node).normalizeAsCPT();
72 template <
typename GUM_SCALAR >
77 GUM_SCALAR variation) {
80 for (i.setFirst(); !i.end(); ++i)
81 bayesNet.
cpt(node).set(i,
84 bayesNet.
cpt(node).normalizeAsCPT();
aGrUM's Potential is a multi-dimensional array with tensor operators.
Class representing a Bayesian Network.
Source implementation of SimpleCPTDisturber.
virtual GUM_SCALAR get(const Instantiation &i) const final
Default implementation of MultiDimContainer::get().
double randomProba()
Returns a random double between 0 and 1 included (i.e.
<agrum/BN/generator/simpleCPTDisturber.h>
gum is the global namespace for all aGrUM entities
Instantiation & setVals(const Instantiation &i)
Assign the values from i in the Instantiation.
const Potential< GUM_SCALAR > & cpt(NodeId varId) const final
Returns the CPT of a variable.
Class for assigning/browsing values to tuples of discrete variables.
void disturbAugmCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Potential< GUM_SCALAR > &src, GUM_SCALAR variation) override
Disturb a CPT using GUM_SCALAR when inserting a new parent new_parent.
SimpleCPTDisturber()
Default constructor.
~SimpleCPTDisturber() override
Destructor.
void disturbReducCPT(NodeId node, BayesNet< GUM_SCALAR > &bayesNet, Potential< GUM_SCALAR > &src, Potential< GUM_SCALAR > &marg) override
Disturb a CPT using GUM_SCALAR when removing parent varIdi.
Size NodeId
Type for node ids.