21 #ifndef __CREDAL_NET__H__ 22 #define __CREDAL_NET__H__ 68 typedef __int64 int64_t;
69 typedef unsigned __int64 uint64_t;
86 template <
typename GUM_SCALAR >
119 CredalNet(
const std::string& src_min_num,
120 const std::string& src_max_den =
"");
183 const std::vector< std::vector< std::vector< GUM_SCALAR > > >& cpt);
207 const std::vector< std::vector< GUM_SCALAR > >& cpt);
232 const std::vector< std::vector< GUM_SCALAR > >& cpt);
250 const std::vector< GUM_SCALAR >& lower,
251 const std::vector< GUM_SCALAR >& upper);
273 const std::vector< GUM_SCALAR >& lower,
274 const std::vector< GUM_SCALAR >& upper);
294 const std::vector< GUM_SCALAR >& lower,
295 const std::vector< GUM_SCALAR >& upper);
355 const bool keepZeroes =
false);
445 const std::string& max_path)
const;
490 std::vector< std::vector< std::vector< GUM_SCALAR > > > >&
498 std::vector< std::vector< std::vector< GUM_SCALAR > > > >&
560 const std::vector< std::vector< GUM_SCALAR > >&
get_CPT_min()
const;
570 const std::vector< std::vector< GUM_SCALAR > >&
get_CPT_max()
const;
674 const std::vector< std::vector< std::vector< GUM_SCALAR > > >& var_cpt)
697 const std::string& src_max_den);
736 void __H2Vlrs(
const std::vector< std::vector< GUM_SCALAR > >& h_rep,
737 std::vector< std::vector< GUM_SCALAR > >& v_rep)
const;
742 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 751 #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 )
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
Implementation of pow functions with integers, faster than stl implementation.
Class representing Bayesian networks.
gum is the global namespace for all aGrUM entities
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.
Definition of templatized reader of BIF files for Bayesian Networks.
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
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
Definition of classe for BIF file output manipulation.
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.
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.
Class template used to approximate decimal numbers by rationals.
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...