![]() |
aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
|
Class template representing a CredalNet inference engine using one or more IBayesNet inference engines such as LazyPropagation. More...
#include <multipleInferenceEngine.h>
Public Attributes | |
Signaler3< Size, double, double > | onProgress |
Progression, error and time. More... | |
Signaler1< std::string > | onStop |
Criteria messageApproximationScheme. More... | |
Public Member Functions | |
Constructors / Destructors | |
MultipleInferenceEngine (const CredalNet< GUM_SCALAR > &credalNet) | |
Constructor. More... | |
virtual | ~MultipleInferenceEngine () |
Destructor. More... | |
Post-inference methods | |
virtual void | eraseAllEvidence () |
Erase all inference related data to perform another one. More... | |
Pure virtual methods | |
virtual void | makeInference ()=0 |
To be redefined by each credal net algorithm. More... | |
Getters and setters | |
VarMod2BNsMap< GUM_SCALAR > * | getVarMod2BNsMap () |
Get optimum IBayesNet. More... | |
const CredalNet< GUM_SCALAR > & | credalNet () const |
Get this creadal network. More... | |
const NodeProperty< std::vector< NodeId > > & | getT0Cluster () const |
Get the t0_ cluster. More... | |
const NodeProperty< std::vector< NodeId > > & | getT1Cluster () const |
Get the t1_ cluster. More... | |
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. More... | |
void | storeBNOpt (const bool value) |
bool | storeBNOpt () const |
bool | repetitiveInd () const |
Get the current independence status. More... | |
Pre-inference initialization methods | |
void | insertModalsFile (const std::string &path) |
Insert variables modalities from file to compute expectations. More... | |
void | insertModals (const std::map< std::string, std::vector< GUM_SCALAR > > &modals) |
Insert variables modalities from map to compute expectations. More... | |
virtual void | insertEvidenceFile (const std::string &path) |
Insert evidence from file. More... | |
void | insertEvidence (const std::map< std::string, std::vector< GUM_SCALAR > > &eviMap) |
Insert evidence from map. More... | |
void | insertEvidence (const NodeProperty< std::vector< GUM_SCALAR > > &evidence) |
Insert evidence from Property. More... | |
void | insertQueryFile (const std::string &path) |
Insert query variables states from file. More... | |
void | insertQuery (const NodeProperty< std::vector< bool > > &query) |
Insert query variables and states from Property. More... | |
Post-inference methods | |
Potential< GUM_SCALAR > | marginalMin (const NodeId id) const |
Get the lower marginals of a given node id. More... | |
Potential< GUM_SCALAR > | marginalMin (const std::string &varName) const |
Get the lower marginals of a given variable name. More... | |
Potential< GUM_SCALAR > | marginalMax (const NodeId id) const |
Get the upper marginals of a given node id. More... | |
Potential< GUM_SCALAR > | marginalMax (const std::string &varName) const |
Get the upper marginals of a given variable name. More... | |
const GUM_SCALAR & | expectationMin (const NodeId id) const |
Get the lower expectation of a given node id. More... | |
const GUM_SCALAR & | expectationMin (const std::string &varName) const |
Get the lower expectation of a given variable name. More... | |
const GUM_SCALAR & | expectationMax (const NodeId id) const |
Get the upper expectation of a given node id. More... | |
const GUM_SCALAR & | expectationMax (const std::string &varName) const |
Get the upper expectation of a given variable name. More... | |
const std::vector< GUM_SCALAR > & | dynamicExpMin (const std::string &varName) const |
Get the lower dynamic expectation of a given variable prefix (without the time step included, i.e. More... | |
const std::vector< GUM_SCALAR > & | dynamicExpMax (const std::string &varName) const |
Get the upper dynamic expectation of a given variable prefix (without the time step included, i.e. More... | |
const std::vector< std::vector< GUM_SCALAR > > & | vertices (const NodeId id) const |
Get the vertice of a given node id. More... | |
void | saveMarginals (const std::string &path) const |
Saves marginals to file. More... | |
void | saveExpectations (const std::string &path) const |
Saves expectations to file. More... | |
void | saveVertices (const std::string &path) const |
Saves vertices to file. More... | |
void | dynamicExpectations () |
Compute dynamic expectations. More... | |
std::string | toString () const |
Print all nodes marginals to standart output. More... | |
const std::string | getApproximationSchemeMsg () |
Get approximation scheme state. More... | |
Getters and setters | |
void | setEpsilon (double eps) |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|. More... | |
double | epsilon () const |
Returns the value of epsilon. More... | |
void | disableEpsilon () |
Disable stopping criterion on epsilon. More... | |
void | enableEpsilon () |
Enable stopping criterion on epsilon. More... | |
bool | isEnabledEpsilon () const |
Returns true if stopping criterion on epsilon is enabled, false otherwise. More... | |
void | setMinEpsilonRate (double rate) |
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|). More... | |
double | minEpsilonRate () const |
Returns the value of the minimal epsilon rate. More... | |
void | disableMinEpsilonRate () |
Disable stopping criterion on epsilon rate. More... | |
void | enableMinEpsilonRate () |
Enable stopping criterion on epsilon rate. More... | |
bool | isEnabledMinEpsilonRate () const |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise. More... | |
void | setMaxIter (Size max) |
Stopping criterion on number of iterations. More... | |
Size | maxIter () const |
Returns the criterion on number of iterations. More... | |
void | disableMaxIter () |
Disable stopping criterion on max iterations. More... | |
void | enableMaxIter () |
Enable stopping criterion on max iterations. More... | |
bool | isEnabledMaxIter () const |
Returns true if stopping criterion on max iterations is enabled, false otherwise. More... | |
void | setMaxTime (double timeout) |
Stopping criterion on timeout. More... | |
double | maxTime () const |
Returns the timeout (in seconds). More... | |
double | currentTime () const |
Returns the current running time in second. More... | |
void | disableMaxTime () |
Disable stopping criterion on timeout. More... | |
void | enableMaxTime () |
Enable stopping criterion on timeout. More... | |
bool | isEnabledMaxTime () const |
Returns true if stopping criterion on timeout is enabled, false otherwise. More... | |
void | setPeriodSize (Size p) |
How many samples between two stopping is enable. More... | |
Size | periodSize () const |
Returns the period size. More... | |
void | setVerbosity (bool v) |
Set the verbosity on (true) or off (false). More... | |
bool | verbosity () const |
Returns true if verbosity is enabled. More... | |
ApproximationSchemeSTATE | stateApproximationScheme () const |
Returns the approximation scheme state. More... | |
Size | nbrIterations () const |
Returns the number of iterations. More... | |
const std::vector< double > & | history () const |
Returns the scheme history. More... | |
void | initApproximationScheme () |
Initialise the scheme. More... | |
bool | startOfPeriod () |
Returns true if we are at the beginning of a period (compute error is mandatory). More... | |
void | updateApproximationScheme (unsigned int incr=1) |
Update the scheme w.r.t the new error and increment steps. More... | |
Size | remainingBurnIn () |
Returns the remaining burn in. More... | |
void | stopApproximationScheme () |
Stop the approximation scheme. More... | |
bool | continueApproximationScheme (double error) |
Update the scheme w.r.t the new error. More... | |
Getters and setters | |
std::string | messageApproximationScheme () const |
Returns the approximation scheme message. More... | |
Public Types | |
enum | ApproximationSchemeSTATE : char { ApproximationSchemeSTATE::Undefined, ApproximationSchemeSTATE::Continue, ApproximationSchemeSTATE::Epsilon, ApproximationSchemeSTATE::Rate, ApproximationSchemeSTATE::Limit, ApproximationSchemeSTATE::TimeLimit, ApproximationSchemeSTATE::Stopped } |
The different state of an approximation scheme. More... | |
Protected Attributes | |
margis__ | l_marginalMin_ |
Threads lower marginals, one per thread. More... | |
margis__ | l_marginalMax_ |
Threads upper marginals, one per thread. More... | |
expes__ | l_expectationMin_ |
Threads lower expectations, one per thread. More... | |
expes__ | l_expectationMax_ |
Threads upper expectations, one per thread. More... | |
modals__ | l_modal_ |
Threads modalities. More... | |
credalSets__ | l_marginalSets_ |
Threads vertices. More... | |
margis__ | l_evidence_ |
Threads evidence. More... | |
clusters__ | l_clusters_ |
Threads clusters. More... | |
std::vector< bnet__ *> | workingSet_ |
Threads IBayesNet. More... | |
std::vector< List< const Potential< GUM_SCALAR > *> *> | workingSetE_ |
Threads evidence. More... | |
std::vector< BNInferenceEngine *> | l_inferenceEngine_ |
Threads BNInferenceEngine. More... | |
std::vector< VarMod2BNsMap< GUM_SCALAR > *> | l_optimalNet_ |
Threads optimal IBayesNet. More... | |
const CredalNet< GUM_SCALAR > * | credalNet_ |
A pointer to the Credal Net used. More... | |
margi | oldMarginalMin_ |
Old lower marginals used to compute epsilon. More... | |
margi | oldMarginalMax_ |
Old upper marginals used to compute epsilon. More... | |
margi | marginalMin_ |
Lower marginals. More... | |
margi | marginalMax_ |
Upper marginals. More... | |
credalSet | marginalSets_ |
Credal sets vertices, if enabled. More... | |
expe | expectationMin_ |
Lower expectations, if some variables modalities were inserted. More... | |
expe | expectationMax_ |
Upper expectations, if some variables modalities were inserted. More... | |
dynExpe | dynamicExpMin_ |
Lower dynamic expectations. More... | |
dynExpe | dynamicExpMax_ |
Upper dynamic expectations. More... | |
dynExpe | modal_ |
Variables modalities used to compute expectations. More... | |
margi | evidence_ |
Holds observed variables states. More... | |
query | query_ |
Holds the query nodes states. More... | |
cluster | t0_ |
Clusters of nodes used with dynamic networks. More... | |
cluster | t1_ |
Clusters of nodes used with dynamic networks. More... | |
bool | storeVertices_ |
True if credal sets vertices are stored, False otherwise. More... | |
bool | repetitiveInd_ |
True if using repetitive independence ( dynamic network only ), False otherwise. More... | |
bool | storeBNOpt_ |
Iterations limit stopping rule used by some algorithms such as CNMonteCarloSampling. More... | |
VarMod2BNsMap< GUM_SCALAR > | dbnOpt_ |
Object used to efficiently store optimal bayes net during inference, for some algorithms. More... | |
int | timeSteps_ |
The number of time steps of this network (only usefull for dynamic networks). More... | |
double | current_epsilon_ |
Current epsilon. More... | |
double | last_epsilon_ |
Last epsilon value. More... | |
double | current_rate_ |
Current rate. More... | |
Size | current_step_ |
The current step. More... | |
Timer | timer_ |
The timer. More... | |
ApproximationSchemeSTATE | current_state_ |
The current state. More... | |
std::vector< double > | history_ |
The scheme history, used only if verbosity == true. More... | |
double | eps_ |
Threshold for convergence. More... | |
bool | enabled_eps_ |
If true, the threshold convergence is enabled. More... | |
double | min_rate_eps_ |
Threshold for the epsilon rate. More... | |
bool | enabled_min_rate_eps_ |
If true, the minimal threshold for epsilon rate is enabled. More... | |
double | max_time_ |
The timeout. More... | |
bool | enabled_max_time_ |
If true, the timeout is enabled. More... | |
Size | max_iter_ |
The maximum iterations. More... | |
bool | enabled_max_iter_ |
If true, the maximum iterations stopping criterion is enabled. More... | |
Size | burn_in_ |
Number of iterations before checking stopping criteria. More... | |
Size | period_size_ |
Checking criteria frequency. More... | |
bool | verbosity_ |
If true, verbosity is enabled. More... | |
Protected Member Functions | |
Protected initialization methods | |
Fusion of threads optimal IBayesNet. | |
void | initThreadsData_ (const Size &num_threads, const bool storeVertices__, const bool storeBNOpt__) |
Initialize threads data. More... | |
Protected algorithms methods | |
bool | updateThread_ (const NodeId &id, const std::vector< GUM_SCALAR > &vertex, const bool &elimRedund=false) |
Update thread information (marginals, expectations, IBayesNet, vertices) for a given node id. More... | |
void | updateMarginals_ () |
Fusion of threads marginals. More... | |
const GUM_SCALAR | computeEpsilon_ () |
Compute epsilon and update old marginals. More... | |
void | updateOldMarginals_ () |
Update old marginals (from current marginals). More... | |
Proptected post-inference methods | |
void | optFusion_ () |
Fusion of threads optimal IBayesNet. More... | |
void | expFusion_ () |
Fusion of threads expectations. More... | |
void | verticesFusion_ () |
Protected initialization methods | |
void | repetitiveInit_ () |
Initialize t0_ and t1_ clusters. More... | |
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. More... | |
void | initMarginals_ () |
Initialize lower and upper old marginals and marginals before inference, with the lower marginal being 1 and the upper 0. More... | |
void | initMarginalSets_ () |
Initialize credal set vertices with empty sets. More... | |
Protected algorithms methods | |
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. More... | |
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. More... | |
Proptected post-inference methods | |
void | dynamicExpectations_ () |
Rearrange lower and upper expectations to suit dynamic networks. More... | |
Class template representing a CredalNet inference engine using one or more IBayesNet inference engines such as LazyPropagation.
Extends InferenceEngine< GUM_SCALAR >. Used for outer multi-threading such as CNMonteCarloSampling.
GUM_SCALAR | A floating type ( float, double, long double ... ). |
BNInferenceEngine | A IBayesNet inference engine such as LazyPropagation. |
Definition at line 54 of file multipleInferenceEngine.h.
|
private |
Definition at line 64 of file multipleInferenceEngine.h.
|
private |
Definition at line 59 of file multipleInferenceEngine.h.
|
private |
Definition at line 68 of file multipleInferenceEngine.h.
|
private |
Definition at line 60 of file multipleInferenceEngine.h.
|
private |
Definition at line 67 of file multipleInferenceEngine.h.
|
private |
Definition at line 62 of file multipleInferenceEngine.h.
|
private |
Definition at line 66 of file multipleInferenceEngine.h.
|
private |
To easily access InferenceEngine< GUM_SCALAR > methods.
Definition at line 57 of file multipleInferenceEngine.h.
|
private |
Definition at line 61 of file multipleInferenceEngine.h.
|
private |
Definition at line 65 of file multipleInferenceEngine.h.
|
private |
Definition at line 72 of file multipleInferenceEngine.h.
|
stronginherited |
The different state of an approximation scheme.
Enumerator | |
---|---|
Undefined | |
Continue | |
Epsilon | |
Rate | |
Limit | |
TimeLimit | |
Stopped |
Definition at line 64 of file IApproximationSchemeConfiguration.h.
|
explicit |
Constructor.
credalNet | The CredalNet to be used. |
Definition at line 30 of file multipleInferenceEngine_tpl.h.
|
virtual |
Destructor.
Definition at line 37 of file multipleInferenceEngine_tpl.h.
|
inlineprotected |
Compute epsilon and update old marginals.
Definition at line 303 of file multipleInferenceEngine_tpl.h.
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 226 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Get this creadal network.
Definition at line 59 of file inferenceEngine_tpl.h.
|
virtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 127 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 53 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 104 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 130 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 78 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Compute dynamic expectations.
Definition at line 718 of file inferenceEngine_tpl.h.
|
protectedinherited |
Rearrange lower and upper expectations to suit dynamic networks.
Definition at line 723 of file inferenceEngine_tpl.h.
|
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 506 of file inferenceEngine_tpl.h.
|
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 488 of file inferenceEngine_tpl.h.
|
virtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 56 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 107 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 133 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 83 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 50 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
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 532 of file multipleInferenceEngine_tpl.h.
|
inherited |
Get the upper expectation of a given node id.
id | The node id which upper expectation we want. |
Definition at line 481 of file inferenceEngine_tpl.h.
|
inherited |
Get the upper expectation of a given variable name.
varName | The variable name which upper expectation we want. |
Definition at line 464 of file inferenceEngine_tpl.h.
|
inherited |
Get the lower expectation of a given node id.
id | The node id which lower expectation we want. |
Definition at line 473 of file inferenceEngine_tpl.h.
|
inherited |
Get the lower expectation of a given variable name.
varName | The variable name which lower expectation we want. |
Definition at line 456 of file inferenceEngine_tpl.h.
|
protected |
Fusion of threads expectations.
Definition at line 409 of file multipleInferenceEngine_tpl.h.
|
inlineinherited |
Get approximation scheme state.
Definition at line 508 of file inferenceEngine.h.
|
inherited |
Get the t0_ cluster.
Definition at line 1008 of file inferenceEngine_tpl.h.
|
inherited |
Get the t1_ cluster.
Definition at line 1014 of file inferenceEngine_tpl.h.
|
inherited |
Get optimum IBayesNet.
Definition at line 141 of file inferenceEngine_tpl.h.
|
virtualinherited |
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 172 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Initialise the scheme.
Definition at line 186 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 697 of file inferenceEngine_tpl.h.
|
protectedinherited |
Initialize lower and upper old marginals and marginals before inference, with the lower marginal being 1 and the upper 0.
Definition at line 665 of file inferenceEngine_tpl.h.
|
protectedinherited |
Initialize credal set vertices with empty sets.
Definition at line 682 of file inferenceEngine_tpl.h.
|
inlineprotected |
Initialize threads data.
num_threads | The number of threads. |
storeVertices__ | True if vertices should be stored, False otherwise. |
storeBNOpt__ | True if optimal IBayesNet should be stored, false otherwise. |
Definition at line 43 of file multipleInferenceEngine_tpl.h.
|
inherited |
Insert evidence from map.
eviMap | The map variable name - likelihood. |
Definition at line 229 of file inferenceEngine_tpl.h.
|
inherited |
Insert evidence from Property.
evidence | The on nodes Property containing likelihoods. |
Definition at line 251 of file inferenceEngine_tpl.h.
|
virtualinherited |
Insert evidence from file.
path | The path to the evidence file. |
Reimplemented in gum::credal::CNLoopyPropagation< GUM_SCALAR >, and gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >.
Definition at line 270 of file inferenceEngine_tpl.h.
|
inherited |
Insert variables modalities from map to compute expectations.
modals | The map variable name - modalities. |
Definition at line 193 of file inferenceEngine_tpl.h.
|
inherited |
Insert variables modalities from file to compute expectations.
path | The path to the modalities file. |
Definition at line 146 of file inferenceEngine_tpl.h.
|
inherited |
Insert query variables and states from Property.
query | The on nodes Property containing queried variables states. |
Definition at line 331 of file inferenceEngine_tpl.h.
|
inherited |
Insert query variables states from file.
path | The path to the query file. |
Definition at line 348 of file inferenceEngine_tpl.h.
|
virtualinherited |
Returns true if stopping criterion on epsilon is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 60 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on max iterations is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 111 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on timeout is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 137 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 89 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
pure virtual |
To be redefined by each credal net algorithm.
Starts the inference.
Implements gum::credal::InferenceEngine< GUM_SCALAR >.
Implemented in gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >.
|
inherited |
Get the upper marginals of a given node id.
id | The node id which upper marginals we want. |
Definition at line 446 of file inferenceEngine_tpl.h.
|
inherited |
Get the upper marginals of a given variable name.
varName | The variable name which upper marginals we want. |
Definition at line 428 of file inferenceEngine_tpl.h.
|
inherited |
Get the lower marginals of a given node id.
id | The node id which lower marginals we want. |
Definition at line 435 of file inferenceEngine_tpl.h.
|
inherited |
Get the lower marginals of a given variable name.
varName | The variable name which lower marginals we want. |
Definition at line 422 of file inferenceEngine_tpl.h.
|
virtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 101 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 124 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the approximation scheme message.
Definition at line 39 of file IApproximationSchemeConfiguration_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 73 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the number of iterations.
OperationNotAllowed | Raised if the scheme did not perform. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 162 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
Fusion of threads optimal IBayesNet.
Definition at line 482 of file multipleInferenceEngine_tpl.h.
|
virtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 148 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the remaining burn in.
Definition at line 209 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Get the current independence status.
True
if repetitive, False
otherwise. Definition at line 120 of file inferenceEngine_tpl.h.
|
protectedinherited |
Initialize t0_ and t1_ clusters.
Definition at line 786 of file inferenceEngine_tpl.h.
|
inherited |
Saves expectations to file.
path | The path to the file to be used. |
Definition at line 556 of file inferenceEngine_tpl.h.
|
inherited |
Saves marginals to file.
path | The path to the file to be used. |
Definition at line 530 of file inferenceEngine_tpl.h.
|
inherited |
Saves vertices to file.
path | The path to the file to be used. |
Definition at line 630 of file inferenceEngine_tpl.h.
|
virtualinherited |
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. |
OutOfLowerBound | Raised if eps < 0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 42 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Stopping criterion on number of iterations.
If the criterion was disabled it will be enabled.
max | The maximum number of iterations. |
OutOfLowerBound | Raised if max <= 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 94 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Stopping criterion on timeout.
If the criterion was disabled it will be enabled.
timeout | The timeout value in seconds. |
OutOfLowerBound | Raised if timeout <= 0.0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 117 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
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. |
OutOfLowerBound | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 65 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
How many samples between two stopping is enable.
p | The new period value. |
OutOfLowerBound | Raised if p < 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 142 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
repetitive | True if repetitive independence is to be used, false otherwise. Only usefull with dynamic networks. |
Definition at line 111 of file inferenceEngine_tpl.h.
|
virtualinherited |
Set the verbosity on (true) or off (false).
v | If true, then verbosity is turned on. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 151 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns true if we are at the beginning of a period (compute error is mandatory).
Definition at line 196 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the approximation scheme state.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 157 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Stop the approximation scheme.
Definition at line 218 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
value | True if optimal Bayesian networks are to be stored for each variable and each modality. |
Definition at line 99 of file inferenceEngine_tpl.h.
|
inherited |
True
if optimal bayes net are stored for each variable and each modality, False
otherwise. Definition at line 135 of file inferenceEngine_tpl.h.
|
inherited |
value | True if vertices are to be stored, false otherwise. |
Definition at line 104 of file inferenceEngine_tpl.h.
|
inherited |
Get the number of iterations without changes used to stop some algorithms.
True
if vertice are stored, False
otherwise. Definition at line 130 of file inferenceEngine_tpl.h.
|
inherited |
Print all nodes marginals to standart output.
Definition at line 601 of file inferenceEngine_tpl.h.
|
inherited |
Update the scheme w.r.t the new error and increment steps.
incr | The new increment steps. |
Definition at line 205 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
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 (potential) vertex of the node credal set |
elimRedund | remove redundant vertex (inside a facet) |
Definition at line 931 of file inferenceEngine_tpl.h.
|
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 (potential) vertex of the node credal set |
Definition at line 909 of file inferenceEngine_tpl.h.
|
inlineprotected |
Fusion of threads marginals.
Definition at line 273 of file multipleInferenceEngine_tpl.h.
|
protected |
Update old marginals (from current marginals).
Call this once to initialize old marginals (after burn-in for example) and then use computeEpsilon_ which does the same job but compute epsilon too.
Definition at line 346 of file multipleInferenceEngine_tpl.h.
|
inlineprotected |
Update thread information (marginals, expectations, IBayesNet, vertices) for a given node id.
id | The id of the node to be updated. |
vertex | The vertex. |
elimRedund | true if redundancy elimination is to be performed, false otherwise and by default. |
True
if the IBayesNet is kept (for now), False
otherwise. Definition at line 88 of file multipleInferenceEngine_tpl.h.
|
inlineprivate |
Ask for redundancy elimination of a node credal set of a calling thread.
Called by updateThread_ if vertices are stored.
id | A constant reference to the node id whose credal set is to be checked for redundancy. |
vertex | The vertex to add to the credal set. |
elimRedund | true if redundancy elimination is to be performed, false otherwise and by default. |
Definition at line 192 of file multipleInferenceEngine_tpl.h.
|
virtualinherited |
Returns true if verbosity is enabled.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 153 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Get the vertice of a given node id.
id | The node id which vertice we want. |
Definition at line 525 of file inferenceEngine_tpl.h.
|
protected |
Definition at line 375 of file multipleInferenceEngine_tpl.h.
|
protectedinherited |
Number of iterations before checking stopping criteria.
Definition at line 413 of file approximationScheme.h.
|
protectedinherited |
A pointer to the Credal Net used.
Definition at line 69 of file inferenceEngine.h.
|
protectedinherited |
Current epsilon.
Definition at line 368 of file approximationScheme.h.
|
protectedinherited |
Current rate.
Definition at line 374 of file approximationScheme.h.
|
protectedinherited |
The current state.
Definition at line 383 of file approximationScheme.h.
|
protectedinherited |
The current step.
Definition at line 377 of file approximationScheme.h.
|
protectedinherited |
Object used to efficiently store optimal bayes net during inference, for some algorithms.
Definition at line 142 of file inferenceEngine.h.
|
protectedinherited |
Upper dynamic expectations.
If the network if not dynamic it's content is the same as expectationMax_.
Definition at line 96 of file inferenceEngine.h.
|
protectedinherited |
Lower dynamic expectations.
If the network is not dynamic it's content is the same as expectationMin_.
Definition at line 93 of file inferenceEngine.h.
|
protectedinherited |
If true, the threshold convergence is enabled.
Definition at line 392 of file approximationScheme.h.
|
protectedinherited |
If true, the maximum iterations stopping criterion is enabled.
Definition at line 410 of file approximationScheme.h.
|
protectedinherited |
If true, the timeout is enabled.
Definition at line 404 of file approximationScheme.h.
|
protectedinherited |
If true, the minimal threshold for epsilon rate is enabled.
Definition at line 398 of file approximationScheme.h.
|
protectedinherited |
Threshold for convergence.
Definition at line 389 of file approximationScheme.h.
|
protectedinherited |
Holds observed variables states.
Definition at line 102 of file inferenceEngine.h.
|
protectedinherited |
Upper expectations, if some variables modalities were inserted.
Definition at line 89 of file inferenceEngine.h.
|
protectedinherited |
Lower expectations, if some variables modalities were inserted.
Definition at line 86 of file inferenceEngine.h.
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 386 of file approximationScheme.h.
|
protected |
Threads clusters.
Definition at line 107 of file multipleInferenceEngine.h.
|
protected |
Threads evidence.
Definition at line 105 of file multipleInferenceEngine.h.
|
protected |
Threads upper expectations, one per thread.
Definition at line 99 of file multipleInferenceEngine.h.
|
protected |
Threads lower expectations, one per thread.
Definition at line 97 of file multipleInferenceEngine.h.
|
protected |
Threads BNInferenceEngine.
Definition at line 115 of file multipleInferenceEngine.h.
|
protected |
Threads upper marginals, one per thread.
Definition at line 95 of file multipleInferenceEngine.h.
|
protected |
Threads lower marginals, one per thread.
Definition at line 93 of file multipleInferenceEngine.h.
|
protected |
Threads vertices.
Definition at line 103 of file multipleInferenceEngine.h.
|
protected |
Threads modalities.
Definition at line 101 of file multipleInferenceEngine.h.
|
protected |
Threads optimal IBayesNet.
Definition at line 117 of file multipleInferenceEngine.h.
|
protectedinherited |
Last epsilon value.
Definition at line 371 of file approximationScheme.h.
|
protectedinherited |
Upper marginals.
Definition at line 79 of file inferenceEngine.h.
|
protectedinherited |
Lower marginals.
Definition at line 77 of file inferenceEngine.h.
|
protectedinherited |
Credal sets vertices, if enabled.
Definition at line 82 of file inferenceEngine.h.
|
protectedinherited |
The maximum iterations.
Definition at line 407 of file approximationScheme.h.
|
protectedinherited |
The timeout.
Definition at line 401 of file approximationScheme.h.
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 395 of file approximationScheme.h.
|
protectedinherited |
Variables modalities used to compute expectations.
Definition at line 99 of file inferenceEngine.h.
|
protectedinherited |
Old upper marginals used to compute epsilon.
Definition at line 74 of file inferenceEngine.h.
|
protectedinherited |
Old lower marginals used to compute epsilon.
Definition at line 72 of file inferenceEngine.h.
Progression, error and time.
Definition at line 58 of file IApproximationSchemeConfiguration.h.
|
inherited |
Criteria messageApproximationScheme.
Definition at line 61 of file IApproximationSchemeConfiguration.h.
|
protectedinherited |
Checking criteria frequency.
Definition at line 416 of file approximationScheme.h.
|
protectedinherited |
Holds the query nodes states.
Definition at line 104 of file inferenceEngine.h.
|
protectedinherited |
True
if using repetitive independence ( dynamic network only ), False
otherwise.
False
by default.
Definition at line 128 of file inferenceEngine.h.
|
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 138 of file inferenceEngine.h.
|
protectedinherited |
True
if credal sets vertices are stored, False
otherwise.
False
by default.
Definition at line 124 of file inferenceEngine.h.
|
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 112 of file inferenceEngine.h.
|
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 119 of file inferenceEngine.h.
|
protectedinherited |
The timer.
Definition at line 380 of file approximationScheme.h.
|
protectedinherited |
The number of time steps of this network (only usefull for dynamic networks).
Definition at line 149 of file inferenceEngine.h.
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 419 of file approximationScheme.h.
|
protected |
Threads IBayesNet.
Definition at line 110 of file multipleInferenceEngine.h.
|
protected |
Threads evidence.
Definition at line 112 of file multipleInferenceEngine.h.