![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Abstract base for CI-test-based causal structure learning (PC, FCI). More...
#include <CIBasedLearning.h>
Classes | |
| struct | SepSetEntry_ |
Public Types | |
| enum class | UCPriority : uint8_t { Standard , Sorted } |
| Controls how collider candidates are ordered before orientation. More... | |
| enum class | ApproximationSchemeSTATE : char { Undefined , Continue , Epsilon , Rate , Limit , TimeLimit , Stopped } |
| The different state of an approximation scheme. More... | |
Public Member Functions | |
Constructors / Destructors | |
| CIBasedLearning () | |
| CIBasedLearning (const CIBasedLearning &) | |
| CIBasedLearning (CIBasedLearning &&) noexcept | |
| ~CIBasedLearning () override | |
| CIBasedLearning & | operator= (const CIBasedLearning &) |
| CIBasedLearning & | operator= (CIBasedLearning &&) noexcept |
CI test injection | |
| void | setIndependenceTest (IndependenceTest &test) |
| inject independence test (non-owning: caller manages lifetime) | |
Parameterisation | |
| void | setAlpha (double alpha) |
| maximum conditioning set size; Size(-1) = unlimited (default) | |
| double | alpha () const |
| maximum conditioning set size; Size(-1) = unlimited (default) | |
| void | setMaxCondSetSize (Size max_k) |
| maximum conditioning set size; Size(-1) = unlimited (default) | |
| void | setStable (bool stable) |
| stable mode: defer edge removals until end of each depth (default: true) | |
| void | setExhaustiveSepSet (bool exhaustive) |
| exhaustive sepset mode: accumulate union of all separating sets found at each depth, rather than stopping at the first (default: false) | |
| bool | exhaustiveSepSet () const |
| maximum conditioning set size; Size(-1) = unlimited (default) | |
| void | setUCPriority (UCPriority p) |
| collider candidate ordering (default: Standard) | |
| UCPriority | ucPriority () const |
| maximum conditioning set size; Size(-1) = unlimited (default) | |
Learning | |
| MixedGraph | learnSkeleton (MixedGraph graph) override |
| Phase 1: skeleton discovery via conditional independence tests. | |
Constraint setters | |
| void | setForbiddenGraph (const gum::DiGraph &forbidGraph) |
| void | setMandatoryGraph (const gum::DAG &mandaGraph) |
| void | setMaxIndegree (gum::Size n) |
| void | addConstraints (const HashTable< std::pair< NodeId, NodeId >, char > &constraints) |
| const std::vector< Arc > | latentVariables () const |
Learning — template methods (call the pure virtual interface) | |
| PDAG | learnPDAG (MixedGraph graph) |
| learns the essential graph (CPDAG) | |
| DAG | learnDAG (MixedGraph graph) |
| learns a DAG | |
| template<GUM_Numeric GUM_SCALAR = double, typename PARAM_ESTIMATOR> | |
| BayesNet< GUM_SCALAR > | learnBN (PARAM_ESTIMATOR &estimator, MixedGraph graph) |
| learns structure then estimates parameters | |
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. | |
Public Attributes | |
| Signaler< gum::NodeId, gum::NodeId, std::string, std::string > | onStructuralModification |
| Signaler< Size, double, double > | onProgress |
| Progression, error and time. | |
| Signaler< std::string_view > | onStop |
| Criteria messageApproximationScheme. | |
Protected Member Functions | |
Collider orientation (shared between PC and FCI Phase 2/4) | |
| MixedGraph | orientUnshieldedColliders_ (MixedGraph graph) |
| orient unshielded colliders in graph and return the updated graph | |
| void | orientColliderArm_ (MixedGraph &graph, NodeId src, NodeId dst) |
| orient one arm (src → dst) of a collider; calls resolveOrientConflict_ on conflict | |
| virtual void | resolveOrientConflict_ (NodeId src, NodeId dst) |
| conflict hook: called when orientation cannot proceed (arc blocked or reversed). Default: push Arc(src,dst) to latentCouples (PC behaviour). FCI override: no-op (leave circle mark). | |
Pure virtual interface — subclasses must implement | |
| virtual MixedGraph | learnMixedStructure (MixedGraph graph)=0 |
Constraint checks | |
| bool | isForbiddenArc_ (NodeId x, NodeId y) const |
| bool | isForbiddenEdge_ (NodeId x, NodeId y) const |
| bool | isMaxIndegree_ (const MixedGraph &graph, NodeId x) |
| bool | isArcValid_ (const MixedGraph &graph, NodeId x, NodeId y) |
Protected Attributes | |
| 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. | |
Shared state | |
| IndependenceTest * | test_ {nullptr} |
| double | alpha_ = 0.05 |
| Size | maxCondSetSize_ = Size(-1) |
| bool | stable_ = true |
| bool | exhaustiveSepSet_ = false |
| UCPriority | ucPriority_ = UCPriority::Standard |
| HashTable< std::pair< NodeId, NodeId >, SepSetEntry_ > | sepSet_ |
Private Member Functions | |
| void | stopScheme_ (ApproximationSchemeSTATE new_state) |
| Stop the scheme given a new state. | |
Graph utilities | |
| gum::MeekRules | meekRules_ |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| void | orientDoubleHeadedArcs_ (MixedGraph &mg) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| std::vector< ThreePoints > | unshieldedTriples_ (const MixedGraph &graph) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| void | applyStructuralConstraints_ (MixedGraph &graph) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| MixedGraph | initGraph_ (const MixedGraph &template_graph) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| static bool | _existsDirectedPath_ (const MixedGraph &graph, NodeId n1, NodeId n2) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
| static bool | _existsNonTrivialDirectedPath_ (const MixedGraph &graph, NodeId n1, NodeId n2) |
| Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI. | |
Common state (accessible to subclasses) | |
| gum::DiGraph | _forbiddenGraph_ |
| gum::DAG | _mandatoryGraph_ |
| HashTable< std::pair< NodeId, NodeId >, char > | _initialMarks_ |
| std::vector< Arc > | _latentCouples_ |
| int | _maxLog_ {100} |
| const std::vector< NodeId > | _emptySet_ |
| gum::Size | _maxIndegree_ {std::numeric_limits< gum::Size >::max()} |
Abstract base for CI-test-based causal structure learning (PC, FCI).
Provides:
Definition at line 81 of file CIBasedLearning.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 |
Controls how collider candidates are ordered before orientation.
| Enumerator | |
|---|---|
| Standard | process triples in natural traversal order |
| Sorted | descending p-value order (strongest evidence first) |
Definition at line 84 of file CIBasedLearning.h.
|
default |
Referenced by CIBasedLearning(), CIBasedLearning(), gum::learning::FCI::FCI(), gum::learning::PC::PC(), ~CIBasedLearning(), operator=(), and operator=().
|
default |
|
noexcept |
Definition at line 63 of file CIBasedLearning.cpp.
References CIBasedLearning(), gum::learning::ConstraintBasedLearning::ConstraintBasedLearning(), alpha_, exhaustiveSepSet_, maxCondSetSize_, sepSet_, stable_, test_, and ucPriority_.
|
overridedefault |
References CIBasedLearning(), alpha(), exhaustiveSepSet(), learnSkeleton(), setAlpha(), setExhaustiveSepSet(), setIndependenceTest(), setMaxCondSetSize(), setStable(), setUCPriority(), and ucPriority().
|
staticprotectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 180 of file ConstraintBasedLearning.cpp.
References gum::List< Val >::empty(), gum::Set< Key >::exists(), gum::List< Val >::front(), gum::Set< Key >::insert(), gum::List< Val >::popFront(), and gum::List< Val >::pushBack().
Referenced by _existsNonTrivialDirectedPath_(), gum::learning::Miic::_propagatingOrientationMiic_(), gum::learning::Miic::orientationMiic_(), gum::learning::CIBasedLearning::orientColliderArm_(), and orientDoubleHeadedArcs_().
|
staticprotectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 169 of file ConstraintBasedLearning.cpp.
References _existsDirectedPath_().
Referenced by gum::learning::Miic::_orientingVstructureMiic_().
|
inherited |
Definition at line 124 of file ConstraintBasedLearning.cpp.
References _initialMarks_.
| double gum::learning::CIBasedLearning::alpha | ( | ) | const |
maximum conditioning set size; Size(-1) = unlimited (default)
Definition at line 108 of file CIBasedLearning.cpp.
References alpha_.
Referenced by ~CIBasedLearning(), and setAlpha().
|
protectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 250 of file ConstraintBasedLearning.cpp.
References _forbiddenGraph_, _mandatoryGraph_, and GUM_SL_EMIT.
Referenced by gum::learning::PC::learnMixedStructure(), gum::learning::FCI::learnPAG(), and gum::learning::Miic::orientationMiic_().
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, history_, last_epsilon_, gum::IApproximationSchemeConfiguration::Limit, max_iter_, max_time_, gum::IApproximationSchemeConfiguration::messageApproximationScheme(), min_rate_eps_, gum::IApproximationSchemeConfiguration::onProgress, gum::IApproximationSchemeConfiguration::Rate, startOfPeriod(), stateApproximationScheme(), stopScheme_(), gum::IApproximationSchemeConfiguration::TimeLimit, timer_, and verbosity().
Referenced by gum::GibbsBNdistance< 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_().
|
overridevirtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 137 of file approximationScheme_inl.h.
References timer_.
|
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(), 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(), and gum::learning::GreedyThickThinning::GreedyThickThinning().
|
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(), and gum::learning::GreedyThickThinning::GreedyThickThinning().
|
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::GibbsBNdistance< GUM_SCALAR >::computeKL_(), and gum::learning::EMApproximationScheme::setEpsilon().
|
overridevirtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 78 of file approximationScheme_inl.h.
References enabled_eps_.
|
overridevirtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 119 of file approximationScheme_inl.h.
References enabled_max_iter_.
|
overridevirtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 143 of file approximationScheme_inl.h.
References enabled_max_time_.
|
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(), and gum::GibbsBNdistance< GUM_SCALAR >::computeKL_().
|
overridevirtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 72 of file approximationScheme_inl.h.
References eps_.
Referenced by gum::ImportanceSampling< GUM_SCALAR >::onContextualize_(), and gum::ImportanceSampling< GUM_SCALAR >::unsharpenBN_().
| bool gum::learning::CIBasedLearning::exhaustiveSepSet | ( | ) | const |
maximum conditioning set size; Size(-1) = unlimited (default)
Definition at line 116 of file CIBasedLearning.cpp.
References exhaustiveSepSet_.
Referenced by ~CIBasedLearning().
|
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.
|
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_(), 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 |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 273 of file ConstraintBasedLearning.cpp.
References gum::NodeGraphPart::begin(), gum::EdgeGraphPart::edges(), gum::Set< Key >::empty(), gum::NodeGraphPart::end(), GUM_SL_EMIT, isForbiddenEdge_(), and gum::NodeGraphPart::nodes().
Referenced by gum::learning::Miic::learnMixedStructure(), gum::learning::CIBasedLearning::learnSkeleton(), and gum::learning::Miic::learnSkeleton().
|
protectedinherited |
Definition at line 161 of file ConstraintBasedLearning.cpp.
References isForbiddenArc_(), and isMaxIndegree_().
Referenced by gum::learning::Miic::_orientingVstructureMiic_(), gum::learning::Miic::_propagatingOrientationMiic_(), and gum::learning::CIBasedLearning::orientColliderArm_().
|
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_.
|
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_.
|
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_.
|
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_().
|
protectedinherited |
Definition at line 149 of file ConstraintBasedLearning.cpp.
References _forbiddenGraph_.
Referenced by gum::learning::FCI::doDdpOrientation_(), isArcValid_(), gum::learning::FCI::orientCollidersOnPAG_(), gum::learning::FCI::ruleR1_(), and gum::learning::FCI::ruleR2_().
|
protectedinherited |
Definition at line 153 of file ConstraintBasedLearning.cpp.
References _forbiddenGraph_.
Referenced by initGraph_().
|
protectedinherited |
Definition at line 157 of file ConstraintBasedLearning.cpp.
References _maxIndegree_.
Referenced by isArcValid_().
|
inherited |
Definition at line 129 of file ConstraintBasedLearning.cpp.
References _latentCouples_.
|
inherited |
learns structure then estimates parameters
Definition at line 12 of file ConstraintBasedLearning_tpl.h.
References gum::learning::DAG2BNLearner::createBN(), and learnDAG().
|
inherited |
learns a DAG
Definition at line 141 of file ConstraintBasedLearning.cpp.
References learnMixedStructure(), and meekRules_.
Referenced by learnBN().
|
protectedpure virtualinherited |
Implemented in gum::learning::FCI, gum::learning::Miic, and gum::learning::PC.
Referenced by learnDAG(), and learnPDAG().
|
inherited |
learns the essential graph (CPDAG)
Definition at line 137 of file ConstraintBasedLearning.cpp.
References learnMixedStructure(), and meekRules_.
|
overridevirtual |
Phase 1: skeleton discovery via conditional independence tests.
Implements gum::learning::ConstraintBasedLearning.
Definition at line 126 of file CIBasedLearning.cpp.
References gum::learning::ConstraintBasedLearning::_emptySet_, alpha_, exhaustiveSepSet_, gum::learning::ConstraintBasedLearning::initGraph_(), maxCondSetSize_, sepSet_, stable_, and test_.
Referenced by ~CIBasedLearning(), gum::learning::PC::learnMixedStructure(), and gum::learning::FCI::learnPAG().
|
overridevirtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 113 of file approximationScheme_inl.h.
References max_iter_.
|
overridevirtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 134 of file approximationScheme_inl.h.
References max_time_.
|
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::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::isEnabledMaxIter().
|
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_.
|
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_().
|
noexcept |
Definition at line 85 of file CIBasedLearning.cpp.
References CIBasedLearning(), alpha_, exhaustiveSepSet_, maxCondSetSize_, gum::learning::ConstraintBasedLearning::operator=(), sepSet_, stable_, test_, and ucPriority_.
| CIBasedLearning & gum::learning::CIBasedLearning::operator= | ( | const CIBasedLearning & | from | ) |
Definition at line 71 of file CIBasedLearning.cpp.
References CIBasedLearning(), alpha_, exhaustiveSepSet_, maxCondSetSize_, gum::learning::ConstraintBasedLearning::operator=(), sepSet_, stable_, test_, and ucPriority_.
Referenced by gum::learning::FCI::operator=(), gum::learning::FCI::operator=(), gum::learning::PC::operator=(), and gum::learning::PC::operator=().
|
protected |
orient one arm (src → dst) of a collider; calls resolveOrientConflict_ on conflict
Definition at line 244 of file CIBasedLearning.cpp.
References gum::learning::ConstraintBasedLearning::_existsDirectedPath_(), GUM_SL_EMIT, gum::learning::ConstraintBasedLearning::isArcValid_(), and resolveOrientConflict_().
Referenced by orientUnshieldedColliders_().
|
protectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 204 of file ConstraintBasedLearning.cpp.
References _existsDirectedPath_(), gum::Set< Key >::begin(), gum::Set< Key >::contains(), gum::Set< Key >::empty(), gum::Set< Key >::erase(), gum::ArcGraphPart::eraseArc(), gum::Set< Key >::insert(), gum::NodeGraphPart::nodes(), and gum::ArcGraphPart::parents().
Referenced by gum::learning::FCI::learnMixedStructure().
|
protected |
orient unshielded colliders in graph and return the updated graph
Definition at line 268 of file CIBasedLearning.cpp.
References gum::learning::ConstraintBasedLearning::_latentCouples_, gum::learning::CIBasedLearning::SepSetEntry_::cond, orientColliderArm_(), sepSet_, Standard, ucPriority_, and gum::learning::ConstraintBasedLearning::unshieldedTriples_().
Referenced by gum::learning::PC::learnMixedStructure().
|
overridevirtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 156 of file approximationScheme_inl.h.
References period_size_.
|
inherited |
Returns the remaining burn in.
Definition at line 213 of file approximationScheme_inl.h.
References burn_in_, and current_step_.
|
protectedvirtual |
conflict hook: called when orientation cannot proceed (arc blocked or reversed). Default: push Arc(src,dst) to latentCouples (PC behaviour). FCI override: no-op (leave circle mark).
Reimplemented in gum::learning::FCI.
Definition at line 264 of file CIBasedLearning.cpp.
References gum::learning::ConstraintBasedLearning::_latentCouples_.
Referenced by orientColliderArm_().
| void gum::learning::CIBasedLearning::setAlpha | ( | double | alpha | ) |
maximum conditioning set size; Size(-1) = unlimited (default)
Definition at line 106 of file CIBasedLearning.cpp.
References alpha(), and alpha_.
Referenced by ~CIBasedLearning().
|
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::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::EMApproximationScheme::setEpsilon().
| void gum::learning::CIBasedLearning::setExhaustiveSepSet | ( | bool | exhaustive | ) |
exhaustive sepset mode: accumulate union of all separating sets found at each depth, rather than stopping at the first (default: false)
Definition at line 114 of file CIBasedLearning.cpp.
References exhaustiveSepSet_.
Referenced by ~CIBasedLearning().
|
inherited |
Definition at line 118 of file ConstraintBasedLearning.cpp.
References _forbiddenGraph_.
| void gum::learning::CIBasedLearning::setIndependenceTest | ( | IndependenceTest & | test | ) |
inject independence test (non-owning: caller manages lifetime)
Definition at line 104 of file CIBasedLearning.cpp.
References test_.
Referenced by ~CIBasedLearning().
|
inherited |
Definition at line 114 of file ConstraintBasedLearning.cpp.
References _mandatoryGraph_.
| void gum::learning::CIBasedLearning::setMaxCondSetSize | ( | Size | max_k | ) |
maximum conditioning set size; Size(-1) = unlimited (default)
Definition at line 110 of file CIBasedLearning.cpp.
References maxCondSetSize_.
Referenced by ~CIBasedLearning().
|
inherited |
Definition at line 122 of file ConstraintBasedLearning.cpp.
References _maxIndegree_.
|
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(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
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(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
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::SamplingInference< GUM_SCALAR >::SamplingInference(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().
|
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(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
| void gum::learning::CIBasedLearning::setStable | ( | bool | stable | ) |
stable mode: defer edge removals until end of each depth (default: true)
Definition at line 112 of file CIBasedLearning.cpp.
References stable_.
Referenced by ~CIBasedLearning().
| void gum::learning::CIBasedLearning::setUCPriority | ( | UCPriority | p | ) |
collider candidate ordering (default: Standard)
Definition at line 118 of file CIBasedLearning.cpp.
References ucPriority_.
Referenced by ~CIBasedLearning().
|
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(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().
|
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(), history(), and nbrIterations().
|
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(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, LazyPropagation< GUM_SCALAR > >::disableMaxIter().
| CIBasedLearning::UCPriority gum::learning::CIBasedLearning::ucPriority | ( | ) | const |
maximum conditioning set size; Size(-1) = unlimited (default)
Definition at line 120 of file CIBasedLearning.cpp.
References ucPriority_.
Referenced by ~CIBasedLearning().
|
protectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 301 of file ConstraintBasedLearning.cpp.
Referenced by gum::learning::FCI::orientCollidersOnPAG_(), and gum::learning::CIBasedLearning::orientUnshieldedColliders_().
|
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::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_().
|
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(), and continueApproximationScheme().
|
protectedinherited |
Definition at line 201 of file ConstraintBasedLearning.h.
Referenced by gum::learning::Miic::initiation_(), and gum::learning::CIBasedLearning::learnSkeleton().
|
protectedinherited |
Definition at line 196 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), applyStructuralConstraints_(), isForbiddenArc_(), isForbiddenEdge_(), operator=(), operator=(), gum::learning::Miic::orientationMiic_(), and setForbiddenGraph().
|
protectedinherited |
Definition at line 198 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), addConstraints(), operator=(), operator=(), and gum::learning::Miic::orientationMiic_().
|
protectedinherited |
Definition at line 199 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), gum::learning::Miic::_isNotLatentCouple_(), gum::learning::Miic::_orientingVstructureMiic_(), gum::learning::Miic::_propagatingOrientationMiic_(), latentVariables(), gum::learning::Miic::learnMixedStructure(), gum::learning::FCI::learnPAG(), gum::learning::Miic::learnSkeleton(), operator=(), operator=(), gum::learning::Miic::orientationMiic_(), gum::learning::CIBasedLearning::orientUnshieldedColliders_(), and gum::learning::CIBasedLearning::resolveOrientConflict_().
|
protectedinherited |
Definition at line 197 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), applyStructuralConstraints_(), operator=(), operator=(), gum::learning::Miic::orientationMiic_(), and setMandatoryGraph().
|
privateinherited |
Definition at line 204 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), isMaxIndegree_(), operator=(), operator=(), and setMaxIndegree().
|
protectedinherited |
Definition at line 200 of file ConstraintBasedLearning.h.
Referenced by ConstraintBasedLearning(), ConstraintBasedLearning(), ConstraintBasedLearning(), ConstraintBasedLearning(), gum::learning::Miic::findBestContributor_(), operator=(), and operator=().
|
protected |
Definition at line 181 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), alpha(), gum::learning::FCI::doDdpOrientation_(), learnSkeleton(), operator=(), operator=(), gum::learning::FCI::possibleDSepPhase_(), and setAlpha().
|
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 |
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 |
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().
|
protected |
Definition at line 184 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), exhaustiveSepSet(), learnSkeleton(), operator=(), operator=(), and setExhaustiveSepSet().
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 396 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
protectedinherited |
Last epsilon value.
Definition at line 381 of file approximationScheme.h.
Referenced by continueApproximationScheme().
|
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().
Definition at line 182 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), learnSkeleton(), operator=(), operator=(), gum::learning::FCI::possibleDSepPhase_(), and setMaxCondSetSize().
|
protectedinherited |
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural constraints. Every constraint-based skeleton phase must start from this graph so forbidden pairs are never tested by CI.
Definition at line 176 of file ConstraintBasedLearning.h.
Referenced by learnDAG(), gum::learning::Miic::learnMixedStructure(), and learnPDAG().
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 405 of file approximationScheme.h.
Referenced by ApproximationScheme(), continueApproximationScheme(), minEpsilonRate(), and setMinEpsilonRate().
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().
|
inherited |
Definition at line 145 of file ConstraintBasedLearning.h.
|
protectedinherited |
Checking criteria frequency.
Definition at line 426 of file approximationScheme.h.
Referenced by ApproximationScheme(), and periodSize().
|
protected |
Definition at line 187 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), gum::learning::FCI::doDdpOrientation_(), learnSkeleton(), operator=(), operator=(), gum::learning::FCI::orientCollidersOnPAG_(), orientUnshieldedColliders_(), gum::learning::FCI::possibleDSepPhase_(), and gum::learning::FCI::ruleR3_().
|
protected |
Definition at line 183 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), learnSkeleton(), operator=(), operator=(), and setStable().
|
protected |
Definition at line 180 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), gum::learning::FCI::doDdpOrientation_(), learnSkeleton(), operator=(), operator=(), gum::learning::FCI::possibleDSepPhase_(), and setIndependenceTest().
|
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_().
|
protected |
Definition at line 185 of file CIBasedLearning.h.
Referenced by CIBasedLearning(), operator=(), operator=(), gum::learning::FCI::orientCollidersOnPAG_(), orientUnshieldedColliders_(), setUCPriority(), and ucPriority().
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 429 of file approximationScheme.h.
Referenced by ApproximationScheme(), setVerbosity(), and verbosity().