![]() |
aGrUM
0.16.0
|
Class template representing a Credal Network. More...
#include <agrum/CN/credalNet.h>
Public Member Functions | |
void | saveBNsMinMax (const std::string &min_path, const std::string &max_path) const |
If this CredalNet was built over a perturbed BayesNet, one can save the intervals as two BayesNet. More... | |
std::string | toString () const |
void | computeCPTMinMax () |
Used with binary networks to speed-up L2U inference. More... | |
Constructors / Destructors | |
CredalNet () | |
Constructor used to create a CredalNet step by step, i.e. More... | |
CredalNet (const std::string &src_min_num, const std::string &src_max_den="") | |
Constructor for interval defined credal network which takes 2 BayesNet file path. More... | |
CredalNet (const BayesNet< GUM_SCALAR > &src_min_num, const BayesNet< GUM_SCALAR > &src_max_den=BayesNet< GUM_SCALAR >()) | |
Constructor for interval defined credal network which takes 2 BayesNet. More... | |
~CredalNet () | |
Destructor. More... | |
Credal network creation | |
NodeId | addVariable (const std::string &name, const Size &card) |
Adds a discrete node into the network. More... | |
void | addArc (const NodeId &tail, const NodeId &head) |
Adds an arc between two nodes. More... | |
void | setCPTs (const NodeId &id, const std::vector< std::vector< std::vector< GUM_SCALAR > > > &cpt) |
Set the vertices of the credal sets ( all of the conditionals ) of a given node More... | |
void | setCPT (const NodeId &id, Size &entry, const std::vector< std::vector< GUM_SCALAR > > &cpt) |
Set the vertices of one credal set of a given node ( any instantiation index ) More... | |
void | setCPT (const NodeId &id, Instantiation ins, const std::vector< std::vector< GUM_SCALAR > > &cpt) |
Set the vertices of one credal set of a given node ( any instantiation ) More... | |
void | fillConstraints (const NodeId &id, const std::vector< GUM_SCALAR > &lower, const std::vector< GUM_SCALAR > &upper) |
Set the interval constraints of the credal sets of a given node ( all instantiations ) More... | |
void | fillConstraint (const NodeId &id, const Idx &entry, const std::vector< GUM_SCALAR > &lower, const std::vector< GUM_SCALAR > &upper) |
Set the interval constraints of a credal set of a given node ( from an instantiation index ) More... | |
void | fillConstraint (const NodeId &id, Instantiation ins, const std::vector< GUM_SCALAR > &lower, const std::vector< GUM_SCALAR > &upper) |
Set the interval constraints of a credal sets of a given node ( from an instantiation ) More... | |
Instantiation | instantiation (const NodeId &id) |
Get an Instantiation from a node id, usefull to fill the constraints of the network More... | |
Size | domainSize (const NodeId &id) |
Get the cardinality of a node More... | |
Public manipulation methods | |
void | bnToCredal (const GUM_SCALAR beta, const bool oneNet, const bool keepZeroes=false) |
Perturbates the BayesNet provided as input for this CredalNet by generating intervals instead of point probabilities and then computes each vertex of each credal set. More... | |
void | intervalToCredalWithFiles () |
void | intervalToCredal () |
Computes the vertices of each credal set according to their interval definition (uses lrs). More... | |
void | lagrangeNormalization () |
Normalize counts of a BayesNet storing counts of each events such that no probability is 0. More... | |
void | idmLearning (const Idx s=0, const bool keepZeroes=false) |
Learns parameters from a BayesNet storing counts of events. More... | |
void | approximatedBinarization () |
Approximate binarization. More... | |
Getters and setters | |
const BayesNet< GUM_SCALAR > & | src_bn () const |
const BayesNet< GUM_SCALAR > & | current_bn () const |
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & | credalNet_currentCpt () const |
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & | credalNet_srcCpt () const |
NodeType | currentNodeType (const NodeId &id) const |
NodeType | nodeType (const NodeId &id) const |
const GUM_SCALAR & | epsilonMin () const |
const GUM_SCALAR & | epsilonMax () const |
const GUM_SCALAR & | epsilonMean () const |
const bool | isSeparatelySpecified () const |
const bool | hasComputedCPTMinMax () const |
const std::vector< std::vector< GUM_SCALAR > > & | get_CPT_min () const |
Used with binary networks to speed-up L2U inference. More... | |
const std::vector< std::vector< GUM_SCALAR > > & | get_CPT_max () const |
Used with binary networks to speed-up L2U inference. More... | |
Public Types | |
enum | NodeType : char { NodeType::Precise, NodeType::Credal, NodeType::Vacuous, NodeType::Indic } |
NodeType to speed-up computations in some algorithms. More... | |
Class template representing a Credal Network.
GUM_SCALAR | A floating type ( float, GUM_SCALAR, long GUM_SCALAR ... ). |
Definition at line 89 of file credalNet.h.
|
strong |
NodeType to speed-up computations in some algorithms.
Enumerator | |
---|---|
Precise | |
Credal | |
Vacuous | |
Indic |
Definition at line 92 of file credalNet.h.
gum::credal::CredalNet< GUM_SCALAR >::CredalNet | ( | ) |
Constructor used to create a CredalNet step by step, i.e.
node by node, arc by arc, manually filling potentials.
Definition at line 31 of file credalNet_tpl.h.
gum::credal::CredalNet< GUM_SCALAR >::CredalNet | ( | const std::string & | src_min_num, |
const std::string & | src_max_den = "" |
||
) |
Constructor for interval defined credal network which takes 2 BayesNet file path.
One can also provide a single BayesNet in order to perturb it's probability distributions into credal sets according to another BayesNet containing the number of cases, for each node, of each parent instantiation met during learning, i.e. \( p(X = 0 \mid pa(X) = j) = N_{pa(X) = j} \).
src_min_num | The path to a BayesNet which contains lower probabilities. |
src_max_den | The ( optional ) path to a BayesNet which contains upper probabilities. |
Definition at line 402 of file credalNet_tpl.h.
References GUM_SHOWERROR.
gum::credal::CredalNet< GUM_SCALAR >::CredalNet | ( | const BayesNet< GUM_SCALAR > & | src_min_num, |
const BayesNet< GUM_SCALAR > & | src_max_den = BayesNet< GUM_SCALAR >() |
||
) |
Constructor for interval defined credal network which takes 2 BayesNet.
One can also provide a single BayesNet in order to perturb it's probability distributions into credal sets according to another BayesNet containing the number of cases, for each node, of each parent instantiation met during learning, i.e. \( p(X = 0 \mid pa(X) = j) = N_{pa(X) = j} \).
src_min_num | The BayesNet which contains lower probabilities. |
src_max_den | The ( optional ) BayesNet which contains upper probabilities. |
Definition at line 416 of file credalNet_tpl.h.
References GUM_SHOWERROR.
gum::credal::CredalNet< GUM_SCALAR >::~CredalNet | ( | ) |
Destructor.
Definition at line 430 of file credalNet_tpl.h.
|
private |
Copy the up-to-date BayesNet associated with this CredalNet. Since all we care about is the DAG, only arcs are copied. Because the order with which arcs are created is important, the function iterates over the CPTs variables to be sure parent order stays the same from a net to it's copy.
bn_dest | The reference to the new copy |
Definition at line 1512 of file credalNet_tpl.h.
References gum::BayesNet< GUM_SCALAR >::add(), gum::BayesNet< GUM_SCALAR >::addArc(), gum::BayesNet< GUM_SCALAR >::beginTopologyTransformation(), gum::BayesNet< GUM_SCALAR >::cpt(), gum::BayesNet< GUM_SCALAR >::endTopologyTransformation(), gum::BayesNet< GUM_SCALAR >::nodeId(), gum::DAGmodel::nodes(), and gum::BayesNet< GUM_SCALAR >::variable().
|
private |
var_cpt | The reference to a node CPT which may need a Decision Node. |
Definition at line 1498 of file credalNet_tpl.h.
|
private |
it's vertices, from it's H-representation, i.e. the hyper-plan inequalities. Uses lrs.
h_rep | A constant reference to the H-representation of a credal set. |
v_rep | A reference to the V-representation of the same credal set. |
Definition at line 1588 of file credalNet_tpl.h.
References gum::Rational< GUM_SCALAR >::farey(), gum::getNumberOfRunningThreads(), gum::getThreadNumber(), gum::getUniqueFileName(), and GUM_ERROR.
|
private |
Initialize private BayesNet variables after the Constructor has been called.
Definition at line 1449 of file credalNet_tpl.h.
References GUM_SHOWERROR, and gum::BIFReader< GUM_SCALAR >::proceed().
|
private |
Initialize private BayesNet variables after the Constructor has been called.
Definition at line 1485 of file credalNet_tpl.h.
References gum::DAGmodel::size().
|
private |
Initialize private constant variables after the Constructor has been called.
Definition at line 1422 of file credalNet_tpl.h.
|
private |
Computes the vertices of each credal set according to their interval definition (does not use lrs).
Only works with credal sets defined such that when one modality reach it's upper probability, all others are at their lowest.
Called by bnToCredal and idmLearning.
Definition at line 697 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::Instantiation::setFirst(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
|
private |
Set the NodeType of each node
Definition at line 1778 of file credalNet_tpl.h.
References gum::HashTable< Key, Val, Alloc >::exists(), gum::HashTable< Key, Val, Alloc >::insert(), gum::DAGmodel::nodes(), and gum::HashTable< Key, Val, Alloc >::size().
void gum::credal::CredalNet< GUM_SCALAR >::addArc | ( | const NodeId & | tail, |
const NodeId & | head | ||
) |
Adds an arc between two nodes.
tail | The NodeId of the tail node |
head | The NodeId of the head node |
Definition at line 59 of file credalNet_tpl.h.
NodeId gum::credal::CredalNet< GUM_SCALAR >::addVariable | ( | const std::string & | name, |
const Size & | card | ||
) |
Adds a discrete node into the network.
name | The name of the discrete variable to be added |
card | The cardinality of the variable |
NodeId
of the variable in the network Definition at line 42 of file credalNet_tpl.h.
References GUM_ERROR.
void gum::credal::CredalNet< GUM_SCALAR >::approximatedBinarization | ( | ) |
Approximate binarization.
Each bit has a lower and upper probability which is the lowest - resp. highest - over all vertices of the credal set. Enlarge the orignal credal sets and may induce huge imprecision.
Definition at line 979 of file credalNet_tpl.h.
References gum::BayesNet< GUM_SCALAR >::add(), gum::BayesNet< GUM_SCALAR >::addArc(), gum::BayesNet< GUM_SCALAR >::beginTopologyTransformation(), gum::HashTable< Key, Val, Alloc >::clear(), gum::BayesNet< GUM_SCALAR >::cpt(), gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), gum::Set< Key, Alloc >::empty(), gum::BayesNet< GUM_SCALAR >::endTopologyTransformation(), gum::int2Pow(), gum::MultiDimDecorator< GUM_SCALAR >::pos(), gum::HashTable< Key, Val, Alloc >::size(), gum::superiorPow(), and gum::BayesNet< GUM_SCALAR >::variable().
void gum::credal::CredalNet< GUM_SCALAR >::bnToCredal | ( | const GUM_SCALAR | beta, |
const bool | oneNet, | ||
const bool | keepZeroes = false |
||
) |
Perturbates the BayesNet provided as input for this CredalNet by generating intervals instead of point probabilities and then computes each vertex of each credal set.
The perturbations are done according to the number of cases met for each node and each of it's parent instantiation, i.e. \( \epsilon = *\beta^{ln(N_{pa(X) = j} + 1)} \) is the imprecision introduced which leads to \( \underline{p}(X = i \mid pa(X) = j) = (1 - \epsilon) p(X = i \mid *pa(X) = j) \) and \( \overline{p}(X = i \mid pa(X) = j) = *\underline{p}(X = *i \mid pa(X) = j) + \epsilon \). Use this method when using a single BayesNet storing counts of events with oneNet
set to TRUE
or when using two BayesNet, one with lower probabilities and one with upper probabilities, with oneNet
set to FALSE
.
beta | The beta used to perturbate the network. \( 0 \leq \beta *\leq 1 *\). |
oneNet | Boolean used as a flag. Set to TRUE if one BayesNet if provided with counts, to FALSE if two BayesNet are provided; one with probabilities (the lower net) and one with denominators over the first modalities (the upper net). |
keepZeroes | Boolean used as a flag as whether or not - respectively TRUE or FALSE - we keep zeroes as zeroes. Default is FALSE , i.e. zeroes are not kept. |
Definition at line 442 of file credalNet_tpl.h.
References gum::MultiDimDecorator< GUM_SCALAR >::get(), GUM_ERROR, gum::MultiDimDecorator< GUM_SCALAR >::set(), and gum::Instantiation::setFirst().
void gum::credal::CredalNet< GUM_SCALAR >::computeCPTMinMax | ( | ) |
Used with binary networks to speed-up L2U inference.
Store the lower and upper probabilities of each node X over the "true" modality, i.e. respectively \( \underline{p}(X = 1 \mid pa(X) = j) \) and \( \overline{p}(X = 1 \mid pa(X) = j) \).
Definition at line 1305 of file credalNet_tpl.h.
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & gum::credal::CredalNet< GUM_SCALAR >::credalNet_currentCpt | ( | ) | const |
Definition at line 1267 of file credalNet_tpl.h.
Referenced by gum::credal::VarMod2BNsMap< GUM_SCALAR >::setCNet().
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & gum::credal::CredalNet< GUM_SCALAR >::credalNet_srcCpt | ( | ) | const |
Definition at line 1275 of file credalNet_tpl.h.
const BayesNet< GUM_SCALAR > & gum::credal::CredalNet< GUM_SCALAR >::current_bn | ( | ) | const |
Definition at line 1406 of file credalNet_tpl.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::CNLoopyPropagation().
CredalNet< GUM_SCALAR >::NodeType gum::credal::CredalNet< GUM_SCALAR >::currentNodeType | ( | const NodeId & | id | ) | const |
id | The constant reference to the choosen NodeId |
Definition at line 1281 of file credalNet_tpl.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::_makeInferenceByOrderedArcs(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::_makeInferenceByRandomOrder().
INLINE Size gum::credal::CredalNet< GUM_SCALAR >::domainSize | ( | const NodeId & | id | ) |
Get the cardinality of a node
id | The NodeId of the node |
Definition at line 395 of file credalNet_tpl.h.
const GUM_SCALAR & gum::credal::CredalNet< GUM_SCALAR >::epsilonMax | ( | ) | const |
Definition at line 1353 of file credalNet_tpl.h.
const GUM_SCALAR & gum::credal::CredalNet< GUM_SCALAR >::epsilonMean | ( | ) | const |
Definition at line 1358 of file credalNet_tpl.h.
const GUM_SCALAR & gum::credal::CredalNet< GUM_SCALAR >::epsilonMin | ( | ) | const |
Definition at line 1348 of file credalNet_tpl.h.
void gum::credal::CredalNet< GUM_SCALAR >::fillConstraint | ( | const NodeId & | id, |
const Idx & | entry, | ||
const std::vector< GUM_SCALAR > & | lower, | ||
const std::vector< GUM_SCALAR > & | upper | ||
) |
Set the interval constraints of a credal set of a given node ( from an instantiation index )
id | The NodeId of the node |
entry | The index of the instantiation excluding the given node ( only the parents are used to compute the index of the credal set ) |
lower | The lower value for each probability in correct order |
upper | The upper value for each probability in correct order |
You need to call intervalToCredal when done filling all constraints.
BayesNet
(s) associated to this credal net ! ins
to check variable order in the instantiation ( to get index ), therefor we pass it by value Definition at line 273 of file credalNet_tpl.h.
References gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), GUM_ERROR, gum::MultiDimDecorator< GUM_SCALAR >::set(), and gum::Instantiation::setFirst().
void gum::credal::CredalNet< GUM_SCALAR >::fillConstraint | ( | const NodeId & | id, |
Instantiation | ins, | ||
const std::vector< GUM_SCALAR > & | lower, | ||
const std::vector< GUM_SCALAR > & | upper | ||
) |
Set the interval constraints of a credal sets of a given node ( from an instantiation )
id | The NodeId of the node |
ins | The Instantiation |
lower | The lower value for each probability in correct order |
upper | The upper value for each probability in correct order |
You need to call intervalToCredal when done filling all constraints.
BayesNet
(s) associated to this credal net ! ins
to check variable order in the instantiation ( to get index ), therefor we pass it by value Definition at line 322 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), gum::Instantiation::forgetMaster(), GUM_ERROR, gum::Instantiation::nbrDim(), gum::Instantiation::reorder(), gum::Instantiation::val(), gum::Instantiation::variable(), gum::MultiDimDecorator< GUM_SCALAR >::variablesSequence(), and gum::Instantiation::variablesSequence().
void gum::credal::CredalNet< GUM_SCALAR >::fillConstraints | ( | const NodeId & | id, |
const std::vector< GUM_SCALAR > & | lower, | ||
const std::vector< GUM_SCALAR > & | upper | ||
) |
Set the interval constraints of the credal sets of a given node ( all instantiations )
id | The NodeId of the node |
lower | The lower value for each probability in correct order |
upper | The upper value for each probability in correct order |
You need to call intervalToCredal when done filling all constraints.
BayesNet
(s) associated to this credal net ! ins
to check variable order in the instantiation ( to get index ), therefor we pass it by value Definition at line 257 of file credalNet_tpl.h.
References GUM_ERROR.
const std::vector< std::vector< GUM_SCALAR > > & gum::credal::CredalNet< GUM_SCALAR >::get_CPT_max | ( | ) | const |
Used with binary networks to speed-up L2U inference.
Definition at line 1343 of file credalNet_tpl.h.
const std::vector< std::vector< GUM_SCALAR > > & gum::credal::CredalNet< GUM_SCALAR >::get_CPT_min | ( | ) | const |
Used with binary networks to speed-up L2U inference.
Definition at line 1337 of file credalNet_tpl.h.
const bool gum::credal::CredalNet< GUM_SCALAR >::hasComputedCPTMinMax | ( | ) | const |
TRUE
if this CredalNet has called computeCPTMinMax() to speed-up inference with binary networks and L2U. This needs to be reworked as it is too easy to forget to call it and it can't be called within the inference engine (constness). Definition at line 1299 of file credalNet_tpl.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::CNLoopyPropagation().
void gum::credal::CredalNet< GUM_SCALAR >::idmLearning | ( | const Idx | s = 0 , |
const bool | keepZeroes = false |
||
) |
Learns parameters from a BayesNet storing counts of events.
Use this method when using a single BayesNet storing counts of events. IDM model if s
> 0, standard point probability if s
= 0 (default value if none precised).
s | The IDM parameter. |
keepZeroes | Boolean used as a flag as whether or not - respectively TRUE or FALSE - we keep zeroes as zeroes. Default is FALSE , i.e. zeroes are not kept. |
Definition at line 624 of file credalNet_tpl.h.
References GUM_ERROR, gum::MultiDimDecorator< GUM_SCALAR >::set(), and gum::Instantiation::setFirst().
INLINE Instantiation gum::credal::CredalNet< GUM_SCALAR >::instantiation | ( | const NodeId & | id | ) |
Get an Instantiation
from a node id, usefull to fill the constraints of the network
bnet accessors / shortcuts
id | The NodeId we want an instantiation from |
Definition at line 390 of file credalNet_tpl.h.
void gum::credal::CredalNet< GUM_SCALAR >::intervalToCredal | ( | ) |
Computes the vertices of each credal set according to their interval definition (uses lrs).
Use this method when using two BayesNet, one with lower probabilities and one with upper probabilities.
Definition at line 794 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), gum::credal::LRSWrapper< GUM_SCALAR >::fillH(), gum::credal::LRSWrapper< GUM_SCALAR >::getOutput(), gum::credal::LRSWrapper< GUM_SCALAR >::H2V(), gum::credal::LRSWrapper< GUM_SCALAR >::nextHInput(), gum::Instantiation::setFirst(), gum::credal::LRSWrapper< GUM_SCALAR >::setUpH(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
void gum::credal::CredalNet< GUM_SCALAR >::intervalToCredalWithFiles | ( | ) |
Computes the vertices of each credal set according to their interval definition (uses lrs).
Use this method when using a single BayesNet storing counts of events.
Definition at line 845 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), gum::Instantiation::setFirst(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
const bool gum::credal::CredalNet< GUM_SCALAR >::isSeparatelySpecified | ( | ) | const |
TRUE
if this CredalNet is separately and interval specified, FALSE
otherwise. Definition at line 1294 of file credalNet_tpl.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::CNLoopyPropagation().
void gum::credal::CredalNet< GUM_SCALAR >::lagrangeNormalization | ( | ) |
Normalize counts of a BayesNet storing counts of each events such that no probability is 0.
Use this method when using a single BayesNet storing counts of events. Lagrange normalization. This call is irreversible and modify counts stored by __src_bn
.
Doest not performs computations of the parameters but keeps normalized counts of events only. Call idmLearning
to compute the probabilities (with any parameter value).
Definition at line 575 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::Instantiation::setFirst(), and gum::MultiDimDecorator< GUM_SCALAR >::variable().
CredalNet< GUM_SCALAR >::NodeType gum::credal::CredalNet< GUM_SCALAR >::nodeType | ( | const NodeId & | id | ) | const |
id | The constant reference to the choosen NodeId |
Definition at line 1289 of file credalNet_tpl.h.
void gum::credal::CredalNet< GUM_SCALAR >::saveBNsMinMax | ( | const std::string & | min_path, |
const std::string & | max_path | ||
) | const |
If this CredalNet was built over a perturbed BayesNet, one can save the intervals as two BayesNet.
to call after bnToCredal( GUM_SCALAR beta ) save a BN with lower probabilities and a BN with upper ones
min_path | The path to save the BayesNet which contains the lower probabilities of each node X, i.e. \( \underline{p}(X = i \mid pa(X) = *j) *\). |
max_path | The path to save the BayesNet which contains the upper probabilities of each node X, i.e. \( \overline{p}(X = i \mid pa(X) = *j) *\). |
Definition at line 943 of file credalNet_tpl.h.
References GUM_ERROR, GUM_SHOWERROR, and gum::BIFWriter< GUM_SCALAR >::write().
void gum::credal::CredalNet< GUM_SCALAR >::setCPT | ( | const NodeId & | id, |
Size & | entry, | ||
const std::vector< std::vector< GUM_SCALAR > > & | cpt | ||
) |
Set the vertices of one credal set of a given node ( any instantiation index )
id | The NodeId of the node |
entry | The index of the instantiation ( from 0 to K - 1 ) excluding the given node ( only the parents are used to compute the index of the credal set ) |
cpt | The vertices of every credal set ( for each instantiation of the parents ) |
Use this with either LRSWrapper
or LpInterface
to get the vertices of a credal set represented by linear constraints.
BayesNet
(s) associated to this credal net ! Definition at line 112 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), GUM_ERROR, and gum::MultiDimDecorator< GUM_SCALAR >::variable().
void gum::credal::CredalNet< GUM_SCALAR >::setCPT | ( | const NodeId & | id, |
Instantiation | ins, | ||
const std::vector< std::vector< GUM_SCALAR > > & | cpt | ||
) |
Set the vertices of one credal set of a given node ( any instantiation )
id | The NodeId of the node |
ins | The Instantiation ( only the parents matter to find the credal set index ) |
cpt | The vertices of every credal set ( for each instantiation of the parents ) |
Use this with either LRSWrapper
or LpInterface
to get the vertices of a credal set represented by linear constraints.
BayesNet
(s) associated to this credal net !ins
to check variable order in the instantiation ( to get index ), therefor we pass it by value Definition at line 167 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), gum::Instantiation::forgetMaster(), GUM_ERROR, gum::Instantiation::nbrDim(), gum::Instantiation::reorder(), gum::Instantiation::val(), gum::MultiDimDecorator< GUM_SCALAR >::variable(), gum::Instantiation::variable(), and gum::Instantiation::variablesSequence().
void gum::credal::CredalNet< GUM_SCALAR >::setCPTs | ( | const NodeId & | id, |
const std::vector< std::vector< std::vector< GUM_SCALAR > > > & | cpt | ||
) |
Set the vertices of the credal sets ( all of the conditionals ) of a given node
id | The NodeId of the node |
cpt | The vertices of every credal set ( for each instantiation of the parents ) |
BayesNet
(s) associated to this credal net !First dimension is instantiation position ( from 0 to K - 1 ). Second is the credal set vertice index Third is the vertex
Definition at line 66 of file credalNet_tpl.h.
References gum::DiscreteVariable::domainSize(), GUM_ERROR, and gum::MultiDimDecorator< GUM_SCALAR >::variable().
const BayesNet< GUM_SCALAR > & gum::credal::CredalNet< GUM_SCALAR >::src_bn | ( | ) | const |
Definition at line 1413 of file credalNet_tpl.h.
std::string gum::credal::CredalNet< GUM_SCALAR >::toString | ( | ) | const |
Definition at line 1363 of file credalNet_tpl.h.
References gum::BayesNet< GUM_SCALAR >::cpt(), gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), gum::Instantiation::erase(), gum::Instantiation::forgetMaster(), gum::DAGmodel::nodes(), gum::Instantiation::setFirst(), and gum::BayesNet< GUM_SCALAR >::variable().
|
private |
Used with binary networks to speed-up L2U inference.
Store the upper probabilities of each node X over the "true" modality, i.e. \( \overline{p}(X = 1 \mid pa(X) = j) \).
Definition at line 664 of file credalNet.h.
|
private |
Used with binary networks to speed-up L2U inference.
Store the lower probabilities of each node X over the "true" modality, i.e. \( \underline{p}(X = 1 \mid pa(X) = j) \).
Definition at line 656 of file credalNet.h.
|
private |
This CredalNet up-to-date CPTs.
Definition at line 637 of file credalNet.h.
|
private |
This CredalNet original CPTs.
Definition at line 633 of file credalNet.h.
|
private |
Up-to-date BayesNet (used as a DAG).
Definition at line 629 of file credalNet.h.
|
private |
The NodeType of each node from the up-to-date network.
Definition at line 645 of file credalNet.h.
|
private |
5 by default, used by __fracC as number of decimals.
Definition at line 583 of file credalNet.h.
|
private |
Highest possible denominator allowed when using __farey.
A value too high may lead to lrs being unable to find vertices.
Definition at line 610 of file credalNet.h.
|
private |
Value under which a decimal number is considered to be zero when using __farey.
Definition at line 606 of file credalNet.h.
|
private |
The highest perturbation of the BayesNet provided as input for this CredalNet.
Definition at line 592 of file credalNet.h.
|
private |
The lowest perturbation of the BayesNet provided as input for this CredalNet.
Definition at line 588 of file credalNet.h.
|
private |
The average perturbation of the BayesNet provided as input for this CredalNet.
Definition at line 596 of file credalNet.h.
|
private |
Value under which a decimal number is considered to be zero when computing redundant vertices.
Definition at line 601 of file credalNet.h.
|
private |
Used by L2U, to know if lower and upper probabilities over the second modality has been stored in order to speed-up the algorithm.
Definition at line 649 of file credalNet.h.
|
private |
The NodeType of each node from the ORIGINAL network.
Definition at line 643 of file credalNet.h.
|
private |
Precision used by __frac.
Definition at line 613 of file credalNet.h.
|
private |
1e6 by default, used by __fracC as precision.
Definition at line 581 of file credalNet.h.
|
private |
TRUE
if this CredalNet is separately and interval specified, FALSE
otherwise.
Definition at line 618 of file credalNet.h.
|
private |
|
private |
BayesNet used to store upper probabilities.
Definition at line 626 of file credalNet.h.
|
private |
BayesNet used to store lower probabilities.
Definition at line 624 of file credalNet.h.
|
private |