![]() |
aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
|
<agrum/CN/CNLoopyPropagation.h> More...
#include <CNLoopyPropagation.h>
Public Types | |
| enum class | InferenceType : char { nodeToNeighbours , ordered , randomOrder } |
| Inference type to be used by the algorithm. More... | |
| using | msg = std::vector< Tensor< GUM_SCALAR >* > |
| using | cArcP = const class gum::Arc* |
| enum class | ApproximationSchemeSTATE : char { Undefined , Continue , Epsilon , Rate , Limit , TimeLimit , Stopped } |
| The different state of an approximation scheme. More... | |
Public Member Functions | |
| virtual void | addEvidence (NodeId id, const Idx val) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (std::string_view nodeName, const Idx val) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, std::string_view label) final |
| adds a new hard evidence on node id | |
| virtual void | addEvidence (std::string_view nodeName, std::string_view label) final |
| adds a new hard evidence on node named nodeName | |
| virtual void | addEvidence (NodeId id, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node id (might be soft or hard) | |
| virtual void | addEvidence (std::string_view nodeName, const std::vector< GUM_SCALAR > &vals) final |
| adds a new evidence on node named nodeName (might be soft or hard) | |
| virtual void | addEvidence (const Tensor< GUM_SCALAR > &pot) final |
| adds a new evidence on node id (might be soft or hard) | |
Public algorithm methods | |
| void | makeInference () override |
| Starts the inference. | |
| void | insertEvidenceFile (std::string_view path) override |
| Starts the inference. | |
Getters and setters | |
| void | inferenceType (InferenceType inft) |
| Set the inference type. | |
| InferenceType | inferenceType () |
| Get the inference type. | |
Post-inference methods | |
| void | eraseAllEvidence () override |
| Erase all inference related data to perform another one. | |
| void | saveInference (std::string_view path) |
Constructors / Destructors | |
| CNLoopyPropagation (const CredalNet< GUM_SCALAR > &credalNet) | |
| Constructor. | |
| ~CNLoopyPropagation () override | |
| Destructor. | |
Getters and setters | |
| VarMod2BNsMap< GUM_SCALAR > * | getVarMod2BNsMap () |
| Get optimum IBayesNet. | |
| const CredalNet< GUM_SCALAR > & | credalNet () const |
| Get this credal network. | |
| const NodeProperty< std::vector< NodeId > > & | getT0Cluster () const |
| Get the t0_ cluster. | |
| const NodeProperty< std::vector< NodeId > > & | getT1Cluster () const |
| Get the t1_ cluster. | |
| void | setRepetitiveInd (const bool repetitive) |
| void | storeVertices (const bool value) |
| bool | storeVertices () const |
| Get the number of iterations without changes used to stop some algorithms. | |
| void | storeBNOpt (const bool value) |
| bool | storeBNOpt () const |
| bool | repetitiveInd () const |
| Get the current independence status. | |
Pre-inference initialization methods | |
| void | insertModalsFile (std::string_view path) |
| Insert variables modalities from file to compute expectations. | |
| void | insertModals (const std::map< std::string, std::vector< GUM_SCALAR > > &modals) |
| Insert variables modalities from map to compute expectations. | |
| void | insertEvidence (const std::map< std::string, std::vector< GUM_SCALAR > > &eviMap) |
| Insert evidence from map. | |
| void | insertEvidence (const NodeProperty< std::vector< GUM_SCALAR > > &evidence) |
| Insert evidence from Property. | |
| void | insertQueryFile (std::string_view path) |
| Insert query variables states from file. | |
| void | insertQuery (const NodeProperty< std::vector< bool > > &queryquery) |
| Insert query variables and states from Property. | |
Post-inference methods | |
| Tensor< GUM_SCALAR > | marginalMin (const NodeId id) const |
| Get the lower marginals of a given node id. | |
| Tensor< GUM_SCALAR > | marginalMin (std::string_view varName) const |
| Get the lower marginals of a given variable name. | |
| Tensor< GUM_SCALAR > | marginalMax (const NodeId id) const |
| Get the upper marginals of a given node id. | |
| Tensor< GUM_SCALAR > | marginalMax (std::string_view varName) const |
| Get the upper marginals of a given variable name. | |
| const GUM_SCALAR & | expectationMin (const NodeId id) const |
| Get the lower expectation of a given node id. | |
| const GUM_SCALAR & | expectationMin (std::string_view varName) const |
| Get the lower expectation of a given variable name. | |
| const GUM_SCALAR & | expectationMax (const NodeId id) const |
| Get the upper expectation of a given node id. | |
| const GUM_SCALAR & | expectationMax (std::string_view varName) const |
| Get the upper expectation of a given variable name. | |
| const std::vector< GUM_SCALAR > & | dynamicExpMin (std::string_view varName) const |
| Get the lower dynamic expectation of a given variable prefix (without the time step included, i.e. | |
| const std::vector< GUM_SCALAR > & | dynamicExpMax (std::string_view varName) const |
| Get the upper dynamic expectation of a given variable prefix (without the time step included, i.e. | |
| const std::vector< std::vector< GUM_SCALAR > > & | vertices (const NodeId id) const |
| Get the vertice of a given node id. | |
| void | saveMarginals (std::string_view path) const |
| Saves marginals to file. | |
| void | saveExpectations (std::string_view path) const |
| Saves expectations to file. | |
| void | saveVertices (std::string_view path) const |
| Saves vertices to file. | |
| void | dynamicExpectations () |
| Compute dynamic expectations. | |
| std::string | toString () const |
| Print all nodes marginals to standart output. | |
| const std::string | getApproximationSchemeMsg () |
| Get approximation scheme state. | |
Getters and setters | |
| void | setEpsilon (double eps) override |
| Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|. | |
| double | epsilon () const override |
| Returns the value of epsilon. | |
| void | disableEpsilon () override |
| Disable stopping criterion on epsilon. | |
| void | enableEpsilon () override |
| Enable stopping criterion on epsilon. | |
| bool | isEnabledEpsilon () const override |
| Returns true if stopping criterion on epsilon is enabled, false otherwise. | |
| void | setMinEpsilonRate (double rate) override |
| Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|). | |
| double | minEpsilonRate () const override |
| Returns the value of the minimal epsilon rate. | |
| void | disableMinEpsilonRate () override |
| Disable stopping criterion on epsilon rate. | |
| void | enableMinEpsilonRate () override |
| Enable stopping criterion on epsilon rate. | |
| bool | isEnabledMinEpsilonRate () const override |
| Returns true if stopping criterion on epsilon rate is enabled, false otherwise. | |
| void | setMaxIter (Size max) override |
| Stopping criterion on number of iterations. | |
| Size | maxIter () const override |
| Returns the criterion on number of iterations. | |
| void | disableMaxIter () override |
| Disable stopping criterion on max iterations. | |
| void | enableMaxIter () override |
| Enable stopping criterion on max iterations. | |
| bool | isEnabledMaxIter () const override |
| Returns true if stopping criterion on max iterations is enabled, false otherwise. | |
| void | setMaxTime (double timeout) override |
| Stopping criterion on timeout. | |
| double | maxTime () const override |
| Returns the timeout (in seconds). | |
| double | currentTime () const override |
| Returns the current running time in second. | |
| void | disableMaxTime () override |
| Disable stopping criterion on timeout. | |
| void | enableMaxTime () override |
| Enable stopping criterion on timeout. | |
| bool | isEnabledMaxTime () const override |
| Returns true if stopping criterion on timeout is enabled, false otherwise. | |
| void | setPeriodSize (Size p) override |
| How many samples between two stopping is enable. | |
| Size | periodSize () const override |
| Returns the period size. | |
| void | setVerbosity (bool v) override |
| Set the verbosity on (true) or off (false). | |
| bool | verbosity () const override |
| Returns true if verbosity is enabled. | |
| ApproximationSchemeSTATE | stateApproximationScheme () const override |
| Returns the approximation scheme state. | |
| Size | nbrIterations () const override |
| Returns the number of iterations. | |
| const std::vector< double > & | history () const override |
| Returns the scheme history. | |
| void | initApproximationScheme () |
| Initialise the scheme. | |
| bool | startOfPeriod () const |
| Returns true if we are at the beginning of a period (compute error is mandatory). | |
| void | updateApproximationScheme (unsigned int incr=1) |
| Update the scheme w.r.t the new error and increment steps. | |
| Size | remainingBurnIn () const |
| Returns the remaining burn in. | |
| void | stopApproximationScheme () |
| Stop the approximation scheme. | |
| bool | continueApproximationScheme (double error) |
| Update the scheme w.r.t the new error. | |
Getters and setters | |
| std::string | messageApproximationScheme () const |
| Returns the approximation scheme message. | |
Accessors/Modifiers | |
| void | setNumberOfThreads (Size nb) override |
| sets the number max of threads to be used by the class containing this ThreadNumberManager | |
| Size | getNumberOfThreads () const override |
| returns the current max number of threads used by the class containing this ThreadNumberManager | |
| bool | isGumNumberOfThreadsOverriden () const override |
| indicates whether the class containing this ThreadNumberManager set its own number of threads | |
Public Attributes | |
| Signaler< Size, double, double > | onProgress |
| Progression, error and time. | |
| Signaler< std::string_view > | onStop |
| Criteria messageApproximationScheme. | |
Protected Member Functions | |
Protected initialization methods | |
| void | initialize_ () |
| Topological forward propagation to initialize old marginals & messages. | |
Protected algorithm methods | |
| void | makeInferenceNodeToNeighbours_ () |
| Starts the inference with this inference type. | |
| void | makeInferenceByOrderedArcs_ () |
| Starts the inference with this inference type. | |
| void | makeInferenceByRandomOrder_ () |
| Starts the inference with this inference type. | |
| void | updateMarginals_ () |
| Compute marginals from up-to-date messages. | |
| void | msgL_ (const NodeId X, const NodeId demanding_parent) |
| Sends a message to one's parent, i.e. | |
| void | compute_ext_ (GUM_SCALAR &msg_l_min, GUM_SCALAR &msg_l_max, std::vector< GUM_SCALAR > &lx, GUM_SCALAR &num_min, GUM_SCALAR &num_max, GUM_SCALAR &den_min, GUM_SCALAR &den_max) |
| Used by msgL_. | |
| void | compute_ext_ (std::vector< std::vector< GUM_SCALAR > > &combi_msg_p, const NodeId &id, GUM_SCALAR &msg_l_min, GUM_SCALAR &msg_l_max, std::vector< GUM_SCALAR > &lx, const Idx &pos) |
| Used by msgL_. | |
| void | enum_combi_ (std::vector< std::vector< std::vector< GUM_SCALAR > > > &msgs_p, const NodeId &id, GUM_SCALAR &msg_l_min, GUM_SCALAR &msg_l_max, std::vector< GUM_SCALAR > &lx, const Idx &pos) |
| Used by msgL_. | |
| void | msgP_ (const NodeId X, const NodeId demanding_child) |
| Sends a message to one's child, i.e. | |
| void | enum_combi_ (std::vector< std::vector< std::vector< GUM_SCALAR > > > &msgs_p, const NodeId &id, GUM_SCALAR &msg_p_min, GUM_SCALAR &msg_p_max) |
| Used by msgP_. | |
| void | compute_ext_ (std::vector< std::vector< GUM_SCALAR > > &combi_msg_p, const NodeId &id, GUM_SCALAR &msg_p_min, GUM_SCALAR &msg_p_max) |
| Used by msgP_. | |
| void | refreshLMsPIs_ (bool refreshIndic=false) |
| Get the last messages from one's parents and children. | |
| GUM_SCALAR | calculateEpsilon_ () |
| Compute epsilon. | |
Post-inference protected methods | |
| void | computeExpectations_ () |
| Since the network is binary, expectations can be computed from the final marginals which give us the credal set vertices. | |
| void | updateIndicatrices_ () |
| Only update indicatrices variables at the end of computations ( calls msgP_ ). | |
Protected initialization methods | |
| void | repetitiveInit_ () |
| Initialize t0_ and t1_ clusters. | |
| void | initExpectations_ () |
| Initialize lower and upper expectations before inference, with the lower expectation being initialized on the highest modality and the upper expectation being initialized on the lowest modality. | |
| void | initMarginals_ () |
| Initialize lower and upper old marginals and marginals before inference, with the lower marginal being 1 and the upper 0. | |
| void | dispatchMarginalsToThreads_ () |
| computes Vector threadRanges_, that assigns some part of marginalMin_ and marginalMax_ to the threads | |
| void | initMarginalSets_ () |
| Initialize credal set vertices with empty sets. | |
Protected algorithms methods | |
| virtual const GUM_SCALAR | computeEpsilon_ () |
| Compute approximation scheme epsilon using the old marginals and the new ones. | |
| void | updateExpectations_ (const NodeId &id, const std::vector< GUM_SCALAR > &vertex) |
| Given a node id and one of it's possible vertex obtained during inference, update this node lower and upper expectations. | |
| void | updateCredalSets_ (const NodeId &id, const std::vector< GUM_SCALAR > &vertex, const bool &elimRedund=false) |
| Given a node id and one of it's possible vertex, update it's credal set. | |
Proptected post-inference methods | |
| void | dynamicExpectations_ () |
| Rearrange lower and upper expectations to suit dynamic networks. | |
Protected Attributes | |
| NodeProperty< bool > | update_p_ |
| Used to keep track of which node needs to update it's information coming from it's parents. | |
| NodeProperty< bool > | update_l_ |
| Used to keep track of which node needs to update it's information coming from it's children. | |
| NodeSet | active_nodes_set_ |
| The current node-set to iterate through at this current step. | |
| NodeSet | next_active_nodes_set_ |
| The next node-set, i.e. | |
| NodeProperty< NodeSet * > | msg_l_sent_ |
| Used to keep track of one's messages sent to it's parents. | |
| ArcProperty< GUM_SCALAR > | ArcsL_min_ |
| "Lower" information \( \Lambda \) coming from one's children. | |
| ArcProperty< GUM_SCALAR > | ArcsP_min_ |
| "Lower" information \( \pi \) coming from one's parent. | |
| NodeProperty< GUM_SCALAR > | NodesL_min_ |
| "Lower" node information \( \Lambda \) obtained by combinaison of children messages. | |
| NodeProperty< GUM_SCALAR > | NodesP_min_ |
| "Lower" node information \( \pi \) obtained by combinaison of parent's messages. | |
| ArcProperty< GUM_SCALAR > | ArcsL_max_ |
| "Upper" information \( \Lambda \) coming from one's children. | |
| ArcProperty< GUM_SCALAR > | ArcsP_max_ |
| "Upper" information \( \pi \) coming from one's parent. | |
| NodeProperty< GUM_SCALAR > | NodesL_max_ |
| "Upper" node information \( \Lambda \) obtained by combinaison of children messages. | |
| NodeProperty< GUM_SCALAR > | NodesP_max_ |
| "Upper" node information \( \pi \) obtained by combinaison of parent's messages. | |
| bool | inference_up_to_date_ |
TRUE if inference has already been performed, FALSE otherwise. | |
| const CredalNet< GUM_SCALAR > * | credalNet_ |
| A pointer to the Credal Net used. | |
| margi | oldMarginalMin_ |
| Old lower marginals used to compute epsilon. | |
| margi | oldMarginalMax_ |
| Old upper marginals used to compute epsilon. | |
| margi | marginalMin_ |
| Lower marginals. | |
| margi | marginalMax_ |
| Upper marginals. | |
| credalSet | marginalSets_ |
| Credal sets vertices, if enabled. | |
| expe | expectationMin_ |
| Lower expectations, if some variables modalities were inserted. | |
| expe | expectationMax_ |
| Upper expectations, if some variables modalities were inserted. | |
| dynExpe | dynamicExpMin_ |
| Lower dynamic expectations. | |
| dynExpe | dynamicExpMax_ |
| Upper dynamic expectations. | |
| dynExpe | modal_ |
| Variables modalities used to compute expectations. | |
| margi | evidence_ |
| Holds observed variables states. | |
| query | query_ |
| Holds the query nodes states. | |
| cluster | t0_ |
| Clusters of nodes used with dynamic networks. | |
| cluster | t1_ |
| Clusters of nodes used with dynamic networks. | |
| bool | storeVertices_ |
True if credal sets vertices are stored, False otherwise. | |
| bool | repetitiveInd_ |
True if using repetitive independence ( dynamic network only ), False otherwise. | |
| bool | storeBNOpt_ |
| Iterations limit stopping rule used by some algorithms such as CNMonteCarloSampling. | |
| VarMod2BNsMap< GUM_SCALAR > | dbnOpt_ |
| Object used to efficiently store optimal bayes net during inference, for some algorithms. | |
| std::vector< std::pair< NodeId, Idx > > | threadRanges_ |
| the ranges of elements of marginalMin_ and marginalMax_ processed by each thread | |
| int | timeSteps_ |
| The number of time steps of this network (only useful for dynamic networks). | |
| Size | threadMinimalNbOps_ {Size(20)} |
| double | current_epsilon_ |
| Current epsilon. | |
| double | last_epsilon_ |
| Last epsilon value. | |
| double | current_rate_ |
| Current rate. | |
| Size | current_step_ |
| The current step. | |
| Timer | timer_ |
| The timer. | |
| ApproximationSchemeSTATE | current_state_ |
| The current state. | |
| std::vector< double > | history_ |
| The scheme history, used only if verbosity == true. | |
| double | eps_ |
| Threshold for convergence. | |
| bool | enabled_eps_ |
| If true, the threshold convergence is enabled. | |
| double | min_rate_eps_ |
| Threshold for the epsilon rate. | |
| bool | enabled_min_rate_eps_ |
| If true, the minimal threshold for epsilon rate is enabled. | |
| double | max_time_ |
| The timeout. | |
| bool | enabled_max_time_ |
| If true, the timeout is enabled. | |
| Size | max_iter_ |
| The maximum iterations. | |
| bool | enabled_max_iter_ |
| If true, the maximum iterations stopping criterion is enabled. | |
| Size | burn_in_ |
| Number of iterations before checking stopping criteria. | |
| Size | period_size_ |
| Checking criteria frequency. | |
| bool | verbosity_ |
| If true, verbosity is enabled. | |
Private Types | |
| using | _infE_ = InferenceEngine< GUM_SCALAR > |
| To easily access InferenceEngine< GUM_SCALAR > methods. | |
| using | credalSet = NodeProperty< std::vector< std::vector< GUM_SCALAR > > > |
| using | margi = NodeProperty< std::vector< GUM_SCALAR > > |
| using | expe = NodeProperty< GUM_SCALAR > |
| using | dynExpe = typename gum::HashTable< std::string, std::vector< GUM_SCALAR > > |
| using | query = NodeProperty< std::vector< bool > > |
| using | cluster = NodeProperty< std::vector< NodeId > > |
Private Member Functions | |
| void | stopScheme_ (ApproximationSchemeSTATE new_state) |
| Stop the scheme given a new state. | |
Private Attributes | |
| InferenceType | _inferenceType_ |
| The chosen inference type. | |
| const CredalNet< GUM_SCALAR > * | _cn_ |
| A pointer to the CredalNet to be used. | |
| const IBayesNet< GUM_SCALAR > * | _bnet_ |
| A pointer to it's IBayesNet used as a DAG. | |
| Size | _nb_threads_ {0} |
| the max number of threads used by the class | |
<agrum/CN/CNLoopyPropagation.h>
Class implementing loopy-propagation with binary networks - L2U algorithm.
| GUM_SCALAR | A floating type ( float, double, long double ... ). |
Definition at line 75 of file CNLoopyPropagation.h.
|
private |
To easily access InferenceEngine< GUM_SCALAR > methods.
Definition at line 384 of file CNLoopyPropagation.h.
| using gum::credal::CNLoopyPropagation< GUM_SCALAR >::cArcP = const class gum::Arc* |
Definition at line 78 of file CNLoopyPropagation.h.
|
privateinherited |
Definition at line 82 of file inferenceEngine.h.
|
privateinherited |
Definition at line 75 of file inferenceEngine.h.
|
privateinherited |
Definition at line 79 of file inferenceEngine.h.
|
privateinherited |
Definition at line 77 of file inferenceEngine.h.
|
privateinherited |
Definition at line 76 of file inferenceEngine.h.
| using gum::credal::CNLoopyPropagation< GUM_SCALAR >::msg = std::vector< Tensor< GUM_SCALAR >* > |
Definition at line 77 of file CNLoopyPropagation.h.
|
privateinherited |
Definition at line 81 of file inferenceEngine.h.
|
stronginherited |
The different state of an approximation scheme.
| Enumerator | |
|---|---|
| Undefined | |
| Continue | |
| Epsilon | |
| Rate | |
| Limit | |
| TimeLimit | |
| Stopped | |
Definition at line 87 of file IApproximationSchemeConfiguration.h.
|
strong |
Inference type to be used by the algorithm.
Definition at line 83 of file CNLoopyPropagation.h.
|
explicit |
Constructor.
| cnet | The CredalNet to be used with this algorithm. |
Definition at line 1480 of file CNLoopyPropagation_tpl.h.
References CNLoopyPropagation(), gum::credal::InferenceEngine< GUM_SCALAR >::InferenceEngine(), _bnet_, _cn_, _inferenceType_, gum::credal::InferenceEngine< GUM_SCALAR >::credalNet(), gum::credal::CredalNet< GUM_SCALAR >::current_bn(), gum::credal::CredalNet< GUM_SCALAR >::hasComputedBinaryCPTMinMax(), inference_up_to_date_, gum::credal::CredalNet< GUM_SCALAR >::isSeparatelySpecified(), and nodeToNeighbours.
Referenced by CNLoopyPropagation(), and ~CNLoopyPropagation().
|
override |
Destructor.
Definition at line 1514 of file CNLoopyPropagation_tpl.h.
References CNLoopyPropagation(), inference_up_to_date_, and msg_l_sent_.
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if the tensor is defined over several nodes |
| UndefinedElement | if the node on which the tensor is defined does not belong to the Bayesian network |
| InvalidArgument | if the node of the tensor already has an evidence |
| FatalError | if pot=[0,0,...,0] |
Definition at line 1197 of file inferenceEngine_tpl.h.
References addEvidence(), credalNet_, gum::Instantiation::end(), gum::Instantiation::inc(), gum::Instantiation::setFirst(), and gum::Instantiation::val().
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 1164 of file inferenceEngine_tpl.h.
References addEvidence(), and credalNet_.
Referenced by addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), and makeInference().
|
finalvirtualinherited |
adds a new evidence on node id (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if id already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node id |
Definition at line 1154 of file inferenceEngine_tpl.h.
References evidence_.
|
finalvirtualinherited |
adds a new hard evidence on node id
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if id already has an evidence |
Definition at line 1178 of file inferenceEngine_tpl.h.
References addEvidence(), and credalNet_.
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 1172 of file inferenceEngine_tpl.h.
References addEvidence(), and credalNet_.
|
finalvirtualinherited |
adds a new evidence on node named nodeName (might be soft or hard)
| UndefinedElement | if id does not belong to the Bayesian network |
| InvalidArgument | if nodeName already has an evidence |
| FatalError | if vals=[0,0,...,0] |
| InvalidArgument | if the size of vals is different from the domain size of node nodeName |
Definition at line 1191 of file inferenceEngine_tpl.h.
References addEvidence(), and credalNet_.
|
finalvirtualinherited |
adds a new hard evidence on node named nodeName
| UndefinedElement | if nodeName does not belong to the Bayesian network |
| InvalidArgument | if val is not a value for id |
| InvalidArgument | if nodeName already has an evidence |
Definition at line 1184 of file inferenceEngine_tpl.h.
References addEvidence(), and credalNet_.
|
protected |
Compute epsilon.
Definition at line 1434 of file CNLoopyPropagation_tpl.h.
References gum::credal::InferenceEngine< GUM_SCALAR >::computeEpsilon_(), refreshLMsPIs_(), and updateMarginals_().
Referenced by makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), and makeInferenceNodeToNeighbours_().
|
protected |
Used by msgL_.
pour les fonctions suivantes, les GUM_SCALAR min/max doivent etre initialises (min a 1 et max a 0) pour comparer avec les resultats intermediaires
Compute the final message for the given parent's message and likelihood (children's messages), numerators & denominators.
| msg_l_min | The reference to the current lower value of the message to be sent. |
| msg_l_max | The reference to the current upper value of the message to be sent. |
| lx | The lower and upper likelihood. |
| num_min | The reference to the previously computed lower numerator. |
| num_max | The reference to the previously computed upper numerator. |
| den_min | The reference to the previously computed lower denominator. |
| den_max | The reference to the previously computed upper denominator. |
une fois les cpts marginalises sur X et Ui, on calcul le min/max,
Definition at line 196 of file CNLoopyPropagation_tpl.h.
References INF_.
Referenced by compute_ext_(), enum_combi_(), and enum_combi_().
|
protected |
Used by msgL_.
extremes pour une combinaison des parents, message vers parent
Compute the numerators & denominators for the given parent's message and likelihood (children's messages). Marginalisation.
| combi_msg_p | The parent's chosen message. |
| id | The constant id of the node sending the message. |
| msg_l_min | The reference to the current lower value of the message to be sent. |
| msg_l_max | The reference to the current upper value of the message to be sent. |
| lx | The lower and upper likelihood. |
| pos | The position of the parent node to receive the message in the CPT of the one sending the message ( first parent, second ... ). |
Definition at line 286 of file CNLoopyPropagation_tpl.h.
References _cn_, and compute_ext_().
|
protected |
Used by msgP_.
extremes pour une combinaison des parents, message vers enfant marginalisation cpts
Marginalisation.
| combi_msg_p | The parent's chosen message. |
| id | The constant id of the node sending the message. |
| msg_p_min | The reference to the current lower value of the message to be sent. |
| msg_p_max | The reference to the current upper value of the message to be sent. |
Definition at line 352 of file CNLoopyPropagation_tpl.h.
References _cn_.
|
protectedvirtualinherited |
Compute approximation scheme epsilon using the old marginals and the new ones.
Highest delta on either lower or upper marginal is epsilon.
Also updates oldMarginals to current marginals.
Reimplemented in gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >, and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >.
Definition at line 979 of file inferenceEngine_tpl.h.
References gum::threadsSTL::ThreadExecutor::execute(), marginalMax_, marginalMin_, gum::threadsSTL::ThreadExecutor::nbRunningThreadsExecutors(), oldMarginalMax_, oldMarginalMin_, and threadRanges_.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::calculateEpsilon_().
|
protected |
Since the network is binary, expectations can be computed from the final marginals which give us the credal set vertices.
Definition at line 1456 of file CNLoopyPropagation_tpl.h.
References _bnet_, gum::credal::InferenceEngine< GUM_SCALAR >::marginalMax_, gum::credal::InferenceEngine< GUM_SCALAR >::marginalMin_, gum::credal::InferenceEngine< GUM_SCALAR >::modal_, gum::credal::InferenceEngine< GUM_SCALAR >::updateCredalSets_(), gum::credal::InferenceEngine< GUM_SCALAR >::updateExpectations_(), and gum::credal::InferenceEngine< GUM_SCALAR >::vertices().
Referenced by makeInference().
Update the scheme w.r.t the new error.
Test the stopping criterion that are enabled.
| error | The new error value. |
| OperationNotAllowed | Raised if state != ApproximationSchemeSTATE::Continue. |
Definition at line 69 of file approximationScheme.cpp.
References gum::IApproximationSchemeConfiguration::Continue, current_epsilon_, current_rate_, current_state_, current_step_, enabled_eps_, enabled_max_iter_, enabled_max_time_, enabled_min_rate_eps_, eps_, gum::IApproximationSchemeConfiguration::Epsilon, GUM_EMIT3, GUM_ERROR, gum::__sig__::BasicSignaler< Args... >::hasListener(), history_, last_epsilon_, gum::IApproximationSchemeConfiguration::Limit, max_iter_, max_time_, gum::IApproximationSchemeConfiguration::messageApproximationScheme(), min_rate_eps_, gum::IApproximationSchemeConfiguration::onProgress, gum::IApproximationSchemeConfiguration::Rate, startOfPeriod(), stateApproximationScheme(), gum::Timer::step(), stopScheme_(), gum::IApproximationSchemeConfiguration::TimeLimit, timer_, and verbosity().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByOrderedArcs_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByRandomOrder_(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
|
inherited |
Get this credal network.
Definition at line 82 of file inferenceEngine_tpl.h.
References credalNet_.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::CNLoopyPropagation(), InferenceEngine(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::MultipleInferenceEngine(), and makeInference().
|
overridevirtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 137 of file approximationScheme_inl.h.
References gum::Timer::step(), and timer_.
Referenced by gum::learning::IBNLearner::currentTime(), and gum::learning::IBNLearner::EMCurrentTime().
|
overridevirtualinherited |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 75 of file approximationScheme_inl.h.
References enabled_eps_.
Referenced by gum::learning::EMApproximationScheme::EMApproximationScheme(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::learning::IBNLearner::disableEpsilon(), gum::learning::IBNLearner::EMdisableEpsilon(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().
|
overridevirtualinherited |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 116 of file approximationScheme_inl.h.
References enabled_max_iter_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::learning::IBNLearner::disableMaxIter(), and gum::learning::IBNLearner::EMdisableMaxIter().
|
overridevirtualinherited |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 140 of file approximationScheme_inl.h.
References enabled_max_time_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::learning::IBNLearner::disableMaxTime(), and gum::learning::IBNLearner::EMdisableMaxTime().
|
overridevirtualinherited |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 96 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::disableMinEpsilonRate(), gum::learning::IBNLearner::EMdisableMinEpsilonRate(), and gum::learning::EMApproximationScheme::setEpsilon().
|
protectedinherited |
computes Vector threadRanges_, that assigns some part of marginalMin_ and marginalMax_ to the threads
Definition at line 1094 of file inferenceEngine_tpl.h.
References gum::ThreadNumberManager::getNumberOfThreads(), and threadRanges_.
Referenced by initMarginals_().
|
inherited |
Compute dynamic expectations.
Definition at line 702 of file inferenceEngine_tpl.h.
References dynamicExpectations_().
Referenced by makeInference().
|
protectedinherited |
Rearrange lower and upper expectations to suit dynamic networks.
Definition at line 707 of file inferenceEngine_tpl.h.
References credalNet_, dynamicExpMax_, dynamicExpMin_, expectationMax_, expectationMin_, and modal_.
Referenced by dynamicExpectations().
|
inherited |
Get the upper dynamic expectation of a given variable prefix (without the time step included, i.e.
call with "temp" to get "temp_0", ..., "temp_T").
| varName | The variable name prefix which upper expectation we want. |
Definition at line 496 of file inferenceEngine_tpl.h.
References InferenceEngine(), and dynamicExpMax().
Referenced by dynamicExpMax(), and makeInference().
|
inherited |
Get the lower dynamic expectation of a given variable prefix (without the time step included, i.e.
call with "temp" to get "temp_0", ..., "temp_T").
| varName | The variable name prefix which lower expectation we want. |
Definition at line 479 of file inferenceEngine_tpl.h.
Referenced by makeInference().
|
overridevirtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 78 of file approximationScheme_inl.h.
References enabled_eps_.
Referenced by gum::learning::IBNLearner::EMenableEpsilon(), and gum::learning::IBNLearner::enableEpsilon().
|
overridevirtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 119 of file approximationScheme_inl.h.
References enabled_max_iter_.
Referenced by gum::learning::IBNLearner::EMenableMaxIter(), and gum::learning::IBNLearner::enableMaxIter().
|
overridevirtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 143 of file approximationScheme_inl.h.
References enabled_max_time_.
Referenced by gum::learning::IBNLearner::EMenableMaxTime(), and gum::learning::IBNLearner::enableMaxTime().
|
overridevirtualinherited |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 99 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::learning::EMApproximationScheme::EMApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::EMenableMinEpsilonRate(), and gum::learning::IBNLearner::enableMinEpsilonRate().
|
protected |
Used by msgL_.
comme precedemment mais pour message parent, vraisemblance prise en compte
Enumerate parent's messages.
| msgs_p | All the messages from the parents which will be enumerated. |
| id | The constant id of the node sending the message. |
| msg_l_min | The reference to the current lower value of the message to be sent. |
| msg_l_max | The reference to the current upper value of the message to be sent. |
| lx | The lower and upper likelihood. |
| pos | The position of the parent node to receive the message in the CPT of the one sending the message ( first parent, second ... ). |
Definition at line 471 of file CNLoopyPropagation_tpl.h.
References _cn_, compute_ext_(), gum::dispatchRangeToThreads(), gum::threadsSTL::ThreadExecutor::execute(), gum::ThreadNumberManager::getNumberOfThreads(), gum::threadsSTL::ThreadExecutor::nbRunningThreadsExecutors(), and gum::credal::InferenceEngine< GUM_SCALAR >::threadMinimalNbOps_.
Referenced by initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protected |
Used by msgP_.
enumerate combinations messages parents, pour message vers enfant
Enumerate parent's messages.
| msgs_p | All the messages from the parents which will be enumerated. |
| id | The constant id of the node sending the message. |
| msg_p_min | The reference to the current lower value of the message to be sent. |
| msg_p_max | The reference to the current upper value of the message to be sent. |
Definition at line 401 of file CNLoopyPropagation_tpl.h.
References _cn_, compute_ext_(), gum::dispatchRangeToThreads(), gum::threadsSTL::ThreadExecutor::execute(), gum::ThreadNumberManager::getNumberOfThreads(), gum::threadsSTL::ThreadExecutor::nbRunningThreadsExecutors(), and gum::credal::InferenceEngine< GUM_SCALAR >::threadMinimalNbOps_.
|
overridevirtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 72 of file approximationScheme_inl.h.
References eps_.
Referenced by gum::learning::IBNLearner::EMEpsilon(), gum::learning::IBNLearner::epsilon(), gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), and gum::ImportanceSampling< GUM_SCALAR >::unsharpenBN_().
|
overridevirtual |
Erase all inference related data to perform another one.
You need to insert evidence again if needed but modalities are kept. You can insert new ones by using the appropriate method which will delete the old ones.
Reimplemented from gum::credal::InferenceEngine< GUM_SCALAR >.
Definition at line 579 of file CNLoopyPropagation_tpl.h.
References _bnet_, active_nodes_set_, ArcsL_max_, ArcsL_min_, ArcsP_max_, ArcsP_min_, gum::credal::InferenceEngine< GUM_SCALAR >::eraseAllEvidence(), inference_up_to_date_, msg_l_sent_, next_active_nodes_set_, NodesL_max_, NodesL_min_, NodesP_max_, NodesP_min_, update_l_, and update_p_.
|
inherited |
Get the upper expectation of a given node id.
| id | The node id which upper expectation we want. |
Definition at line 473 of file inferenceEngine_tpl.h.
References expectationMax_.
Referenced by makeInference().
|
inherited |
Get the upper expectation of a given variable name.
| varName | The variable name which upper expectation we want. |
Definition at line 463 of file inferenceEngine_tpl.h.
References credalNet_, and expectationMax_.
|
inherited |
Get the lower expectation of a given node id.
| id | The node id which lower expectation we want. |
Definition at line 468 of file inferenceEngine_tpl.h.
References expectationMin_.
Referenced by makeInference().
|
inherited |
Get the lower expectation of a given variable name.
| varName | The variable name which lower expectation we want. |
Definition at line 457 of file inferenceEngine_tpl.h.
References credalNet_, and expectationMin_.
|
inherited |
Get approximation scheme state.
Definition at line 1208 of file inferenceEngine_tpl.h.
References gum::IApproximationSchemeConfiguration::messageApproximationScheme().
Referenced by makeInference().
|
nodiscardoverridevirtualinherited |
returns the current max number of threads used by the class containing this ThreadNumberManager
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), gum::learning::IBNLearner::createScore_(), gum::credal::InferenceEngine< GUM_SCALAR >::dispatchMarginalsToThreads_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), gum::ScheduledInference::operator=(), gum::ScheduledInference::operator=(), gum::ScheduledInference::scheduler(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::verticesFusion_().
|
inherited |
Get the t0_ cluster.
Definition at line 968 of file inferenceEngine_tpl.h.
References t0_.
Referenced by makeInference().
|
inherited |
Get the t1_ cluster.
Definition at line 974 of file inferenceEngine_tpl.h.
References t1_.
Referenced by makeInference().
|
inherited |
Get optimum IBayesNet.
Definition at line 164 of file inferenceEngine_tpl.h.
References dbnOpt_.
Referenced by makeInference().
|
overridevirtualinherited |
Returns the scheme history.
| OperationNotAllowed | Raised if the scheme did not performed or if verbosity is set to false. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 179 of file approximationScheme_inl.h.
References GUM_ERROR, stateApproximationScheme(), and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::learning::IBNLearner::EMHistory(), and gum::learning::IBNLearner::history().
| CNLoopyPropagation< GUM_SCALAR >::InferenceType gum::credal::CNLoopyPropagation< GUM_SCALAR >::inferenceType | ( | ) |
Get the inference type.
Definition at line 1531 of file CNLoopyPropagation_tpl.h.
References _inferenceType_.
| void gum::credal::CNLoopyPropagation< GUM_SCALAR >::inferenceType | ( | InferenceType | inft | ) |
Set the inference type.
| inft | The chosen InferenceType. |
Definition at line 1525 of file CNLoopyPropagation_tpl.h.
References _inferenceType_.
|
inherited |
Initialise the scheme.
Definition at line 190 of file approximationScheme_inl.h.
References ApproximationScheme(), gum::IApproximationSchemeConfiguration::Continue, current_state_, current_step_, and initApproximationScheme().
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), initApproximationScheme(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInference(), and gum::SamplingInference< GUM_SCALAR >::onStateChanged_().
|
protectedinherited |
Initialize lower and upper expectations before inference, with the lower expectation being initialized on the highest modality and the upper expectation being initialized on the lowest modality.
Definition at line 680 of file inferenceEngine_tpl.h.
References credalNet_, expectationMax_, expectationMin_, and modal_.
Referenced by eraseAllEvidence().
|
protected |
Topological forward propagation to initialize old marginals & messages.
Definition at line 608 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, active_nodes_set_, ArcsL_min_, ArcsP_max_, ArcsP_min_, gum::ArcGraphPart::children(), gum::Set< Key >::empty(), enum_combi_(), gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, GUM_ERROR, gum::credal::CredalNet< GUM_SCALAR >::Indic, INF_, msg_l_sent_, NodesL_min_, NodesP_max_, NodesP_min_, gum::credal::InferenceEngine< GUM_SCALAR >::oldMarginalMax_, gum::credal::InferenceEngine< GUM_SCALAR >::oldMarginalMin_, gum::ArcGraphPart::parents(), update_l_, and update_p_.
Referenced by makeInference().
|
protectedinherited |
Initialize lower and upper old marginals and marginals before inference, with the lower marginal being 1 and the upper 0.
Definition at line 644 of file inferenceEngine_tpl.h.
References credalNet_, dispatchMarginalsToThreads_(), marginalMax_, marginalMin_, oldMarginalMax_, and oldMarginalMin_.
Referenced by InferenceEngine(), and eraseAllEvidence().
|
protectedinherited |
Initialize credal set vertices with empty sets.
Definition at line 665 of file inferenceEngine_tpl.h.
References credalNet_, marginalSets_, and storeVertices_.
Referenced by eraseAllEvidence(), and storeVertices().
|
inherited |
Insert evidence from Property.
| evidence | The on nodes Property containing likelihoods. |
Definition at line 268 of file inferenceEngine_tpl.h.
References credalNet_, and evidence_.
|
inherited |
Insert evidence from map.
| eviMap | The map variable name - likelihood. |
Definition at line 247 of file inferenceEngine_tpl.h.
References credalNet_, and evidence_.
Referenced by makeInference().
|
overridevirtual |
Starts the inference.
Reimplemented from gum::credal::InferenceEngine< GUM_SCALAR >.
Definition at line 1536 of file CNLoopyPropagation_tpl.h.
References gum::credal::InferenceEngine< GUM_SCALAR >::insertEvidenceFile().
|
inherited |
Insert variables modalities from map to compute expectations.
| modals | The map variable name - modalities. |
Definition at line 216 of file inferenceEngine_tpl.h.
References credalNet_, and modal_.
Referenced by makeInference().
|
inherited |
Insert variables modalities from file to compute expectations.
| path | The path to the modalities file. |
Definition at line 169 of file inferenceEngine_tpl.h.
References GUM_ERROR, and modal_.
Referenced by makeInference().
|
inherited |
Insert query variables and states from Property.
| query | The on nodes Property containing queried variables states. |
Definition at line 346 of file inferenceEngine_tpl.h.
References query_.
Referenced by makeInference().
|
inherited |
Insert query variables states from file.
| path | The path to the query file. |
Definition at line 358 of file inferenceEngine_tpl.h.
References GUM_ERROR.
Referenced by makeInference().
|
overridevirtualinherited |
Returns true if stopping criterion on epsilon is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 82 of file approximationScheme_inl.h.
References enabled_eps_.
Referenced by gum::learning::IBNLearner::EMisEnabledEpsilon(), and gum::learning::IBNLearner::isEnabledEpsilon().
|
overridevirtualinherited |
Returns true if stopping criterion on max iterations is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 123 of file approximationScheme_inl.h.
References enabled_max_iter_.
Referenced by gum::learning::IBNLearner::EMisEnabledMaxIter(), and gum::learning::IBNLearner::isEnabledMaxIter().
|
overridevirtualinherited |
Returns true if stopping criterion on timeout is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 147 of file approximationScheme_inl.h.
References enabled_max_time_.
Referenced by gum::learning::IBNLearner::EMisEnabledMaxTime(), and gum::learning::IBNLearner::isEnabledMaxTime().
|
overridevirtualinherited |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 103 of file approximationScheme_inl.h.
References enabled_min_rate_eps_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::EMisEnabledMinEpsilonRate(), and gum::learning::IBNLearner::isEnabledMinEpsilonRate().
|
nodiscardoverridevirtualinherited |
indicates whether the class containing this ThreadNumberManager set its own number of threads
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), gum::learning::IBNLearner::createScore_(), gum::ScheduledInference::operator=(), and gum::ScheduledInference::operator=().
|
overridevirtual |
Starts the inference.
Implements gum::credal::InferenceEngine< GUM_SCALAR >.
Definition at line 555 of file CNLoopyPropagation_tpl.h.
References _inferenceType_, computeExpectations_(), inference_up_to_date_, gum::ApproximationScheme::initApproximationScheme(), initialize_(), makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), makeInferenceNodeToNeighbours_(), nodeToNeighbours, ordered, randomOrder, and updateIndicatrices_().
|
protected |
Starts the inference with this inference type.
Definition at line 813 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, calculateEpsilon_(), gum::ApproximationScheme::continueApproximationScheme(), gum::credal::CredalNet< GUM_SCALAR >::Indic, msgL_(), msgP_(), and gum::ApproximationScheme::updateApproximationScheme().
Referenced by makeInference().
|
protected |
Starts the inference with this inference type.
Definition at line 768 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, calculateEpsilon_(), gum::ApproximationScheme::continueApproximationScheme(), gum::credal::CredalNet< GUM_SCALAR >::Indic, msgL_(), msgP_(), gum::randomValue(), and gum::ApproximationScheme::updateApproximationScheme().
Referenced by makeInference().
|
protected |
Starts the inference with this inference type.
Definition at line 730 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, active_nodes_set_, calculateEpsilon_(), gum::ArcGraphPart::children(), gum::ApproximationScheme::continueApproximationScheme(), gum::credal::CredalNet< GUM_SCALAR >::Indic, msgL_(), msgP_(), next_active_nodes_set_, gum::ArcGraphPart::parents(), gum::ApproximationScheme::stopApproximationScheme(), and gum::ApproximationScheme::updateApproximationScheme().
Referenced by makeInference().
|
inherited |
Get the upper marginals of a given node id.
| id | The node id which upper marginals we want. |
Definition at line 448 of file inferenceEngine_tpl.h.
Referenced by makeInference(), and marginalMax().
|
inherited |
Get the upper marginals of a given variable name.
| varName | The variable name which upper marginals we want. |
Definition at line 435 of file inferenceEngine_tpl.h.
References credalNet_, and marginalMax().
|
inherited |
Get the lower marginals of a given node id.
| id | The node id which lower marginals we want. |
Definition at line 440 of file inferenceEngine_tpl.h.
References credalNet_, and marginalMin_.
Referenced by makeInference(), and marginalMin().
|
inherited |
Get the lower marginals of a given variable name.
| varName | The variable name which lower marginals we want. |
Definition at line 429 of file inferenceEngine_tpl.h.
References credalNet_, and marginalMin().
|
overridevirtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 113 of file approximationScheme_inl.h.
References max_iter_.
Referenced by gum::learning::IBNLearner::EMMaxIter(), and gum::learning::IBNLearner::maxIter().
|
overridevirtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 134 of file approximationScheme_inl.h.
References max_time_.
Referenced by gum::learning::IBNLearner::EMMaxTime(), and gum::learning::IBNLearner::maxTime().
|
inherited |
Returns the approximation scheme message.
Definition at line 64 of file IApproximationSchemeConfiguration.cpp.
References Continue, Epsilon, epsilon(), Limit, maxIter(), maxTime(), minEpsilonRate(), Rate, stateApproximationScheme(), Stopped, TimeLimit, and Undefined.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::learning::IBNLearner::EMStateMessage(), and gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg().
|
overridevirtualinherited |
Returns the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 93 of file approximationScheme_inl.h.
References min_rate_eps_.
Referenced by gum::learning::IBNLearner::EMMinEpsilonRate(), and gum::learning::IBNLearner::minEpsilonRate().
|
protected |
Sends a message to one's parent, i.e.
X is sending a message to a demanding_parent.
| X | The constant node id of the node sending the message. |
| demanding_parent | The constant node id of the node receiving the message. |
Definition at line 846 of file CNLoopyPropagation_tpl.h.
References _bnet_, ArcsL_max_, ArcsL_min_, ArcsP_max_, ArcsP_min_, gum::Set< Key >::empty(), enum_combi_(), gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, gum::Set< Key >::insert(), msg_l_sent_, next_active_nodes_set_, NodesL_max_, NodesL_min_, gum::Set< Key >::size(), update_l_, and update_p_.
Referenced by makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), and makeInferenceNodeToNeighbours_().
|
protected |
Sends a message to one's child, i.e.
X is sending a message to a demanding_child.
| X | The constant node id of the node sending the message. |
| demanding_child | The constant node id of the node receiving the message. |
Definition at line 1032 of file CNLoopyPropagation_tpl.h.
References _bnet_, ArcsL_max_, ArcsL_min_, ArcsP_max_, ArcsP_min_, enum_combi_(), gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, INF_, next_active_nodes_set_, NodesP_max_, NodesP_min_, gum::Set< Key >::size(), update_l_, and update_p_.
Referenced by makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), makeInferenceNodeToNeighbours_(), and updateIndicatrices_().
|
overridevirtualinherited |
Returns the number of iterations.
| OperationNotAllowed | Raised if the scheme did not perform. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 170 of file approximationScheme_inl.h.
References current_step_, GUM_ERROR, stateApproximationScheme(), and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::EMnbrIterations(), and gum::learning::IBNLearner::nbrIterations().
|
overridevirtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 156 of file approximationScheme_inl.h.
References period_size_.
Referenced by gum::learning::IBNLearner::EMPeriodSize(), and gum::learning::IBNLearner::periodSize().
|
protected |
Get the last messages from one's parents and children.
Definition at line 1237 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, ArcsL_max_, ArcsL_min_, ArcsP_max_, ArcsP_min_, gum::Set< Key >::empty(), enum_combi_(), gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, gum::credal::CredalNet< GUM_SCALAR >::Indic, INF_, NodesL_max_, NodesL_min_, NodesP_max_, NodesP_min_, update_l_, and update_p_.
Referenced by calculateEpsilon_(), and updateIndicatrices_().
|
inherited |
Returns the remaining burn in.
Definition at line 213 of file approximationScheme_inl.h.
References burn_in_, and current_step_.
|
inherited |
Get the current independence status.
True if repetitive, False otherwise. Definition at line 143 of file inferenceEngine_tpl.h.
References repetitiveInd_.
Referenced by makeInference().
|
protectedinherited |
Initialize t0_ and t1_ clusters.
Definition at line 763 of file inferenceEngine_tpl.h.
References gum::HashTable< Key, Val >::clear(), credalNet_, GUM_ERROR, t0_, t1_, and timeSteps_.
Referenced by setRepetitiveInd().
|
inherited |
Saves expectations to file.
| path | The path to the file to be used. |
Definition at line 541 of file inferenceEngine_tpl.h.
Referenced by makeInference().
| void gum::credal::CNLoopyPropagation< GUM_SCALAR >::saveInference | ( | std::string_view | path | ) |
| path | The path to the file to save marginals. |
Definition at line 49 of file CNLoopyPropagation_tpl.h.
References _bnet_, gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, GUM_ERROR, INF_, NodesL_max_, NodesL_min_, NodesP_max_, and NodesP_min_.
|
inherited |
Saves marginals to file.
| path | The path to the file to be used. |
Definition at line 518 of file inferenceEngine_tpl.h.
Referenced by makeInference().
|
inherited |
Saves vertices to file.
| path | The path to the file to be used. |
Definition at line 613 of file inferenceEngine_tpl.h.
References credalNet_, GUM_ERROR, and marginalSets_.
Referenced by makeInference().
|
overridevirtualinherited |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
If the criterion was disabled it will be enabled.
| eps | The new epsilon value. |
| OutOfBounds | Raised if eps < 0. |
Implements gum::IApproximationSchemeConfiguration.
Reimplemented in gum::learning::EMApproximationScheme.
Definition at line 64 of file approximationScheme_inl.h.
References enabled_eps_, eps_, and GUM_ERROR.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::EMApproximationScheme::setEpsilon(), and gum::learning::IBNLearner::setEpsilon().
|
overridevirtualinherited |
Stopping criterion on number of iterations.
If the criterion was disabled it will be enabled.
| max | The maximum number of iterations. |
| OutOfBounds | Raised if max <= 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 106 of file approximationScheme_inl.h.
References enabled_max_iter_, GUM_ERROR, and max_iter_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::IBNLearner::EMsetMaxIter(), and gum::learning::IBNLearner::setMaxIter().
|
overridevirtualinherited |
Stopping criterion on timeout.
If the criterion was disabled it will be enabled.
| timeout | The timeout value in seconds. |
| OutOfBounds | Raised if timeout <= 0.0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 127 of file approximationScheme_inl.h.
References enabled_max_time_, GUM_ERROR, and max_time_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::IBNLearner::EMsetMaxTime(), and gum::learning::IBNLearner::setMaxTime().
|
overridevirtualinherited |
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
If the criterion was disabled it will be enabled
| rate | The minimal epsilon rate. |
| OutOfBounds | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Reimplemented in gum::learning::EMApproximationScheme.
Definition at line 85 of file approximationScheme_inl.h.
References enabled_min_rate_eps_, GUM_ERROR, and min_rate_eps_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::EMApproximationScheme::setMinEpsilonRate(), and gum::learning::IBNLearner::setMinEpsilonRate().
|
overridevirtualinherited |
sets the number max of threads to be used by the class containing this ThreadNumberManager
| nb | the number of threads to be used. If this number is set to 0, then it is defaulted to aGrUM's number of threads |
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::setNumberOfThreads(), and gum::ScheduledInference::setNumberOfThreads().
|
overridevirtualinherited |
How many samples between two stopping is enable.
| p | The new period value. |
| OutOfBounds | Raised if p < 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 150 of file approximationScheme_inl.h.
References GUM_ERROR.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::IBNLearner::EMsetPeriodSize(), and gum::learning::IBNLearner::setPeriodSize().
|
inherited |
| repetitive | True if repetitive independence is to be used, false otherwise. Only useful with dynamic networks. |
Definition at line 134 of file inferenceEngine_tpl.h.
References repetitiveInd_, and repetitiveInit_().
Referenced by makeInference().
|
overridevirtualinherited |
Set the verbosity on (true) or off (false).
| v | If true, then verbosity is turned on. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 159 of file approximationScheme_inl.h.
References verbosity_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::SamplingInference< GUM_SCALAR >::SamplingInference(), gum::learning::IBNLearner::EMsetVerbosity(), and gum::learning::IBNLearner::setVerbosity().
|
inherited |
Returns true if we are at the beginning of a period (compute error is mandatory).
Definition at line 200 of file approximationScheme_inl.h.
Referenced by continueApproximationScheme().
|
overridevirtualinherited |
Returns the approximation scheme state.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 165 of file approximationScheme_inl.h.
Referenced by continueApproximationScheme(), gum::learning::IBNLearner::EMState(), gum::learning::IBNLearner::EMStateApproximationScheme(), history(), nbrIterations(), and gum::learning::IBNLearner::stateApproximationScheme().
|
inherited |
Stop the approximation scheme.
Definition at line 222 of file approximationScheme_inl.h.
Referenced by gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
|
privateinherited |
Stop the scheme given a new state.
| new_state | The scheme new state. |
Definition at line 231 of file approximationScheme_inl.h.
References gum::IApproximationSchemeConfiguration::Continue, and gum::IApproximationSchemeConfiguration::Undefined.
Referenced by continueApproximationScheme().
|
inherited |
True if optimal bayes net are stored for each variable and each modality, False otherwise. Definition at line 159 of file inferenceEngine_tpl.h.
References storeBNOpt_.
|
inherited |
| value | True if optimal Bayesian networks are to be stored for each variable and each modality. |
Definition at line 122 of file inferenceEngine_tpl.h.
References storeBNOpt_.
Referenced by makeInference().
|
inherited |
Get the number of iterations without changes used to stop some algorithms.
True if vertice are stored, False otherwise. Definition at line 154 of file inferenceEngine_tpl.h.
References storeVertices_.
|
inherited |
| value | True if vertices are to be stored, false otherwise. |
Definition at line 127 of file inferenceEngine_tpl.h.
References initMarginalSets_(), and storeVertices_.
Referenced by makeInference().
|
inherited |
Print all nodes marginals to standart output.
Definition at line 585 of file inferenceEngine_tpl.h.
Referenced by makeInference().
|
inherited |
Update the scheme w.r.t the new error and increment steps.
| incr | The new increment steps. |
Definition at line 209 of file approximationScheme_inl.h.
References current_step_.
Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByOrderedArcs_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceByRandomOrder_(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().
|
inlineprotectedinherited |
Given a node id and one of it's possible vertex, update it's credal set.
To maximise efficiency, don't pass a vertex we know is inside the polytope (i.e. not at an extreme value for any modality)
| id | The id of the node to be updated |
| vertex | A (tensor) vertex of the node credal set |
| elimRedund | remove redundant vertex (inside a facet) |
Definition at line 896 of file inferenceEngine_tpl.h.
References marginalSets_.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::verticesFusion_().
|
inlineprotectedinherited |
Given a node id and one of it's possible vertex obtained during inference, update this node lower and upper expectations.
| id | The id of the node to be updated |
| vertex | A (tensor) vertex of the node credal set |
Definition at line 874 of file inferenceEngine_tpl.h.
References credalNet_, expectationMax_, expectationMin_, and modal_.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_().
|
protected |
Only update indicatrices variables at the end of computations ( calls msgP_ ).
Definition at line 1442 of file CNLoopyPropagation_tpl.h.
References _bnet_, _cn_, gum::credal::CredalNet< GUM_SCALAR >::Indic, msgP_(), refreshLMsPIs_(), and updateMarginals_().
Referenced by makeInference().
|
protected |
Compute marginals from up-to-date messages.
Definition at line 1341 of file CNLoopyPropagation_tpl.h.
References _bnet_, gum::credal::InferenceEngine< GUM_SCALAR >::evidence_, INF_, gum::credal::InferenceEngine< GUM_SCALAR >::marginalMax_, gum::credal::InferenceEngine< GUM_SCALAR >::marginalMin_, NodesL_max_, NodesL_min_, NodesP_max_, and NodesP_min_.
Referenced by calculateEpsilon_(), and updateIndicatrices_().
|
overridevirtualinherited |
Returns true if verbosity is enabled.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 161 of file approximationScheme_inl.h.
References verbosity_.
Referenced by ApproximationScheme(), gum::learning::EMApproximationScheme::EMApproximationScheme(), continueApproximationScheme(), gum::learning::IBNLearner::EMVerbosity(), and gum::learning::IBNLearner::verbosity().
|
inherited |
Get the vertice of a given node id.
| id | The node id which vertice we want. |
Definition at line 513 of file inferenceEngine_tpl.h.
References marginalSets_.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_(), and makeInference().
|
private |
A pointer to it's IBayesNet used as a DAG.
Definition at line 393 of file CNLoopyPropagation.h.
Referenced by CNLoopyPropagation(), computeExpectations_(), eraseAllEvidence(), initialize_(), makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), makeInferenceNodeToNeighbours_(), msgL_(), msgP_(), refreshLMsPIs_(), saveInference(), updateIndicatrices_(), and updateMarginals_().
|
private |
A pointer to the CredalNet to be used.
Definition at line 390 of file CNLoopyPropagation.h.
Referenced by CNLoopyPropagation(), compute_ext_(), compute_ext_(), enum_combi_(), enum_combi_(), initialize_(), makeInferenceByOrderedArcs_(), makeInferenceByRandomOrder_(), makeInferenceNodeToNeighbours_(), refreshLMsPIs_(), and updateIndicatrices_().
|
private |
The chosen inference type.
nodeToNeighbours by Default.
Definition at line 387 of file CNLoopyPropagation.h.
Referenced by CNLoopyPropagation(), inferenceType(), inferenceType(), and makeInference().
|
privateinherited |
the max number of threads used by the class
Definition at line 126 of file threadNumberManager.h.
|
protected |
The current node-set to iterate through at this current step.
Definition at line 345 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), and makeInferenceNodeToNeighbours_().
|
protected |
"Upper" information \( \Lambda \) coming from one's children.
Definition at line 367 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protected |
"Lower" information \( \Lambda \) coming from one's children.
Definition at line 355 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protected |
"Upper" information \( \pi \) coming from one's parent.
Definition at line 369 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protected |
"Lower" information \( \pi \) coming from one's parent.
Definition at line 357 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protectedinherited |
Number of iterations before checking stopping criteria.
Definition at line 423 of file approximationScheme.h.
Referenced by ApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::burnIn(), gum::GibbsSampling< GUM_SCALAR >::burnIn(), remainingBurnIn(), gum::GibbsBNdistance< GUM_SCALAR >::setBurnIn(), and gum::GibbsSampling< GUM_SCALAR >::setBurnIn().
|
protectedinherited |
A pointer to the Credal Net used.
Definition at line 86 of file inferenceEngine.h.
Referenced by InferenceEngine(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), addEvidence(), credalNet(), dynamicExpectations_(), expectationMax(), expectationMin(), initExpectations_(), initMarginals_(), initMarginalSets_(), insertEvidence(), insertEvidence(), insertModals(), marginalMax(), marginalMin(), marginalMin(), repetitiveInit_(), saveVertices(), and updateExpectations_().
|
protectedinherited |
Current epsilon.
Definition at line 378 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
protectedinherited |
Current rate.
Definition at line 384 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
protectedinherited |
The current state.
Definition at line 393 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), and initApproximationScheme().
|
protectedinherited |
The current step.
Definition at line 387 of file approximationScheme.h.
Referenced by continueApproximationScheme(), initApproximationScheme(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::Miic::learnMixedStructure(), gum::learning::SimpleMiic::learnMixedStructure(), gum::learning::Miic::learnSkeleton(), nbrIterations(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), gum::learning::SimpleMiic::orientationMiic_(), remainingBurnIn(), and updateApproximationScheme().
|
protectedinherited |
Object used to efficiently store optimal bayes net during inference, for some algorithms.
Definition at line 160 of file inferenceEngine.h.
Referenced by InferenceEngine(), getVarMod2BNsMap(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::optFusion_().
|
protectedinherited |
Upper dynamic expectations.
If the network if not dynamic it's content is the same as expectationMax_.
Definition at line 113 of file inferenceEngine.h.
Referenced by dynamicExpectations_(), and eraseAllEvidence().
|
protectedinherited |
Lower dynamic expectations.
If the network is not dynamic it's content is the same as expectationMin_.
Definition at line 110 of file inferenceEngine.h.
Referenced by dynamicExpectations_(), and eraseAllEvidence().
|
protectedinherited |
If true, the threshold convergence is enabled.
Definition at line 402 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), disableEpsilon(), enableEpsilon(), isEnabledEpsilon(), and setEpsilon().
|
protectedinherited |
If true, the maximum iterations stopping criterion is enabled.
Definition at line 420 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), disableMaxIter(), enableMaxIter(), isEnabledMaxIter(), and setMaxIter().
|
protectedinherited |
If true, the timeout is enabled.
Definition at line 414 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), disableMaxTime(), enableMaxTime(), isEnabledMaxTime(), and setMaxTime().
|
protectedinherited |
If true, the minimal threshold for epsilon rate is enabled.
Definition at line 408 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), disableMinEpsilonRate(), enableMinEpsilonRate(), isEnabledMinEpsilonRate(), and setMinEpsilonRate().
|
protectedinherited |
Threshold for convergence.
Definition at line 399 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), epsilon(), and setEpsilon().
|
protectedinherited |
Holds observed variables states.
Definition at line 119 of file inferenceEngine.h.
Referenced by addEvidence(), eraseAllEvidence(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::initialize_(), insertEvidence(), insertEvidence(), insertEvidenceFile(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::msgL_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::msgP_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::optFusion_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::refreshLMsPIs_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::saveInference(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::updateMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::updateMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateThread_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::updateThread_().
|
protectedinherited |
Upper expectations, if some variables modalities were inserted.
Definition at line 106 of file inferenceEngine.h.
Referenced by dynamicExpectations_(), expectationMax(), expectationMax(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), initExpectations_(), and updateExpectations_().
|
protectedinherited |
Lower expectations, if some variables modalities were inserted.
Definition at line 103 of file inferenceEngine.h.
Referenced by dynamicExpectations_(), expectationMin(), expectationMin(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), initExpectations_(), and updateExpectations_().
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 396 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
protected |
TRUE if inference has already been performed, FALSE otherwise.
Definition at line 380 of file CNLoopyPropagation.h.
Referenced by CNLoopyPropagation(), ~CNLoopyPropagation(), eraseAllEvidence(), and makeInference().
|
protectedinherited |
Last epsilon value.
Definition at line 381 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
protectedinherited |
Upper marginals.
Definition at line 96 of file inferenceEngine.h.
Referenced by computeEpsilon_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::computeEpsilon_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_(), initMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::initThreadsData_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::optFusion_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::updateMarginals_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateMarginals_().
|
protectedinherited |
Lower marginals.
Definition at line 94 of file inferenceEngine.h.
Referenced by computeEpsilon_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::computeEpsilon_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_(), initMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::initThreadsData_(), marginalMin(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::optFusion_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::updateMarginals_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateMarginals_().
|
protectedinherited |
Credal sets vertices, if enabled.
Definition at line 99 of file inferenceEngine.h.
Referenced by gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), initMarginalSets_(), saveVertices(), updateCredalSets_(), and vertices().
|
protectedinherited |
The maximum iterations.
Definition at line 417 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), maxIter(), and setMaxIter().
|
protectedinherited |
The timeout.
Definition at line 411 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), maxTime(), and setMaxTime().
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 405 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), minEpsilonRate(), and setMinEpsilonRate().
|
protectedinherited |
Variables modalities used to compute expectations.
Definition at line 116 of file inferenceEngine.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::computeExpectations_(), dynamicExpectations_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), initExpectations_(), insertModals(), insertModalsFile(), and updateExpectations_().
|
protected |
Used to keep track of one's messages sent to it's parents.
Definition at line 352 of file CNLoopyPropagation.h.
Referenced by ~CNLoopyPropagation(), eraseAllEvidence(), initialize_(), and msgL_().
|
protected |
The next node-set, i.e.
the nodes that will send messages at the next step.
Definition at line 349 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), makeInferenceNodeToNeighbours_(), msgL_(), and msgP_().
|
protected |
"Upper" node information \( \Lambda \) obtained by combinaison of children messages.
Definition at line 372 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), msgL_(), refreshLMsPIs_(), saveInference(), and updateMarginals_().
|
protected |
"Lower" node information \( \Lambda \) obtained by combinaison of children messages.
Definition at line 360 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), refreshLMsPIs_(), saveInference(), and updateMarginals_().
|
protected |
"Upper" node information \( \pi \) obtained by combinaison of parent's messages.
Definition at line 376 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgP_(), refreshLMsPIs_(), saveInference(), and updateMarginals_().
|
protected |
"Lower" node information \( \pi \) obtained by combinaison of parent's messages.
Definition at line 364 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgP_(), refreshLMsPIs_(), saveInference(), and updateMarginals_().
|
protectedinherited |
Old upper marginals used to compute epsilon.
Definition at line 91 of file inferenceEngine.h.
Referenced by computeEpsilon_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::computeEpsilon_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::initialize_(), initMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::initThreadsData_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateOldMarginals_().
|
protectedinherited |
Old lower marginals used to compute epsilon.
Definition at line 89 of file inferenceEngine.h.
Referenced by computeEpsilon_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::computeEpsilon_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::initialize_(), initMarginals_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::initThreadsData_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateOldMarginals_().
Progression, error and time.
Definition at line 81 of file IApproximationSchemeConfiguration.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::learning::IBNLearner::distributeProgress(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), and gum::learning::SimpleMiic::orientationMiic_().
|
inherited |
Criteria messageApproximationScheme.
Definition at line 84 of file IApproximationSchemeConfiguration.h.
Referenced by gum::learning::IBNLearner::distributeStop().
|
protectedinherited |
Checking criteria frequency.
Definition at line 426 of file approximationScheme.h.
Referenced by ApproximationScheme(), and periodSize().
|
protectedinherited |
Holds the query nodes states.
Definition at line 121 of file inferenceEngine.h.
Referenced by eraseAllEvidence(), and insertQuery().
|
protectedinherited |
True if using repetitive independence ( dynamic network only ), False otherwise.
False by default.
Definition at line 145 of file inferenceEngine.h.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_verticesSampling_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference(), repetitiveInd(), and setRepetitiveInd().
|
protectedinherited |
Iterations limit stopping rule used by some algorithms such as CNMonteCarloSampling.
The algorithms stops if no changes occured within 1000 iterations by default. int iterStop_;
True is optimal bayes net are stored, for each variable and each modality, False otherwise. Not all algorithms offers this option. False by default.
Definition at line 155 of file inferenceEngine.h.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_mcThreadDataCopy_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_verticesSampling_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::eraseAllEvidence(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference(), storeBNOpt(), storeBNOpt(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::updateMarginals_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateThread_().
|
protectedinherited |
True if credal sets vertices are stored, False otherwise.
False by default.
Definition at line 141 of file inferenceEngine.h.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::CNMonteCarloSampling(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_mcThreadDataCopy_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::eraseAllEvidence(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), initMarginalSets_(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::makeInference(), storeVertices(), storeVertices(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateThread_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::verticesFusion_().
|
protectedinherited |
Clusters of nodes used with dynamic networks.
Any node key in t0_ is present at \( t=0 \) and any node belonging to the node set of this key share the same CPT than the key. Used for sampling with repetitive independence.
Definition at line 129 of file inferenceEngine.h.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_mcThreadDataCopy_(), getT0Cluster(), and repetitiveInit_().
|
protectedinherited |
Clusters of nodes used with dynamic networks.
Any node key in t1_ is present at \( t=1 \) and any node belonging to the node set of this key share the same CPT than the key. Used for sampling with repetitive independence.
Definition at line 136 of file inferenceEngine.h.
Referenced by gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::_mcThreadDataCopy_(), getT1Cluster(), and repetitiveInit_().
|
protectedinherited |
Definition at line 182 of file inferenceEngine.h.
Referenced by gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_().
|
protectedinherited |
the ranges of elements of marginalMin_ and marginalMax_ processed by each thread
these ranges are stored into a vector of pairs (NodeId, Idx). For thread number i, the pair at index i is the beginning of the range that the thread will have to process: this is the part of the marginal distribution vector of node NodeId starting at index Idx. The pair at index i+1 is the end of this range (not included).
Definition at line 172 of file inferenceEngine.h.
Referenced by computeEpsilon_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::computeEpsilon_(), dispatchMarginalsToThreads_(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::updateMarginals_().
|
protectedinherited |
The timer.
Definition at line 390 of file approximationScheme.h.
Referenced by continueApproximationScheme(), currentTime(), gum::learning::Miic::initiation_(), gum::learning::SimpleMiic::initiation_(), gum::learning::Miic::iteration_(), gum::learning::SimpleMiic::iteration_(), gum::learning::Miic::learnMixedStructure(), gum::learning::SimpleMiic::learnMixedStructure(), gum::learning::Miic::learnSkeleton(), gum::learning::SimpleMiic::orientationLatents_(), gum::learning::Miic::orientationMiic_(), and gum::learning::SimpleMiic::orientationMiic_().
|
protectedinherited |
The number of time steps of this network (only useful for dynamic networks).
Definition at line 179 of file inferenceEngine.h.
Referenced by repetitiveInit_().
|
protected |
Used to keep track of which node needs to update it's information coming from it's children.
Definition at line 342 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protected |
Used to keep track of which node needs to update it's information coming from it's parents.
Definition at line 338 of file CNLoopyPropagation.h.
Referenced by eraseAllEvidence(), initialize_(), msgL_(), msgP_(), and refreshLMsPIs_().
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 429 of file approximationScheme.h.
Referenced by ApproximationScheme(), setVerbosity(), and verbosity().