34 template <
typename GUM_SCALAR >
36 ICPTDisturber< GUM_SCALAR >() {
41 template <
typename GUM_SCALAR >
50 template <
typename GUM_SCALAR >
60 for (i_dest.setFirst(); !i_dest.end(); ++i_dest) {
61 GUM_SCALAR potval = 0;
64 for (i_marg.setFirst(); !i_marg.end(); ++i_marg) {
66 potval += src.
get(i_src) * marg.
get(i_marg);
69 bayesNet.
cpt(node).set(i_dest, potval);
72 bayesNet.
cpt(node).normalizeAsCPT();
75 template <
typename GUM_SCALAR >
80 GUM_SCALAR variation) {
83 for (i.setFirst(); !i.end(); ++i)
84 bayesNet.
cpt(node).set(i,
87 bayesNet.
cpt(node).normalizeAsCPT();
aGrUM's Potential is a multi-dimensional array with tensor operators.
Class representing a Bayesian Network.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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>
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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.