23 #ifndef __CREDAL_NET__H__ 24 #define __CREDAL_NET__H__ 70 typedef __int64 int64_t;
71 typedef unsigned __int64 uint64_t;
88 template <
typename GUM_SCALAR >
121 CredalNet(
const std::string& src_min_num,
122 const std::string& src_max_den =
"");
185 const std::vector< std::vector< std::vector< GUM_SCALAR > > >& cpt);
209 const std::vector< std::vector< GUM_SCALAR > >& cpt);
234 const std::vector< std::vector< GUM_SCALAR > >& cpt);
252 const std::vector< GUM_SCALAR >& lower,
253 const std::vector< GUM_SCALAR >& upper);
275 const std::vector< GUM_SCALAR >& lower,
276 const std::vector< GUM_SCALAR >& upper);
296 const std::vector< GUM_SCALAR >& lower,
297 const std::vector< GUM_SCALAR >& upper);
357 const bool keepZeroes =
false);
447 const std::string& max_path)
const;
492 std::vector< std::vector< std::vector< GUM_SCALAR > > > >&
500 std::vector< std::vector< std::vector< GUM_SCALAR > > > >&
562 const std::vector< std::vector< GUM_SCALAR > >&
get_CPT_min()
const;
572 const std::vector< std::vector< GUM_SCALAR > >&
get_CPT_max()
const;
676 const std::vector< std::vector< std::vector< GUM_SCALAR > > >& var_cpt)
699 const std::string& src_max_den);
738 void __H2Vlrs(
const std::vector< std::vector< GUM_SCALAR > >& h_rep,
739 std::vector< std::vector< GUM_SCALAR > >& v_rep)
const;
744 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 753 #endif // __CREDAL_NET__H__ GUM_SCALAR __epsilonMoy
The average perturbation of the BayesNet provided as input for this CredalNet.
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 )
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< std::vector< GUM_SCALAR > > __binCptMax
Used with binary networks to speed-up L2U inference.
Class representing a Bayesian Network.
void __bnCopy(BayesNet< GUM_SCALAR > &bn_dest)
const bool isSeparatelySpecified() const
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...
std::string toString() const
NodeProperty< std::vector< NodeId > > __var_bits
Corresponding bits of each variable.
bool __separatelySpecified
TRUE if this CredalNet is separately and interval specified, FALSE otherwise.
GUM_SCALAR __epsF
Value under which a decimal number is considered to be zero when using __farey.
BayesNet< GUM_SCALAR > * __current_bn
Up-to-date BayesNet (used as a DAG).
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 ) ...
NodeProperty< NodeType > __original_nodeType
The NodeType of each node from the ORIGINAL network.
NodeProperty< NodeType > * __current_nodeType
The NodeType of each node from the up-to-date network.
void __initParams()
Initialize private constant variables after the Constructor has been called.
GUM_SCALAR __precision
Precision used by __frac.
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
NodeType currentNodeType(const NodeId &id) const
void __initCNNets(const std::string &src_min_num, const std::string &src_max_den)
Initialize private BayesNet variables after the Constructor has been called.
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 ) ...
void __sort_varType()
Set the NodeType of each node
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void computeCPTMinMax()
Used with binary networks to speed-up L2U inference.
The class for generic Hash Tables.
const std::vector< std::vector< GUM_SCALAR > > & get_CPT_max() const
Used with binary networks to speed-up L2U inference.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Instantiation instantiation(const NodeId &id)
Get an Instantiation from a node id, usefull to fill the constraints of the network ...
void approximatedBinarization()
Approximate binarization.
void lagrangeNormalization()
Normalize counts of a BayesNet storing counts of each events such that no probability is 0...
Class template representing a Credal Network.
NodeId addVariable(const std::string &name, const Size &card)
Adds a discrete node into the network.
void intervalToCredalWithFiles()
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & credalNet_srcCpt() const
const GUM_SCALAR & epsilonMean() const
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool __hasComputedCPTMinMax
Used by L2U, to know if lower and upper probabilities over the second modality has been stored in ord...
int __find_dNode_card(const std::vector< std::vector< std::vector< GUM_SCALAR > > > &var_cpt) const
void __H2Vlrs(const std::vector< std::vector< GUM_SCALAR > > &h_rep, std::vector< std::vector< GUM_SCALAR > > &v_rep) const
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeType
NodeType to speed-up computations in some algorithms.
BayesNet< GUM_SCALAR > __src_bn_min
BayesNet used to store lower probabilities.
const GUM_SCALAR & epsilonMin() const
NodeType nodeType(const NodeId &id) const
const std::vector< std::vector< GUM_SCALAR > > & get_CPT_min() const
Used with binary networks to speed-up L2U inference.
void __intervalToCredal()
Computes the vertices of each credal set according to their interval definition (does not use lrs)...
CredalNet()
Constructor used to create a CredalNet step by step, i.e.
GUM_SCALAR __precisionC
1e6 by default, used by __fracC as precision.
GUM_SCALAR __denMax
Highest possible denominator allowed when using __farey.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > * __credalNet_current_cpt
This CredalNet up-to-date CPTs.
const BayesNet< GUM_SCALAR > & current_bn() const
Size domainSize(const NodeId &id)
Get the cardinality of a node
Class for assigning/browsing values to tuples of discrete variables.
GUM_SCALAR __epsilonMax
The highest perturbation of the BayesNet provided as input for this CredalNet.
void intervalToCredal()
Computes the vertices of each credal set according to their interval definition (uses lrs)...
NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > __credalNet_src_cpt
This CredalNet original CPTs.
const bool hasComputedCPTMinMax() const
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 poin...
GUM_SCALAR __epsilonMin
The lowest perturbation of the BayesNet provided as input for this CredalNet.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Size Idx
Type for indexes.
GUM_SCALAR __deltaC
5 by default, used by __fracC as number of decimals.
const GUM_SCALAR & epsilonMax() const
std::size_t Size
In aGrUM, hashed values are unsigned long int.
void addArc(const NodeId &tail, const NodeId &head)
Adds an arc between two nodes.
BayesNet< GUM_SCALAR > __src_bn
Original BayesNet (used as a DAG).
const BayesNet< GUM_SCALAR > & src_bn() const
std::vector< std::vector< GUM_SCALAR > > __binCptMin
Used with binary networks to speed-up L2U inference.
const NodeProperty< std::vector< std::vector< std::vector< GUM_SCALAR > > > > & credalNet_currentCpt() const
void idmLearning(const Idx s=0, const bool keepZeroes=false)
Learns parameters from a BayesNet storing counts of events.
Size NodeId
Type for node ids.
BayesNet< GUM_SCALAR > __src_bn_max
BayesNet used to store upper probabilities.
GUM_SCALAR __epsRedund
Value under which a decimal number is considered to be zero when computing redundant vertices...