aGrUM 3.3.2
a C++ library for (probabilistic) graphical models
gum::learning::Miic Class Reference

The MIIC learning algorithm. More...

#include <Miic.h>

Inheritance diagram for gum::learning::Miic:
[legend]
Collaboration diagram for gum::learning::Miic:
[legend]

Public Types

enum class  ApproximationSchemeSTATE : char {
  Undefined , Continue , Epsilon , Rate ,
  Limit , TimeLimit , Stopped
}
 The different state of an approximation scheme. More...

Public Member Functions

Miic & operator= (const Miic &from)
Miic & operator= (Miic &&from)
Constructors / Destructors
 Miic ()
 Miic (int maxLog)
 Miic (const Miic &from)
 Miic (Miic &&from)
 ~Miic () override
Scorer injection
void setMutualInformation (CorrectedMutualInformation &mi)
ConstraintBasedLearning interface
MixedGraph learnSkeleton (MixedGraph graph) override
MixedGraph learnMixedStructure (MixedGraph graph) override
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

void setFromConfiguration_ (const std::string &section, bool withMaxTime, bool withVerbosity=true)
 Set the parameters of the scheme from a section of gum::Configuration.
MIIC skeleton learning phases
void initiation_ (CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
void iteration_ (CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
MIIC orientation phase
void orientationMiic_ (CorrectedMutualInformation &mutualInformation, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
void findBestContributor_ (NodeId x, NodeId y, const std::vector< NodeId > &ui, const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, Heap< CondRanking, GreaterPairOn2nd > &rank)
std::vector< ProbabilisticRanking > unshieldedTriplesMiic_ (const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, HashTable< std::pair< NodeId, NodeId >, char > &marks)
std::vector< ProbabilisticRanking > updateProbaTriples_ (const MixedGraph &graph, std::vector< ProbabilisticRanking > probaTriples)
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)

Static Protected Member Functions

static Size sizeFromConfiguration_ (const std::string &section, const std::string &key)
 Read a non negative integer key of gum::Configuration.

Protected Attributes

double current_epsilon_ {-1.}
 Current epsilon.
double last_epsilon_ {-1.}
 Last epsilon value.
double current_rate_ {-1.}
 Current rate.
Size current_step_ {0}
 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 Member Functions

void _orientingVstructureMiic_ (MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
void _propagatingOrientationMiic_ (MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
bool _isNotLatentCouple_ (NodeId x, NodeId y)
void stopScheme_ (ApproximationSchemeSTATE new_state)
 Stop the scheme given a new state.

Private Attributes

CorrectedMutualInformation * mi_ {nullptr}
ArcProperty< double > _arcProbas_

Common state (accessible to subclasses)

gum::Size _maxIndegree_ {std::numeric_limits< gum::Size >::max()}
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_

Graph utilities

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.
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.
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.

Detailed Description

The MIIC learning algorithm.

Implements learnSkeleton() and learnMixedStructure() from the ConstraintBasedLearning interface using the MIIC algorithm: https://doi.org/10.1371/journal.pcbi.1005662

Definition at line 100 of file Miic.h.

Member Enumeration Documentation

◆ ApproximationSchemeSTATE

The different state of an approximation scheme.

Enumerator
Undefined 
Continue 
Epsilon 
Rate 
Limit 
TimeLimit 
Stopped 

Definition at line 87 of file IApproximationSchemeConfiguration.h.

87 : char {
88 Undefined,
89 Continue,
90 Epsilon,
91 Rate,
92 Limit,
93 TimeLimit,
94 Stopped
95 };

Constructor & Destructor Documentation

◆ Miic() [1/4]

gum::learning::Miic::Miic ( )

Definition at line 65 of file Miic.cpp.

References gum::learning::ConstraintBasedLearning::ConstraintBasedLearning(), and Miic().

Referenced by Miic(), Miic(), Miic(), Miic(), ~Miic(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Miic() [2/4]

gum::learning::Miic::Miic ( int maxLog)
explicit

Definition at line 67 of file Miic.cpp.

67: ConstraintBasedLearning(maxLog) { GUM_CONSTRUCTOR(Miic); }

References gum::learning::ConstraintBasedLearning::ConstraintBasedLearning(), and Miic().

Here is the call graph for this function:

◆ Miic() [3/4]

gum::learning::Miic::Miic ( const Miic & from)

Definition at line 69 of file Miic.cpp.

69: ConstraintBasedLearning(from) { GUM_CONS_CPY(Miic); }

References gum::learning::ConstraintBasedLearning::ConstraintBasedLearning(), and Miic().

Here is the call graph for this function:

◆ Miic() [4/4]

gum::learning::Miic::Miic ( Miic && from)

Definition at line 71 of file Miic.cpp.

71: ConstraintBasedLearning(std::move(from)) { GUM_CONS_MOV(Miic); }

References gum::learning::ConstraintBasedLearning::ConstraintBasedLearning(), and Miic().

Here is the call graph for this function:

◆ ~Miic()

gum::learning::Miic::~Miic ( )
override

Definition at line 73 of file Miic.cpp.

73{ GUM_DESTRUCTOR(Miic); }

References Miic().

Here is the call graph for this function:

Member Function Documentation

◆ _existsDirectedPath_()

bool gum::learning::ConstraintBasedLearning::_existsDirectedPath_ ( const MixedGraph & graph,
NodeId n1,
NodeId n2 )
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.

182 {
183 List< NodeId > nodeFIFO;
184 Set< NodeId > mark;
185
186 mark.insert(n2);
187 nodeFIFO.pushBack(n2);
188
189 NodeId current;
190 while (!nodeFIFO.empty()) {
191 current = nodeFIFO.front();
192 nodeFIFO.popFront();
193 for (const auto new_one: graph.parents(current)) {
194 if (graph.existsArc(current, new_one)) continue; // double arc — skip
195 if (new_one == n1) return true;
196 if (mark.exists(new_one)) continue;
197 mark.insert(new_one);
198 nodeFIFO.pushBack(new_one);
199 }
200 }
201 return false;
202 }
Size NodeId
Type for node ids.

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_(), learnMixedStructure(), gum::learning::Miic::orientationMiic_(), gum::learning::CIBasedLearning::orientColliderArm_(), and orientDoubleHeadedArcs_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _existsNonTrivialDirectedPath_()

bool gum::learning::ConstraintBasedLearning::_existsNonTrivialDirectedPath_ ( const MixedGraph & graph,
NodeId n1,
NodeId n2 )
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.

171 {
172 for (const auto parent: graph.parents(n2)) {
173 if (graph.existsArc(n2, parent)) continue; // double arc — skip
174 if (parent == n1) continue; // trivial path — not counted
175 if (_existsDirectedPath_(graph, n1, parent)) return true;
176 }
177 return false;
178 }
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 cons...

References _existsDirectedPath_().

Referenced by gum::learning::Miic::_orientingVstructureMiic_(), and learnMixedStructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _isNotLatentCouple_()

bool gum::learning::Miic::_isNotLatentCouple_ ( NodeId x,
NodeId y )
private

Definition at line 674 of file Miic.cpp.

674 {
675 const auto& lbeg = _latentCouples_.begin();
676 const auto& lend = _latentCouples_.end();
677 return (std::find(lbeg, lend, Arc(x, y)) == lend)
678 && (std::find(lbeg, lend, Arc(y, x)) == lend);
679 }
Arc(NodeId tail, NodeId head)
basic constructor. Creates tail -> head.

References gum::Arc::Arc(), and gum::learning::ConstraintBasedLearning::_latentCouples_.

Referenced by _orientingVstructureMiic_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _orientingVstructureMiic_()

void gum::learning::Miic::_orientingVstructureMiic_ ( MixedGraph & graph,
HashTable< std::pair< NodeId, NodeId >, char > & marks,
NodeId x,
NodeId y,
NodeId z,
double p1,
double p2 )
private

Definition at line 331 of file Miic.cpp.

337 {
338 if (marks[{x, z}] == 'o' && marks[{y, z}] == 'o') {
339 if (!_existsNonTrivialDirectedPath_(graph, z, x)) {
340 if (isArcValid_(graph, x, z)) {
341 graph.eraseEdge(Edge(x, z));
342 graph.addArc(x, z);
343 GUM_SL_EMIT(x, z, "Add Arc " << x << " -> " << z, "V-structure Orientation")
344 marks[{x, z}] = '>';
345 if (graph.existsArc(z, x) && _isNotLatentCouple_(z, x)) {
346 _latentCouples_.emplace_back(z, x);
347 }
348 if (!_arcProbas_.exists(Arc(x, z))) _arcProbas_.insert(Arc(x, z), p1);
349 }
350 } else {
351 graph.eraseEdge(Edge(x, z));
352 if (!_existsNonTrivialDirectedPath_(graph, x, z)) {
353 if (isArcValid_(graph, z, x)) {
354 graph.addArc(z, x);
355 GUM_SL_EMIT(z, x, "Add Arc " << z << " -> " << x, "V-structure Orientation")
356 marks[{z, x}] = '>';
357 }
358 }
359 }
360
361 if (!_existsNonTrivialDirectedPath_(graph, z, y)) {
362 if (isArcValid_(graph, y, z)) {
363 graph.eraseEdge(Edge(y, z));
364 graph.addArc(y, z);
365 GUM_SL_EMIT(y, z, "Add Arc " << y << " -> " << z, "V-structure Orientation")
366 marks[{y, z}] = '>';
367 if (graph.existsArc(z, y) && _isNotLatentCouple_(z, y)) {
368 _latentCouples_.emplace_back(z, y);
369 }
370 if (!_arcProbas_.exists(Arc(y, z))) _arcProbas_.insert(Arc(y, z), p2);
371 }
372 } else {
373 graph.eraseEdge(Edge(y, z));
374 if (!_existsNonTrivialDirectedPath_(graph, y, z)) {
375 if (isArcValid_(graph, z, y)) {
376 graph.addArc(z, y);
377 GUM_SL_EMIT(z, y, "Add Arc " << z << " -> " << y, "V-structure Orientation")
378 marks[{z, y}] = '>';
379 }
380 }
381 }
382 } else if (marks[{x, z}] == '>' && marks[{y, z}] == 'o') {
383 if (!_existsNonTrivialDirectedPath_(graph, z, y)) {
384 if (isArcValid_(graph, y, z)) {
385 graph.eraseEdge(Edge(y, z));
386 graph.addArc(y, z);
387 GUM_SL_EMIT(y,
388 z,
389 "Add Arc " << y << " -> " << z,
390 "V-structure Orientation | existing "
391 << x << " -> " << z << ", then orienting " << y << " -> " << z)
392 marks[{y, z}] = '>';
393 if (graph.existsArc(z, y) && _isNotLatentCouple_(z, y)) {
394 _latentCouples_.emplace_back(z, y);
395 }
396 if (!_arcProbas_.exists(Arc(y, z))) _arcProbas_.insert(Arc(y, z), p2);
397 }
398 } else {
399 graph.eraseEdge(Edge(y, z));
400 if (!_existsNonTrivialDirectedPath_(graph, y, z)) {
401 if (isArcValid_(graph, z, y)) {
402 graph.addArc(z, y);
403 GUM_SL_EMIT(z,
404 y,
405 "Add Arc " << z << " -> " << y,
406 "V-structure Orientation | existing "
407 << x << " -> " << z << ", then orienting " << z << " -> " << y)
408 marks[{z, y}] = '>';
409 }
410 }
411 }
412 } else if (marks[{y, z}] == '>' && marks[{x, z}] == 'o') {
413 if (!_existsNonTrivialDirectedPath_(graph, z, x)) {
414 if (isArcValid_(graph, x, z)) {
415 graph.eraseEdge(Edge(x, z));
416 graph.addArc(x, z);
417 GUM_SL_EMIT(x, z, "Add Arc " << x << " -> " << z, "V-structure Orientation")
418 marks[{x, z}] = '>';
419 if (graph.existsArc(z, x) && _isNotLatentCouple_(z, x)) {
420 _latentCouples_.emplace_back(z, x);
421 }
422 if (!_arcProbas_.exists(Arc(x, z))) _arcProbas_.insert(Arc(x, z), p1);
423 }
424 } else {
425 graph.eraseEdge(Edge(x, z));
426 if (!_existsNonTrivialDirectedPath_(graph, x, z)) {
427 if (isArcValid_(graph, z, x)) {
428 graph.addArc(z, x);
429 GUM_SL_EMIT(z, x, "Add Arc " << z << " -> " << x, "V-structure Orientation")
430 marks[{z, x}] = '>';
431 }
432 }
433 }
434 }
435 }
#define GUM_SL_EMIT(x, y, action, explain)
Edge(NodeId aN1, NodeId aN2)
constructs a new edge (aN1,aN2)
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 cons...
bool isArcValid_(const MixedGraph &graph, NodeId x, NodeId y)
ArcProperty< double > _arcProbas_
Definition Miic.h:187
bool _isNotLatentCouple_(NodeId x, NodeId y)
Definition Miic.cpp:674

References gum::Arc::Arc(), gum::Edge::Edge(), _arcProbas_, gum::learning::ConstraintBasedLearning::_existsNonTrivialDirectedPath_(), _isNotLatentCouple_(), gum::learning::ConstraintBasedLearning::_latentCouples_, GUM_SL_EMIT, and gum::learning::ConstraintBasedLearning::isArcValid_().

Referenced by orientationMiic_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _propagatingOrientationMiic_()

void gum::learning::Miic::_propagatingOrientationMiic_ ( MixedGraph & graph,
HashTable< std::pair< NodeId, NodeId >, char > & marks,
NodeId x,
NodeId y,
NodeId z,
double p1,
double p2 )
private

Definition at line 441 of file Miic.cpp.

447 {
448 if (marks[{x, z}] == '>' && marks[{y, z}] == 'o' && marks[{z, y}] != '-') {
449 graph.eraseEdge(Edge(z, y));
450 if (!_existsDirectedPath_(graph, y, z) && graph.parents(y).empty()) {
451 if (isArcValid_(graph, z, y)) {
452 graph.addArc(z, y);
453 GUM_SL_EMIT(z,
454 y,
455 "Add Arc " << z << " -> " << y,
456 "Propagation MIIC (919) | existing x -> " << z << " and " << z << " - "
457 << y)
458 marks[{z, y}] = '>';
459 marks[{y, z}] = '-';
460 if (!_arcProbas_.exists(Arc(z, y))) _arcProbas_.insert(Arc(z, y), p2);
461 }
462 } else if (!_existsDirectedPath_(graph, z, y) && graph.parents(z).empty()) {
463 if (isArcValid_(graph, y, z)) {
464 graph.addArc(y, z);
465 GUM_SL_EMIT(y, z, "Add Arc " << y << " -> " << z, "Propagation MIIC line 932 ")
466 marks[{z, y}] = '-';
467 marks[{y, z}] = '>';
468 _latentCouples_.emplace_back(y, z);
469 if (!_arcProbas_.exists(Arc(y, z))) _arcProbas_.insert(Arc(y, z), p2);
470 }
471 } else if (!_existsDirectedPath_(graph, y, z)) {
472 if (isArcValid_(graph, z, y)) {
473 graph.addArc(z, y);
474 GUM_SL_EMIT(z, y, "Add Arc " << z << "->" << y, "Propagation MIIC 947 ")
475 marks[{z, y}] = '>';
476 marks[{y, z}] = '-';
477 if (!_arcProbas_.exists(Arc(z, y))) _arcProbas_.insert(Arc(z, y), p2);
478 }
479 } else if (!_existsDirectedPath_(graph, z, y)) {
480 if (isArcValid_(graph, y, z)) {
481 graph.addArc(y, z);
482 GUM_SL_EMIT(z, y, "Add Arc " << z << "->" << y, "Propagation MIIC 959")
483 _latentCouples_.emplace_back(y, z);
484 marks[{z, y}] = '-';
485 marks[{y, z}] = '>';
486 if (!_arcProbas_.exists(Arc(y, z))) _arcProbas_.insert(Arc(y, z), p2);
487 }
488 }
489 } else if (marks[{y, z}] == '>' && marks[{x, z}] == 'o' && marks[{z, x}] != '-') {
490 graph.eraseEdge(Edge(z, x));
491 if (!_existsDirectedPath_(graph, x, z) && graph.parents(x).empty()) {
492 if (isArcValid_(graph, z, x)) {
493 graph.addArc(z, x);
494 GUM_SL_EMIT(z, x, "Add Arc " << z << " -> " << x, "Propagation MIIC 977")
495 marks[{z, x}] = '>';
496 marks[{x, z}] = '-';
497 if (!_arcProbas_.exists(Arc(z, x))) _arcProbas_.insert(Arc(z, x), p1);
498 }
499 } else if (!_existsDirectedPath_(graph, z, x) && graph.parents(z).empty()) {
500 if (isArcValid_(graph, x, z)) {
501 graph.addArc(x, z);
502 GUM_SL_EMIT(x, z, "Add Arc " << x << "->" << z, "Propagation MIIC 990")
503 marks[{z, x}] = '-';
504 marks[{x, z}] = '>';
505 _latentCouples_.emplace_back(x, z);
506 if (!_arcProbas_.exists(Arc(x, z))) _arcProbas_.insert(Arc(x, z), p1);
507 }
508 } else if (!_existsDirectedPath_(graph, x, z)) {
509 if (isArcValid_(graph, z, x)) {
510 graph.addArc(z, x);
511 GUM_SL_EMIT(z, x, "Add Arc " << z << " -> " << x, "Propagation MIIC 1004")
512 marks[{z, x}] = '>';
513 marks[{x, z}] = '-';
514 if (!_arcProbas_.exists(Arc(z, x))) _arcProbas_.insert(Arc(z, x), p1);
515 }
516 } else if (!_existsDirectedPath_(graph, z, x)) {
517 if (isArcValid_(graph, x, z)) {
518 graph.addArc(x, z);
519 GUM_SL_EMIT(x, z, "Add Arc " << x << " -> " << z, "Propagation MIIC 1016")
520 marks[{z, x}] = '-';
521 marks[{x, z}] = '>';
522 _latentCouples_.emplace_back(x, z);
523 if (!_arcProbas_.exists(Arc(x, z))) _arcProbas_.insert(Arc(x, z), p1);
524 }
525 }
526 }
527 }

References gum::Arc::Arc(), gum::Edge::Edge(), _arcProbas_, gum::learning::ConstraintBasedLearning::_existsDirectedPath_(), gum::learning::ConstraintBasedLearning::_latentCouples_, GUM_SL_EMIT, and gum::learning::ConstraintBasedLearning::isArcValid_().

Referenced by orientationMiic_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addConstraints()

void gum::learning::ConstraintBasedLearning::addConstraints ( const HashTable< std::pair< NodeId, NodeId >, char > & constraints)
inherited

Definition at line 124 of file ConstraintBasedLearning.cpp.

125 {
126 _initialMarks_ = constraints;
127 }
HashTable< std::pair< NodeId, NodeId >, char > _initialMarks_

References _initialMarks_.

Referenced by gum::learning::IBNLearner::prepareMiic_().

Here is the caller graph for this function:

◆ applyStructuralConstraints_()

void gum::learning::ConstraintBasedLearning::applyStructuralConstraints_ ( MixedGraph & graph)
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.

250 {
251 for (const auto& arc: _mandatoryGraph_.arcs()) {
252 if (graph.existsEdge(arc.head(), arc.tail())) graph.eraseEdge(Edge(arc.head(), arc.tail()));
253 if (!graph.existsArc(arc.tail(), arc.head())) {
254 GUM_SL_EMIT(arc.tail(),
255 arc.head(),
256 "Add Arc" << arc.tail() << "->" << arc.head(),
257 "Mandatory")
258 graph.addArc(arc.tail(), arc.head());
259 }
260 }
261 for (const Arc& arc: _forbiddenGraph_.arcs()) {
262 if (graph.existsEdge(Edge(arc.tail(), arc.head()))) {
263 graph.eraseEdge(Edge(arc.tail(), arc.head()));
264 graph.addArc(arc.head(), arc.tail());
265 GUM_SL_EMIT(arc.head(),
266 arc.tail(),
267 "Add Arc" << arc.head() << "->" << arc.tail(),
268 "Forbidden in the other orientation")
269 }
270 }
271 }
const ArcSet & arcs() const
returns the set of arcs stored within the ArcGraphPart

References gum::Edge::Edge(), _forbiddenGraph_, _mandatoryGraph_, gum::ArcGraphPart::arcs(), and GUM_SL_EMIT.

Referenced by learnMixedStructure(), gum::learning::PC::learnMixedStructure(), gum::learning::FCI::learnPAG(), and gum::learning::Miic::orientationMiic_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ continueApproximationScheme()

bool gum::ApproximationScheme::continueApproximationScheme ( double error)
inherited

Update the scheme w.r.t the new error.

Test the stopping criterion that are enabled.

Parameters
errorThe new error value.
Returns
false if state become != ApproximationSchemeSTATE::Continue
Exceptions
OperationNotAllowedRaised if state != ApproximationSchemeSTATE::Continue.

Definition at line 107 of file approximationScheme.cpp.

107 {
108 // For coherence, we fix the time used in the method
109
110 double timer_step = timer_.step();
111
112 if (enabled_max_time_) {
113 if (timer_step > max_time_) {
115 return false;
116 }
117 }
118
119 if (!startOfPeriod()) { return true; }
120
122 GUM_ERROR(
123 OperationNotAllowed,
124 "state of the approximation scheme is not correct : " << messageApproximationScheme());
125 }
126
127 if (verbosity()) { history_.push_back(error); }
128
129 if (enabled_max_iter_) {
130 if (current_step_ >= max_iter_) {
132 return false;
133 }
134 }
135
137 current_epsilon_ = error; // eps rate isEnabled needs it so affectation was
138 // moved from eps isEnabled below
139
140 if (enabled_eps_) {
141 if (current_epsilon_ <= eps_) {
143 return false;
144 }
145 }
146
147 if (last_epsilon_ >= 0.) {
148 if (current_epsilon_ > .0) {
149 // ! current_epsilon_ can be 0. AND epsilon
150 // isEnabled can be disabled !
152 }
153 // limit with current eps ---> 0 is | 1 - ( last_eps / 0 ) | --->
154 // infinity the else means a return false if we isEnabled the rate below,
155 // as we would have returned false if epsilon isEnabled was enabled
156 else {
158 }
159
163 return false;
164 }
165 }
166 }
167
169 if (onProgress.hasListener()) {
171 }
172
173 return true;
174 } else {
175 return false;
176 }
177 }
Size current_step_
The current step.
double current_epsilon_
Current epsilon.
double last_epsilon_
Last epsilon value.
double eps_
Threshold for convergence.
bool enabled_max_time_
If true, the timeout is enabled.
Size max_iter_
The maximum iterations.
bool enabled_eps_
If true, the threshold convergence is enabled.
ApproximationSchemeSTATE current_state_
The current state.
double min_rate_eps_
Threshold for the epsilon rate.
std::vector< double > history_
The scheme history, used only if verbosity == true.
double current_rate_
Current rate.
ApproximationSchemeSTATE stateApproximationScheme() const override
Returns the approximation scheme state.
bool startOfPeriod() const
Returns true if we are at the beginning of a period (compute error is mandatory).
bool enabled_max_iter_
If true, the maximum iterations stopping criterion is enabled.
void stopScheme_(ApproximationSchemeSTATE new_state)
Stop the scheme given a new state.
bool verbosity() const override
Returns true if verbosity is enabled.
bool enabled_min_rate_eps_
If true, the minimal threshold for epsilon rate is enabled.
Signaler< Size, double, double > onProgress
Progression, error and time.
std::string messageApproximationScheme() const
Returns the approximation scheme message.
double step() const
Returns the delta time between now and the last reset() call (or the constructor).
Definition timer_inl.h:72
#define GUM_ERROR(type, msg)
Definition exceptions.h:76
#define GUM_EMIT3(signal, arg1, arg2, arg3)
Definition signaler.h:291

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_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ currentTime()

INLINE double gum::ApproximationScheme::currentTime ( ) const
overridevirtualinherited

Returns the current running time in second.

Returns
Returns the current running time in second.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 137 of file approximationScheme_inl.h.

137{ return timer_.step(); }

References gum::Timer::step(), and timer_.

Referenced by gum::learning::IBNLearner::currentTime(), and gum::learning::IBNLearner::EMCurrentTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ disableEpsilon()

INLINE void gum::ApproximationScheme::disableEpsilon ( )
overridevirtualinherited

Disable stopping criterion on epsilon.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 75 of file approximationScheme_inl.h.

75{ enabled_eps_ = false; }

References enabled_eps_.

Referenced by gum::learning::EMApproximationScheme::EMApproximationScheme(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::learning::IBNLearner::disableEpsilon(), gum::learning::IBNLearner::EMdisableEpsilon(), gum::SamplingInference< GUM_SCALAR >::loopApproxInference_(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().

Here is the caller graph for this function:

◆ disableMaxIter()

INLINE void gum::ApproximationScheme::disableMaxIter ( )
overridevirtualinherited

Disable stopping criterion on max iterations.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 116 of file approximationScheme_inl.h.

116{ enabled_max_iter_ = false; }

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().

Here is the caller graph for this function:

◆ disableMaxTime()

INLINE void gum::ApproximationScheme::disableMaxTime ( )
overridevirtualinherited

Disable stopping criterion on timeout.

Returns
Disable stopping criterion on timeout.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 140 of file approximationScheme_inl.h.

140{ enabled_max_time_ = false; }

References enabled_max_time_.

Referenced by ApproximationScheme(), gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::learning::LocalSearchWithTabuList::LocalSearchWithTabuList(), gum::learning::IBNLearner::disableMaxTime(), and gum::learning::IBNLearner::EMdisableMaxTime().

Here is the caller graph for this function:

◆ disableMinEpsilonRate()

◆ enableEpsilon()

INLINE void gum::ApproximationScheme::enableEpsilon ( )
overridevirtualinherited

Enable stopping criterion on epsilon.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 78 of file approximationScheme_inl.h.

78{ enabled_eps_ = true; }

References enabled_eps_.

Referenced by gum::learning::IBNLearner::EMenableEpsilon(), gum::learning::IBNLearner::enableEpsilon(), and gum::SamplingInference< GUM_SCALAR >::loopApproxInference_().

Here is the caller graph for this function:

◆ enableMaxIter()

INLINE void gum::ApproximationScheme::enableMaxIter ( )
overridevirtualinherited

Enable stopping criterion on max iterations.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 119 of file approximationScheme_inl.h.

119{ enabled_max_iter_ = true; }

References enabled_max_iter_.

Referenced by gum::learning::IBNLearner::EMenableMaxIter(), and gum::learning::IBNLearner::enableMaxIter().

Here is the caller graph for this function:

◆ enableMaxTime()

INLINE void gum::ApproximationScheme::enableMaxTime ( )
overridevirtualinherited

Enable stopping criterion on timeout.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 143 of file approximationScheme_inl.h.

143{ enabled_max_time_ = true; }

References enabled_max_time_.

Referenced by gum::learning::IBNLearner::EMenableMaxTime(), and gum::learning::IBNLearner::enableMaxTime().

Here is the caller graph for this function:

◆ enableMinEpsilonRate()

INLINE void gum::ApproximationScheme::enableMinEpsilonRate ( )
overridevirtualinherited

Enable stopping criterion on epsilon rate.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 99 of file approximationScheme_inl.h.

99{ enabled_min_rate_eps_ = true; }

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(), gum::learning::IBNLearner::enableMinEpsilonRate(), and gum::SamplingInference< GUM_SCALAR >::loopApproxInference_().

Here is the caller graph for this function:

◆ epsilon()

INLINE double gum::ApproximationScheme::epsilon ( ) const
overridevirtualinherited

◆ findBestContributor_()

void gum::learning::Miic::findBestContributor_ ( NodeId x,
NodeId y,
const std::vector< NodeId > & ui,
const MixedGraph & graph,
CorrectedMutualInformation & mutualInformation,
Heap< CondRanking, GreaterPairOn2nd > & rank )
protected

Definition at line 533 of file Miic.cpp.

538 {
539 double maxP = -1.0;
540 NodeId maxZ = 0;
541
542 const double Ixy_ui = mutualInformation.score(x, y, ui);
543
544 for (const NodeId z: graph) {
545 if (z != x && z != y && std::find(ui.begin(), ui.end(), z) == ui.end()) {
546 double Pnv;
547 double Pb;
548
549 const double Ixyz_ui = mutualInformation.score(x, y, z, ui);
550 double calc_expo1 = -Ixyz_ui * M_LN2;
551 if (calc_expo1 > _maxLog_) {
552 Pnv = 0.0;
553 } else if (calc_expo1 < -_maxLog_) {
554 Pnv = 1.0;
555 } else {
556 Pnv = 1 / (1 + std::exp(calc_expo1));
557 }
558
559 const double Ixz_ui = mutualInformation.score(x, z, ui);
560 const double Iyz_ui = mutualInformation.score(y, z, ui);
561
562 calc_expo1 = -(Ixz_ui - Ixy_ui) * M_LN2;
563 double calc_expo2 = -(Iyz_ui - Ixy_ui) * M_LN2;
564
565 if (calc_expo1 > _maxLog_ || calc_expo2 > _maxLog_) {
566 Pb = 0.0;
567 } else if (calc_expo1 < -_maxLog_ && calc_expo2 < -_maxLog_) {
568 Pb = 1.0;
569 } else {
570 double expo1, expo2;
571 expo1 = (calc_expo1 < -_maxLog_) ? 0.0 : std::exp(calc_expo1);
572 expo2 = (calc_expo2 < -_maxLog_) ? 0.0 : std::exp(calc_expo2);
573 Pb = 1 / (1 + expo1 + expo2);
574 }
575
576 const double min_pnv_pb = std::min(Pnv, Pb);
577 if (min_pnv_pb > maxP) {
578 maxP = min_pnv_pb;
579 maxZ = z;
580 }
581 }
582 }
583 CondRanking final;
584 auto tup = new CondThreePoints{x, y, maxZ, ui};
585 final.first = tup;
586 final.second = maxP;
587 rank.insert(final);
588 }
#define M_LN2
Definition math_utils.h:65
std::pair< CondThreePoints *, double > CondRanking
Definition Miic.h:71
std::tuple< NodeId, NodeId, NodeId, std::vector< NodeId > > CondThreePoints
Definition Miic.h:70

References gum::learning::ConstraintBasedLearning::_maxLog_, gum::Heap< Val, Cmp >::insert(), M_LN2, and gum::learning::CorrectedMutualInformation::score().

Referenced by initiation_(), and iteration_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ history()

INLINE const std::vector< double > & gum::ApproximationScheme::history ( ) const
overridevirtualinherited

Returns the scheme history.

Returns
Returns the scheme history.
Exceptions
OperationNotAllowedRaised 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.

179 {
181 GUM_ERROR(OperationNotAllowed, "state of the approximation scheme is udefined")
182 }
183
184 if (!verbosity()) GUM_ERROR(OperationNotAllowed, "No history when verbosity=false")
185
186 return history_;
187 }

References GUM_ERROR, history_, stateApproximationScheme(), gum::IApproximationSchemeConfiguration::Undefined, and verbosity().

Referenced by gum::learning::IBNLearner::EMHistory(), and gum::learning::IBNLearner::history().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initApproximationScheme()

INLINE void gum::ApproximationScheme::initApproximationScheme ( )
inherited

Initialise the scheme.

Definition at line 190 of file approximationScheme_inl.h.

190 {
192 current_step_ = 0;
194 history_.clear();
195 timer_.reset();
196 }
void reset()
Reset the timer.
Definition timer_inl.h:53

References gum::IApproximationSchemeConfiguration::Continue, current_epsilon_, current_rate_, current_state_, current_step_, history_, gum::Timer::reset(), and timer_.

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 >::makeInference(), and gum::SamplingInference< GUM_SCALAR >::onStateChanged_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initGraph_()

MixedGraph gum::learning::ConstraintBasedLearning::initGraph_ ( const MixedGraph & template_graph)
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.

273 {
274 MixedGraph graph;
275 for (NodeId n: template_graph.nodes())
276 graph.addNodeWithId(n);
277
278 auto addEdgeIfAllowed = [&](NodeId x, NodeId y) {
279 if (x > y) std::swap(x, y);
280 if (isForbiddenEdge_(x, y))
281 GUM_SL_EMIT(x, y, "Remove " << x << " - " << y, "Constraints : Forbidden edge")
282 else graph.addEdge(x, y);
283 };
284
285 if (template_graph.edges().empty()) {
286 // node-only template: constraint-based learning always starts from complete graph
287 const std::vector< NodeId > nodes(template_graph.nodes().begin(),
288 template_graph.nodes().end());
289 for (std::size_t i = 0; i < nodes.size(); ++i)
290 for (std::size_t j = i + 1; j < nodes.size(); ++j)
291 addEdgeIfAllowed(nodes[i], nodes[j]);
292 } else {
293 for (const auto& edge: template_graph.edges())
294 addEdgeIfAllowed(edge.first(), edge.second());
295 }
296
297 return graph;
298 }
bool isForbiddenEdge_(NodeId x, NodeId y) const

References gum::NodeGraphPart::begin(), gum::EdgeGraphPart::edges(), gum::Set< Key >::empty(), gum::NodeGraphPart::end(), GUM_SL_EMIT, isForbiddenEdge_(), and gum::NodeGraphPart::nodes().

Referenced by learnMixedStructure(), gum::learning::Miic::learnMixedStructure(), gum::learning::CIBasedLearning::learnSkeleton(), and gum::learning::Miic::learnSkeleton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initiation_()

void gum::learning::Miic::initiation_ ( CorrectedMutualInformation & mutualInformation,
MixedGraph & graph,
HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > & sepSet,
Heap< CondRanking, GreaterPairOn2nd > & rank )
protected

Definition at line 166 of file Miic.cpp.

169 {
170 NodeId x, y;
171 EdgeSet edges = graph.edges();
172 Size steps_init = edges.size();
173
174 for (const Edge& edge: edges) {
175 x = edge.first();
176 y = edge.second();
177
178 double Ixy = mutualInformation.score(x, y);
179
180 if (Ixy <= 0) {
181 graph.eraseEdge(edge);
182 GUM_SL_EMIT(x,
183 y,
184 "Remove " << x << " - " << y,
185 "Independent based on Mutual Information :" << Ixy)
186 sepSet.insert(std::make_pair(x, y), _emptySet_);
187 } else {
188 findBestContributor_(x, y, _emptySet_, graph, mutualInformation, rank);
189 GUM_SL_EMIT(x,
190 y,
191 "Keep " << x << " - " << y,
192 "Dependent based on Mutual Information :" << Ixy)
193 }
194
196 if (onProgress.hasListener()) {
197 GUM_EMIT3(onProgress, (current_step_ * 33) / steps_init, 0., timer_.step());
198 }
199 }
200 }
Size size() const noexcept
Returns the number of elements in the set.
Definition set_tpl.h:607
void findBestContributor_(NodeId x, NodeId y, const std::vector< NodeId > &ui, const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:533
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...

References gum::learning::ConstraintBasedLearning::_emptySet_, gum::ApproximationScheme::current_step_, findBestContributor_(), GUM_EMIT3, GUM_SL_EMIT, gum::__sig__::BasicSignaler< Args... >::hasListener(), gum::IApproximationSchemeConfiguration::onProgress, gum::learning::CorrectedMutualInformation::score(), gum::Set< Key >::size(), gum::Timer::step(), and gum::ApproximationScheme::timer_.

Referenced by learnMixedStructure(), and learnSkeleton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isArcValid_()

bool gum::learning::ConstraintBasedLearning::isArcValid_ ( const MixedGraph & graph,
NodeId x,
NodeId y )
protectedinherited

Definition at line 161 of file ConstraintBasedLearning.cpp.

161 {
162 return !isForbiddenArc_(x, y) && !isMaxIndegree_(graph, y);
163 }
bool isMaxIndegree_(const MixedGraph &graph, NodeId x)

References isForbiddenArc_(), and isMaxIndegree_().

Referenced by gum::learning::Miic::_orientingVstructureMiic_(), gum::learning::Miic::_propagatingOrientationMiic_(), and gum::learning::CIBasedLearning::orientColliderArm_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEnabledEpsilon()

INLINE bool gum::ApproximationScheme::isEnabledEpsilon ( ) const
overridevirtualinherited

Returns true if stopping criterion on epsilon is enabled, false otherwise.

Returns
Returns true if stopping criterion on epsilon is enabled, false otherwise.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 82 of file approximationScheme_inl.h.

82{ return enabled_eps_; }

References enabled_eps_.

Referenced by gum::learning::IBNLearner::EMisEnabledEpsilon(), gum::learning::IBNLearner::isEnabledEpsilon(), and gum::SamplingInference< GUM_SCALAR >::loopApproxInference_().

Here is the caller graph for this function:

◆ isEnabledMaxIter()

INLINE bool gum::ApproximationScheme::isEnabledMaxIter ( ) const
overridevirtualinherited

Returns true if stopping criterion on max iterations is enabled, false otherwise.

Returns
Returns true if stopping criterion on max iterations is enabled, false otherwise.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 123 of file approximationScheme_inl.h.

123{ return enabled_max_iter_; }

References enabled_max_iter_.

Referenced by gum::learning::IBNLearner::EMisEnabledMaxIter(), and gum::learning::IBNLearner::isEnabledMaxIter().

Here is the caller graph for this function:

◆ isEnabledMaxTime()

INLINE bool gum::ApproximationScheme::isEnabledMaxTime ( ) const
overridevirtualinherited

Returns true if stopping criterion on timeout is enabled, false otherwise.

Returns
Returns true if stopping criterion on timeout is enabled, false otherwise.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 147 of file approximationScheme_inl.h.

147{ return enabled_max_time_; }

References enabled_max_time_.

Referenced by gum::learning::IBNLearner::EMisEnabledMaxTime(), and gum::learning::IBNLearner::isEnabledMaxTime().

Here is the caller graph for this function:

◆ isEnabledMinEpsilonRate()

INLINE bool gum::ApproximationScheme::isEnabledMinEpsilonRate ( ) const
overridevirtualinherited

Returns true if stopping criterion on epsilon rate is enabled, false otherwise.

Returns
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 103 of file approximationScheme_inl.h.

103{ return enabled_min_rate_eps_; }

References enabled_min_rate_eps_.

Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::EMisEnabledMinEpsilonRate(), gum::learning::IBNLearner::isEnabledMinEpsilonRate(), and gum::SamplingInference< GUM_SCALAR >::loopApproxInference_().

Here is the caller graph for this function:

◆ isForbiddenArc_()

bool gum::learning::ConstraintBasedLearning::isForbiddenArc_ ( NodeId x,
NodeId y ) const
protectedinherited

Definition at line 149 of file ConstraintBasedLearning.cpp.

149 {
150 return _forbiddenGraph_.existsArc(x, y);
151 }
bool existsArc(const Arc &arc) const
indicates whether a given arc exists

References _forbiddenGraph_, and gum::ArcGraphPart::existsArc().

Referenced by gum::learning::FCI::doDdpOrientation_(), isArcValid_(), gum::learning::FCI::orientCollidersOnPAG_(), gum::learning::FCI::ruleR1_(), and gum::learning::FCI::ruleR2_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isForbiddenEdge_()

bool gum::learning::ConstraintBasedLearning::isForbiddenEdge_ ( NodeId x,
NodeId y ) const
protectedinherited

Definition at line 153 of file ConstraintBasedLearning.cpp.

153 {
155 }

References _forbiddenGraph_, and gum::ArcGraphPart::existsArc().

Referenced by initGraph_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isMaxIndegree_()

bool gum::learning::ConstraintBasedLearning::isMaxIndegree_ ( const MixedGraph & graph,
NodeId x )
protectedinherited

Definition at line 157 of file ConstraintBasedLearning.cpp.

157 {
158 return graph.parents(x).size() >= _maxIndegree_;
159 }

References _maxIndegree_.

Referenced by isArcValid_().

Here is the caller graph for this function:

◆ iteration_()

void gum::learning::Miic::iteration_ ( CorrectedMutualInformation & mutualInformation,
MixedGraph & graph,
HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > & sepSet,
Heap< CondRanking, GreaterPairOn2nd > & rank )
protected

Definition at line 206 of file Miic.cpp.

209 {
210 CondRanking best;
211 Size steps_init = current_step_;
212 Size steps_iter = rank.size();
213
214 try {
215 while (rank.top().second > 0.5) {
216 best = rank.pop();
217
218 const NodeId x = std::get< 0 >(*(best.first));
219 const NodeId y = std::get< 1 >(*(best.first));
220 const NodeId z = std::get< 2 >(*(best.first));
221 std::vector< NodeId > ui = std::move(std::get< 3 >(*(best.first)));
222
223 ui.push_back(z);
224 const double i_xy_ui = mutualInformation.score(x, y, ui);
225 if (i_xy_ui < 0) {
226 graph.eraseEdge(Edge(x, y));
227 GUM_SL_EMIT(x,
228 y,
229 "Remove " << x << " - " << y,
230 "Independent based on MutualInformation knowing Sep "
231 << ui << "Mutual information:" << i_xy_ui)
232 sepSet.insert(std::make_pair(x, y), std::move(ui));
233 } else {
234 findBestContributor_(x, y, ui, graph, mutualInformation, rank);
235 }
236
237 delete best.first;
238
240 if (onProgress.hasListener()) {
242 (current_step_ * 66) / (steps_init + steps_iter),
243 0.,
244 timer_.step());
245 }
246 }
247 } catch (...) {} // heap is empty
248 current_step_ = steps_init + steps_iter;
249 if (onProgress.hasListener()) { GUM_EMIT3(onProgress, 66, 0., timer_.step()); }
250 current_step_ = steps_init + steps_iter;
251 }

References gum::Edge::Edge(), gum::ApproximationScheme::current_step_, findBestContributor_(), GUM_EMIT3, GUM_SL_EMIT, gum::__sig__::BasicSignaler< Args... >::hasListener(), gum::IApproximationSchemeConfiguration::onProgress, gum::Heap< Val, Cmp >::pop(), gum::learning::CorrectedMutualInformation::score(), gum::Heap< Val, Cmp >::size(), gum::Timer::step(), gum::ApproximationScheme::timer_, and gum::Heap< Val, Cmp >::top().

Referenced by learnMixedStructure(), and learnSkeleton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ latentVariables()

const std::vector< Arc > gum::learning::ConstraintBasedLearning::latentVariables ( ) const
inherited

Definition at line 129 of file ConstraintBasedLearning.cpp.

129 {
130 return _latentCouples_;
131 }

References _latentCouples_.

Referenced by gum::learning::IBNLearner::latentVariables().

Here is the caller graph for this function:

◆ learnBN()

template<GUM_Numeric GUM_SCALAR, typename PARAM_ESTIMATOR>
BayesNet< GUM_SCALAR > gum::learning::ConstraintBasedLearning::learnBN ( PARAM_ESTIMATOR & estimator,
MixedGraph graph )
inherited

learns structure then estimates parameters

Definition at line 12 of file ConstraintBasedLearning_tpl.h.

13 {
14 return DAG2BNLearner::createBN< GUM_SCALAR >(estimator, learnDAG(graph));
15 }
DAG learnDAG(MixedGraph graph)
learns a DAG
static BayesNet< GUM_SCALAR > createBN(ParamEstimator &estimator, const DAG &dag)
create a BN from a DAG using a one pass generator (typically ML)

References gum::learning::DAG2BNLearner::createBN(), and learnDAG().

Here is the call graph for this function:

◆ learnDAG()

DAG gum::learning::ConstraintBasedLearning::learnDAG ( MixedGraph graph)
inherited

learns a DAG

Definition at line 141 of file ConstraintBasedLearning.cpp.

141 {
143 }
DAG propagateToDAG(const MixedGraph &mg)
Applies Meek rules and completes the result into a DAG.
Definition MeekRules.cpp:93
gum::MeekRules meekRules_
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural cons...
virtual MixedGraph learnMixedStructure(MixedGraph graph)=0

References learnMixedStructure(), meekRules_, and gum::MeekRules::propagateToDAG().

Referenced by learnBN(), and gum::learning::IBNLearner::learnDag_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ learnMixedStructure()

MixedGraph gum::learning::Miic::learnMixedStructure ( MixedGraph graph)
overridevirtual

Implements gum::learning::ConstraintBasedLearning.

Definition at line 143 of file Miic.cpp.

143 {
144 if (mi_ == nullptr)
145 GUM_ERROR(NullElement, "call setMutualInformation before learnMixedStructure")
146 timer_.reset();
147 current_step_ = 0;
148
149 _latentCouples_.clear();
150 graph = initGraph_(graph);
151
152 Heap< CondRanking, GreaterPairOn2nd > rank;
153 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > sep_set;
154
155 initiation_(*mi_, graph, sep_set, rank);
156 iteration_(*mi_, graph, sep_set, rank);
157 orientationMiic_(*mi_, graph, sep_set);
158
159 return meekRules_.propagate(graph);
160 }
MixedGraph initGraph_(const MixedGraph &template_graph)
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural cons...
void orientationMiic_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet)
Definition Miic.cpp:257
void iteration_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:206
CorrectedMutualInformation * mi_
Definition Miic.h:186
void initiation_(CorrectedMutualInformation &mutualInformation, MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, Heap< CondRanking, GreaterPairOn2nd > &rank)
Definition Miic.cpp:166

References gum::learning::ConstraintBasedLearning::_latentCouples_, gum::ApproximationScheme::current_step_, GUM_ERROR, gum::learning::ConstraintBasedLearning::initGraph_(), initiation_(), iteration_(), gum::learning::ConstraintBasedLearning::meekRules_, mi_, orientationMiic_(), gum::MeekRules::propagate(), gum::Timer::reset(), and gum::ApproximationScheme::timer_.

Here is the call graph for this function:

◆ learnPDAG()

PDAG gum::learning::ConstraintBasedLearning::learnPDAG ( MixedGraph graph)
inherited

learns the essential graph (CPDAG)

Definition at line 137 of file ConstraintBasedLearning.cpp.

137 {
139 }
PDAG propagateToCPDAG(const MixedGraph &mg)
Applies Meek rules and returns a CPDAG (completed PDAG).
Definition MeekRules.cpp:70

References learnMixedStructure(), meekRules_, and gum::MeekRules::propagateToCPDAG().

Referenced by gum::learning::IBNLearner::learnPDAG_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ learnSkeleton()

MixedGraph gum::learning::Miic::learnSkeleton ( MixedGraph graph)
overridevirtual

Implements gum::learning::ConstraintBasedLearning.

Definition at line 126 of file Miic.cpp.

126 {
127 if (mi_ == nullptr) GUM_ERROR(NullElement, "call setMutualInformation before learnSkeleton")
128 timer_.reset();
129 current_step_ = 0;
130
131 _latentCouples_.clear();
132 graph = initGraph_(graph);
133
134 Heap< CondRanking, GreaterPairOn2nd > rank;
135 HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > sep_set;
136
137 initiation_(*mi_, graph, sep_set, rank);
138 iteration_(*mi_, graph, sep_set, rank);
139
140 return graph;
141 }

References gum::learning::ConstraintBasedLearning::_latentCouples_, gum::ApproximationScheme::current_step_, GUM_ERROR, gum::learning::ConstraintBasedLearning::initGraph_(), initiation_(), iteration_(), mi_, gum::Timer::reset(), and gum::ApproximationScheme::timer_.

Here is the call graph for this function:

◆ maxIter()

INLINE Size gum::ApproximationScheme::maxIter ( ) const
overridevirtualinherited

Returns the criterion on number of iterations.

Returns
Returns the criterion on number of iterations.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 113 of file approximationScheme_inl.h.

113{ return max_iter_; }

References max_iter_.

Referenced by gum::learning::IBNLearner::EMMaxIter(), and gum::learning::IBNLearner::maxIter().

Here is the caller graph for this function:

◆ maxTime()

INLINE double gum::ApproximationScheme::maxTime ( ) const
overridevirtualinherited

Returns the timeout (in seconds).

Returns
Returns the timeout (in seconds).

Implements gum::IApproximationSchemeConfiguration.

Definition at line 134 of file approximationScheme_inl.h.

134{ return max_time_; }

References max_time_.

Referenced by gum::learning::IBNLearner::EMMaxTime(), and gum::learning::IBNLearner::maxTime().

Here is the caller graph for this function:

◆ messageApproximationScheme()

std::string gum::IApproximationSchemeConfiguration::messageApproximationScheme ( ) const
inherited

Returns the approximation scheme message.

Returns
Returns the approximation scheme message.

Definition at line 64 of file IApproximationSchemeConfiguration.cpp.

64 {
65 switch (stateApproximationScheme()) {
66 case ApproximationSchemeSTATE::Continue : return "in progress";
67
69 return std::format("stopped with epsilon={}", epsilon());
70
72 return std::format("stopped with rate={}", minEpsilonRate());
73
75 return std::format("stopped with max iteration={}", maxIter());
76
78 return std::format("stopped with timeout={}", maxTime());
79
80 case ApproximationSchemeSTATE::Stopped : return "stopped on request";
81
82 case ApproximationSchemeSTATE::Undefined : return "undefined state";
83 }
84 return {};
85 }
virtual double epsilon() const =0
Returns the value of epsilon.
virtual ApproximationSchemeSTATE stateApproximationScheme() const =0
Returns the approximation scheme state.
virtual double minEpsilonRate() const =0
Returns the value of the minimal epsilon rate.
virtual Size maxIter() const =0
Returns the criterion on number of iterations.
virtual double maxTime() const =0
Returns the timeout (in seconds).

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ minEpsilonRate()

INLINE double gum::ApproximationScheme::minEpsilonRate ( ) const
overridevirtualinherited

Returns the value of the minimal epsilon rate.

Returns
Returns the value of the minimal epsilon rate.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 93 of file approximationScheme_inl.h.

93{ return min_rate_eps_; }

References min_rate_eps_.

Referenced by gum::learning::IBNLearner::EMMinEpsilonRate(), and gum::learning::IBNLearner::minEpsilonRate().

Here is the caller graph for this function:

◆ nbrIterations()

INLINE Size gum::ApproximationScheme::nbrIterations ( ) const
overridevirtualinherited

Returns the number of iterations.

Returns
Returns the number of iterations.
Exceptions
OperationNotAllowedRaised if the scheme did not perform.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 170 of file approximationScheme_inl.h.

170 {
172 GUM_ERROR(OperationNotAllowed, "state of the approximation scheme is undefined")
173 }
174
175 return current_step_;
176 }

Referenced by gum::GibbsBNdistance< GUM_SCALAR >::computeKL_(), gum::MCBNDistance< GUM_SCALAR >::computeKL_(), gum::learning::IBNLearner::EMnbrIterations(), and gum::learning::IBNLearner::nbrIterations().

Here is the caller graph for this function:

◆ operator=() [1/2]

Miic & gum::learning::Miic::operator= ( const Miic & from)

Definition at line 75 of file Miic.cpp.

75 {
77 return *this;
78 }
ConstraintBasedLearning & operator=(const ConstraintBasedLearning &)

References Miic(), and gum::learning::ConstraintBasedLearning::operator=().

Here is the call graph for this function:

◆ operator=() [2/2]

Miic & gum::learning::Miic::operator= ( Miic && from)

Definition at line 80 of file Miic.cpp.

80 {
82 return *this;
83 }

References Miic(), and gum::learning::ConstraintBasedLearning::operator=().

Here is the call graph for this function:

◆ orientationMiic_()

void gum::learning::Miic::orientationMiic_ ( CorrectedMutualInformation & mutualInformation,
MixedGraph & graph,
const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > & sepSet )
protected

Definition at line 257 of file Miic.cpp.

260 {
261 HashTable< std::pair< NodeId, NodeId >, char > marks = _initialMarks_;
262
264
265 for (const auto& arc: _mandatoryGraph_.arcs()) {
266 marks.insert({arc.tail(), arc.head()}, '>');
267 marks.insert({arc.head(), arc.tail()}, '-');
268 }
269 for (const Arc& arc: _forbiddenGraph_.arcs()) {
270 if (graph.existsArc(arc.head(), arc.tail())) {
271 marks.insert({arc.tail(), arc.head()}, '-');
272 marks.insert({arc.head(), arc.tail()}, '>');
273 }
274 }
275
276 std::vector< ProbabilisticRanking > proba_triples
277 = unshieldedTriplesMiic_(graph, mutualInformation, sepSet, marks);
278
279 const Size steps_orient = proba_triples.size();
280 Size past_steps = current_step_;
281
283 if (steps_orient > 0) best = proba_triples[0];
284
285 while (!proba_triples.empty() && std::max(std::get< 2 >(best), std::get< 3 >(best)) >= 0.5) {
286 const NodeId x = std::get< 0 >(*std::get< 0 >(best));
287 const NodeId y = std::get< 1 >(*std::get< 0 >(best));
288 const NodeId z = std::get< 2 >(*std::get< 0 >(best));
289
290 const double i3 = std::get< 1 >(best);
291 const double p1 = std::get< 2 >(best);
292 const double p2 = std::get< 3 >(best);
293
294 if (i3 <= 0) {
295 _orientingVstructureMiic_(graph, marks, x, y, z, p1, p2);
296 } else {
297 _propagatingOrientationMiic_(graph, marks, x, y, z, p1, p2);
298 }
299
300 delete std::get< 0 >(best);
301 proba_triples.erase(proba_triples.begin());
302 proba_triples = updateProbaTriples_(graph, proba_triples);
303
304 if (!proba_triples.empty()) best = proba_triples[0];
305
307 if (onProgress.hasListener()) {
309 (current_step_ * 100) / (steps_orient + past_steps),
310 0.,
311 timer_.step());
312 }
313 }
314
315 for (auto iter = _latentCouples_.rbegin(); iter != _latentCouples_.rend(); ++iter) {
316 graph.eraseArc(Arc(iter->head(), iter->tail()));
317 if (_existsDirectedPath_(graph, iter->head(), iter->tail())) {
318 graph.addArc(iter->head(), iter->tail());
319 graph.eraseArc(Arc(iter->tail(), iter->head()));
320 *iter = Arc(iter->head(), iter->tail());
321 }
322 }
323
324 if (onProgress.hasListener()) { GUM_EMIT3(onProgress, 100, 0., timer_.step()); }
325 }
void applyStructuralConstraints_(MixedGraph &graph)
Builds a complete MixedGraph on the nodes of template_graph, minus edges forbidden by structural cons...
std::vector< ProbabilisticRanking > updateProbaTriples_(const MixedGraph &graph, std::vector< ProbabilisticRanking > probaTriples)
Definition Miic.cpp:633
void _orientingVstructureMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
Definition Miic.cpp:331
void _propagatingOrientationMiic_(MixedGraph &graph, HashTable< std::pair< NodeId, NodeId >, char > &marks, NodeId x, NodeId y, NodeId z, double p1, double p2)
Definition Miic.cpp:441
std::vector< ProbabilisticRanking > unshieldedTriplesMiic_(const MixedGraph &graph, CorrectedMutualInformation &mutualInformation, const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > &sepSet, HashTable< std::pair< NodeId, NodeId >, char > &marks)
Definition Miic.cpp:594
std::tuple< ThreePoints *, double, double, double > ProbabilisticRanking
Definition Miic.h:73

References gum::Arc::Arc(), gum::learning::ConstraintBasedLearning::_existsDirectedPath_(), gum::learning::ConstraintBasedLearning::_forbiddenGraph_, gum::learning::ConstraintBasedLearning::_initialMarks_, gum::learning::ConstraintBasedLearning::_latentCouples_, gum::learning::ConstraintBasedLearning::_mandatoryGraph_, _orientingVstructureMiic_(), _propagatingOrientationMiic_(), gum::learning::ConstraintBasedLearning::applyStructuralConstraints_(), gum::ArcGraphPart::arcs(), gum::ApproximationScheme::current_step_, GUM_EMIT3, gum::__sig__::BasicSignaler< Args... >::hasListener(), gum::HashTable< Key, Val >::insert(), gum::IApproximationSchemeConfiguration::onProgress, gum::Timer::step(), gum::ApproximationScheme::timer_, unshieldedTriplesMiic_(), and updateProbaTriples_().

Referenced by learnMixedStructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ orientDoubleHeadedArcs_()

void gum::learning::ConstraintBasedLearning::orientDoubleHeadedArcs_ ( MixedGraph & mg)
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.

204 {
205 gum::ArcSet L;
206 for (gum::NodeId x: mg.nodes())
207 for (NodeId y: mg.parents(x))
208 if (mg.parents(y).contains(x)) {
209 if (x > y) continue;
210 else L.insert(gum::Arc(x, y));
211 }
212
213 if (not L.empty()) {
214 while (true) {
215 bool withdrawFlag_L = false;
216 for (auto arc: ArcSet(L)) {
217 bool tail_head = _existsDirectedPath_(mg, arc.tail(), arc.head());
218 bool head_tail = _existsDirectedPath_(mg, arc.head(), arc.tail());
219 bool withdrawFlag_arc = false;
220
221 if (tail_head && !head_tail) {
222 mg.eraseArc(Arc(arc.head(), arc.tail()));
223 withdrawFlag_arc = true;
224 } else if (!tail_head && head_tail) {
225 mg.eraseArc(Arc(arc.tail(), arc.head()));
226 withdrawFlag_arc = true;
227 } else if (!tail_head && !head_tail) {
228 mg.eraseArc(Arc(arc.head(), arc.tail()));
229 withdrawFlag_arc = true;
230 }
231
232 if (withdrawFlag_arc) {
233 L.erase(arc);
234 withdrawFlag_L = true;
235 }
236 }
237 if (L.empty()) break;
238
239 // no arc was processed this pass — break cycle by erasing one arc arbitrarily
240 if (!withdrawFlag_L) {
241 auto arc = *L.begin();
242 mg.eraseArc(Arc(arc.head(), arc.tail()));
243 mg.eraseArc(Arc(arc.tail(), arc.head()));
244 L.erase(arc);
245 }
246 }
247 }
248 }
bool empty() const noexcept
Indicates whether the set is the empty set.
Definition set_tpl.h:613
iterator begin() const
The usual unsafe begin iterator to parse the set.
Definition set_tpl.h:409
void insert(const Key &k)
Inserts a new element into the set.
Definition set_tpl.h:510
void erase(const Key &k)
Erases an element from the set.
Definition set_tpl.h:553
Set< Arc > ArcSet
Some typdefs and define for shortcuts ...

References gum::Arc::Arc(), _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 learnMixedStructure(), and gum::learning::FCI::learnMixedStructure().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ periodSize()

INLINE Size gum::ApproximationScheme::periodSize ( ) const
overridevirtualinherited

Returns the period size.

Returns
Returns the period size.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 156 of file approximationScheme_inl.h.

156{ return period_size_; }
Size period_size_
Checking criteria frequency.

References period_size_.

Referenced by gum::learning::IBNLearner::EMPeriodSize(), and gum::learning::IBNLearner::periodSize().

Here is the caller graph for this function:

◆ remainingBurnIn()

INLINE Size gum::ApproximationScheme::remainingBurnIn ( ) const
inherited

Returns the remaining burn in.

Returns
Returns the remaining burn in.

Definition at line 213 of file approximationScheme_inl.h.

213 {
214 if (burn_in_ > current_step_) {
215 return burn_in_ - current_step_;
216 } else {
217 return 0;
218 }
219 }
Size burn_in_
Number of iterations before checking stopping criteria.

◆ setEpsilon()

INLINE void gum::ApproximationScheme::setEpsilon ( double eps)
overridevirtualinherited

Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.

If the criterion was disabled it will be enabled.

Parameters
epsThe new epsilon value.
Exceptions
OutOfBoundsRaised if eps < 0.

Implements gum::IApproximationSchemeConfiguration.

Reimplemented in gum::learning::EMApproximationScheme.

Definition at line 64 of file approximationScheme_inl.h.

64 {
65 if (eps < 0.) { GUM_ERROR(OutOfBounds, "eps should be >=0") }
66
67 eps_ = eps;
68 enabled_eps_ = true;
69 }

References enabled_eps_, eps_, and GUM_ERROR.

Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), gum::learning::GreedyHillClimbing::GreedyHillClimbing(), gum::learning::GreedyThickThinning::GreedyThickThinning(), gum::learning::EMApproximationScheme::setEpsilon(), gum::learning::IBNLearner::setEpsilon(), and setFromConfiguration_().

Here is the caller graph for this function:

◆ setForbiddenGraph()

void gum::learning::ConstraintBasedLearning::setForbiddenGraph ( const gum::DiGraph & forbidGraph)
inherited

Definition at line 118 of file ConstraintBasedLearning.cpp.

118 {
119 _forbiddenGraph_ = forbidGraph;
120 }

References _forbiddenGraph_.

Referenced by gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), and gum::learning::IBNLearner::preparePC_().

Here is the caller graph for this function:

◆ setFromConfiguration_()

void gum::ApproximationScheme::setFromConfiguration_ ( const std::string & section,
bool withMaxTime,
bool withVerbosity = true )
protectedinherited

Set the parameters of the scheme from a section of gum::Configuration.

The keys epsilon, minEpsilonRate, maxIter and periodSize of the section are read (and maxTime if withMaxTime is true, verbosity if withVerbosity is true, burnIn if the section has this key) and applied through the corresponding setters, which enable the matching stopping criteria and check the values.

Parameters
sectionThe name of the section of the configuration.
withMaxTimeIf true, the key maxTime is read and the timeout is enabled.
withVerbosityIf true, the key verbosity is read ; otherwise the verbosity is left unchanged.
Exceptions
OutOfBoundsRaised if a value of the section is not valid for its setter.

Definition at line 90 of file approximationScheme.cpp.

92 {
93 const auto& conf = Configuration::instance();
94
95 setEpsilon(conf.typed< double >(section, "epsilon"));
96 setMinEpsilonRate(conf.typed< double >(section, "minEpsilonRate"));
97 setMaxIter(sizeFromConfiguration_(section, "maxIter"));
98 setPeriodSize(sizeFromConfiguration_(section, "periodSize"));
99 if (withVerbosity) setVerbosity(conf.typed< bool >(section, "verbosity"));
100 if (withMaxTime) setMaxTime(conf.typed< double >(section, "maxTime"));
101 // only some sections have a burn-in (approximation, gibbs, gibbsKL)
102 if (conf.has(section, "burnIn")) burn_in_ = sizeFromConfiguration_(section, "burnIn");
103 }
static Size sizeFromConfiguration_(const std::string &section, const std::string &key)
Read a non negative integer key of gum::Configuration.
void setMaxIter(Size max) override
Stopping criterion on number of iterations.
void setMaxTime(double timeout) override
Stopping criterion on timeout.
void setMinEpsilonRate(double rate) override
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
void setPeriodSize(Size p) override
How many samples between two stopping is enable.
void setVerbosity(bool v) override
Set the verbosity on (true) or off (false).
void setEpsilon(double eps) override
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
static Configuration & instance()
The global configuration.

References burn_in_, gum::Configuration::instance(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), setVerbosity(), and sizeFromConfiguration_().

Referenced by ApproximationScheme(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::GibbsBNdistance< GUM_SCALAR >::GibbsBNdistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), gum::MCBNDistance< GUM_SCALAR >::MCBNDistance(), and gum::SamplingInference< GUM_SCALAR >::SamplingInference().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMandatoryGraph()

void gum::learning::ConstraintBasedLearning::setMandatoryGraph ( const gum::DAG & mandaGraph)
inherited

Definition at line 114 of file ConstraintBasedLearning.cpp.

114 {
115 _mandatoryGraph_ = mandaGraph;
116 }

References _mandatoryGraph_.

Referenced by gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), and gum::learning::IBNLearner::preparePC_().

Here is the caller graph for this function:

◆ setMaxIndegree()

void gum::learning::ConstraintBasedLearning::setMaxIndegree ( gum::Size n)
inherited

Definition at line 122 of file ConstraintBasedLearning.cpp.

122{ _maxIndegree_ = n; }

References _maxIndegree_.

Referenced by gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), and gum::learning::IBNLearner::preparePC_().

Here is the caller graph for this function:

◆ setMaxIter()

INLINE void gum::ApproximationScheme::setMaxIter ( Size max)
overridevirtualinherited

Stopping criterion on number of iterations.

If the criterion was disabled it will be enabled.

Parameters
maxThe maximum number of iterations.
Exceptions
OutOfBoundsRaised if max <= 1.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 106 of file approximationScheme_inl.h.

106 {
107 if (max < 1) { GUM_ERROR(OutOfBounds, "max should be >=1") }
108 max_iter_ = max;
109 enabled_max_iter_ = true;
110 }

References enabled_max_iter_, GUM_ERROR, and max_iter_.

Referenced by gum::learning::IBNLearner::EMsetMaxIter(), setFromConfiguration_(), and gum::learning::IBNLearner::setMaxIter().

Here is the caller graph for this function:

◆ setMaxTime()

INLINE void gum::ApproximationScheme::setMaxTime ( double timeout)
overridevirtualinherited

Stopping criterion on timeout.

If the criterion was disabled it will be enabled.

Parameters
timeoutThe timeout value in seconds.
Exceptions
OutOfBoundsRaised if timeout <= 0.0.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 127 of file approximationScheme_inl.h.

127 {
128 if (timeout <= 0.) { GUM_ERROR(OutOfBounds, "timeout should be >0.") }
129 max_time_ = timeout;
130 enabled_max_time_ = true;
131 }

References enabled_max_time_, GUM_ERROR, and max_time_.

Referenced by gum::learning::IBNLearner::EMsetMaxTime(), setFromConfiguration_(), and gum::learning::IBNLearner::setMaxTime().

Here is the caller graph for this function:

◆ setMinEpsilonRate()

INLINE void gum::ApproximationScheme::setMinEpsilonRate ( double rate)
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

Parameters
rateThe minimal epsilon rate.
Exceptions
OutOfBoundsif rate<0

Implements gum::IApproximationSchemeConfiguration.

Reimplemented in gum::learning::EMApproximationScheme.

Definition at line 85 of file approximationScheme_inl.h.

85 {
86 if (rate < 0) { GUM_ERROR(OutOfBounds, "rate should be >=0") }
87
88 min_rate_eps_ = rate;
90 }

References enabled_min_rate_eps_, GUM_ERROR, and min_rate_eps_.

Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), setFromConfiguration_(), gum::learning::EMApproximationScheme::setMinEpsilonRate(), and gum::learning::IBNLearner::setMinEpsilonRate().

Here is the caller graph for this function:

◆ setMutualInformation()

void gum::learning::Miic::setMutualInformation ( CorrectedMutualInformation & mi)

Definition at line 89 of file Miic.cpp.

89{ mi_ = &mi; }

References mi_.

Referenced by gum::learning::IBNLearner::learnDag_(), and gum::learning::IBNLearner::learnPDAG_().

Here is the caller graph for this function:

◆ setPeriodSize()

INLINE void gum::ApproximationScheme::setPeriodSize ( Size p)
overridevirtualinherited

How many samples between two stopping is enable.

Parameters
pThe new period value.
Exceptions
OutOfBoundsRaised if p < 1.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 150 of file approximationScheme_inl.h.

150 {
151 if (p < 1) { GUM_ERROR(OutOfBounds, "p should be >=1") }
152
153 period_size_ = p;
154 }

References GUM_ERROR, and period_size_.

Referenced by gum::learning::IBNLearner::EMsetPeriodSize(), setFromConfiguration_(), and gum::learning::IBNLearner::setPeriodSize().

Here is the caller graph for this function:

◆ setVerbosity()

INLINE void gum::ApproximationScheme::setVerbosity ( bool v)
overridevirtualinherited

Set the verbosity on (true) or off (false).

Parameters
vIf true, then verbosity is turned on.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 159 of file approximationScheme_inl.h.

159{ verbosity_ = v; }
bool verbosity_
If true, verbosity is enabled.

References verbosity_.

Referenced by gum::learning::IBNLearner::EMsetVerbosity(), setFromConfiguration_(), and gum::learning::IBNLearner::setVerbosity().

Here is the caller graph for this function:

◆ sizeFromConfiguration_()

Size gum::ApproximationScheme::sizeFromConfiguration_ ( const std::string & section,
const std::string & key )
staticprotectedinherited

Read a non negative integer key of gum::Configuration.

Parameters
sectionThe name of the section of the configuration.
keyThe name of the key of the section.
Returns
The value of the key.
Exceptions
OutOfBoundsRaised if the value is negative.

Definition at line 79 of file approximationScheme.cpp.

80 {
81 const auto value = Configuration::instance().typed< std::int64_t >(section, key);
82 if (value < 0) {
83 GUM_ERROR(OutOfBounds,
84 "The key " << section << "." << key
85 << " of the configuration must not be negative.")
86 }
87 return static_cast< Size >(value);
88 }
T typed(std::string_view section, std::string_view key) const
Value of section.key converted according to its declared type.

References GUM_ERROR, gum::Configuration::instance(), and gum::Configuration::typed().

Referenced by gum::GibbsSampling< GUM_SCALAR >::GibbsSampling(), and setFromConfiguration_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startOfPeriod()

INLINE bool gum::ApproximationScheme::startOfPeriod ( ) const
inherited

Returns true if we are at the beginning of a period (compute error is mandatory).

Returns
Returns true if we are at the beginning of a period (compute error is mandatory).

Definition at line 200 of file approximationScheme_inl.h.

200 {
201 if (current_step_ < burn_in_) { return false; }
202
203 if (period_size_ == 1) { return true; }
204
205 return ((current_step_ - burn_in_) % period_size_ == 0);
206 }

Referenced by continueApproximationScheme().

Here is the caller graph for this function:

◆ stateApproximationScheme()

INLINE IApproximationSchemeConfiguration::ApproximationSchemeSTATE gum::ApproximationScheme::stateApproximationScheme ( ) const
overridevirtualinherited

Returns the approximation scheme state.

Returns
Returns the approximation scheme state.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 165 of file approximationScheme_inl.h.

165 {
166 return current_state_;
167 }

Referenced by continueApproximationScheme(), gum::learning::IBNLearner::EMState(), gum::learning::IBNLearner::EMStateApproximationScheme(), history(), and gum::learning::IBNLearner::stateApproximationScheme().

Here is the caller graph for this function:

◆ stopApproximationScheme()

INLINE void gum::ApproximationScheme::stopApproximationScheme ( )
inherited

Stop the approximation scheme.

Definition at line 222 of file approximationScheme_inl.h.

References gum::IApproximationSchemeConfiguration::Continue, and current_state_.

Referenced by gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), and gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_().

Here is the caller graph for this function:

◆ stopScheme_()

INLINE void gum::ApproximationScheme::stopScheme_ ( ApproximationSchemeSTATE new_state)
privateinherited

Stop the scheme given a new state.

Parameters
new_stateThe scheme new state.

Definition at line 231 of file approximationScheme_inl.h.

231 {
232 if (new_state == ApproximationSchemeSTATE::Continue) { return; }
233
234 if (new_state == ApproximationSchemeSTATE::Undefined) { return; }
235
236 current_state_ = new_state;
237 timer_.pause();
238
240 }
Signaler< std::string_view > onStop
Criteria messageApproximationScheme.
double pause()
Pause the timer and return the delta (.
Definition timer_inl.h:75
#define GUM_EMIT1(signal, arg1)
Definition signaler.h:289

References gum::IApproximationSchemeConfiguration::Continue, and gum::IApproximationSchemeConfiguration::Undefined.

Referenced by continueApproximationScheme().

Here is the caller graph for this function:

◆ unshieldedTriples_()

std::vector< ThreePoints > gum::learning::ConstraintBasedLearning::unshieldedTriples_ ( const MixedGraph & graph)
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.

301 {
302 std::vector< ThreePoints > triples;
303 for (NodeId z: graph) {
304 for (NodeId x: graph.neighbours(z)) {
305 for (NodeId y: graph.neighbours(z)) {
306 if (y < x && !graph.existsEdge(x, y) && !graph.existsArc(x, y)
307 && !graph.existsArc(y, x)) {
308 triples.emplace_back(x, y, z);
309 }
310 }
311 }
312 }
313 return triples;
314 }

Referenced by learnMixedStructure(), gum::learning::FCI::orientCollidersOnPAG_(), and gum::learning::CIBasedLearning::orientUnshieldedColliders_().

Here is the caller graph for this function:

◆ unshieldedTriplesMiic_()

std::vector< ProbabilisticRanking > gum::learning::Miic::unshieldedTriplesMiic_ ( const MixedGraph & graph,
CorrectedMutualInformation & mutualInformation,
const HashTable< std::pair< NodeId, NodeId >, std::vector< NodeId > > & sepSet,
HashTable< std::pair< NodeId, NodeId >, char > & marks )
protected

Definition at line 594 of file Miic.cpp.

598 {
599 std::vector< ProbabilisticRanking > triples;
600 for (NodeId z: graph) {
601 for (NodeId x: graph.neighbours(z)) {
602 for (NodeId y: graph.neighbours(z)) {
603 if (y < x && !graph.existsEdge(x, y)) {
604 std::vector< NodeId > ui;
605 std::pair< NodeId, NodeId > key = {x, y};
606 std::pair< NodeId, NodeId > rev_key = {y, x};
607 if (sepSet.exists(key)) {
608 ui = sepSet[key];
609 } else if (sepSet.exists(rev_key)) {
610 ui = sepSet[rev_key];
611 }
612 const auto iter_z_place = std::find(ui.begin(), ui.end(), z);
613 if (iter_z_place != ui.end()) ui.erase(iter_z_place);
614
615 const double Ixyz_ui = mutualInformation.score(x, y, z, ui);
616 auto tup = new ThreePoints{x, y, z};
617 ProbabilisticRanking triple{tup, Ixyz_ui, 0.5, 0.5};
618 triples.push_back(triple);
619 if (!marks.exists({x, z})) marks.insert({x, z}, 'o');
620 if (!marks.exists({z, x})) marks.insert({z, x}, 'o');
621 if (!marks.exists({y, z})) marks.insert({y, z}, 'o');
622 if (!marks.exists({z, y})) marks.insert({z, y}, 'o');
623 }
624 }
625 }
626 }
627 triples = updateProbaTriples_(graph, triples);
628 std::sort(triples.begin(), triples.end(), GreaterTupleOnLast());
629 return triples;
630 }
std::tuple< NodeId, NodeId, NodeId > ThreePoints

References gum::learning::CorrectedMutualInformation::score(), and updateProbaTriples_().

Referenced by orientationMiic_().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateApproximationScheme()

INLINE void gum::ApproximationScheme::updateApproximationScheme ( unsigned int incr = 1)
inherited

◆ updateProbaTriples_()

std::vector< ProbabilisticRanking > gum::learning::Miic::updateProbaTriples_ ( const MixedGraph & graph,
std::vector< ProbabilisticRanking > probaTriples )
protected

Definition at line 633 of file Miic.cpp.

634 {
635 for (auto& triple: probaTriples) {
636 NodeId x, y, z;
637 x = std::get< 0 >(*std::get< 0 >(triple));
638 y = std::get< 1 >(*std::get< 0 >(triple));
639 z = std::get< 2 >(*std::get< 0 >(triple));
640 const double Ixyz = std::get< 1 >(triple);
641 double Pxz = std::get< 2 >(triple);
642 double Pyz = std::get< 3 >(triple);
643
644 if (Ixyz <= 0) {
645 const double expo = std::exp(Ixyz);
646 const double P0 = (1 + expo) / (1 + 3 * expo);
647 if (Pxz == Pyz && Pyz == 0.5) {
648 std::get< 2 >(triple) = P0;
649 std::get< 3 >(triple) = P0;
650 } else {
651 if (graph.existsArc(x, z) && Pxz >= P0) {
652 std::get< 3 >(triple) = Pxz * (1 / (1 + expo) - 0.5) + 0.5;
653 } else if (graph.existsArc(y, z) && Pyz >= P0) {
654 std::get< 2 >(triple) = Pyz * (1 / (1 + expo) - 0.5) + 0.5;
655 }
656 }
657 } else {
658 const double expo = std::exp(-Ixyz);
659 if (graph.existsArc(x, z) && Pxz >= 0.5) {
660 std::get< 3 >(triple) = Pxz * (1 / (1 + expo) - 0.5) + 0.5;
661 } else if (graph.existsArc(y, z) && Pyz >= 0.5) {
662 std::get< 2 >(triple) = Pyz * (1 / (1 + expo) - 0.5) + 0.5;
663 }
664 }
665 }
666 std::sort(probaTriples.begin(), probaTriples.end(), GreaterTupleOnLast());
667 return probaTriples;
668 }

Referenced by orientationMiic_(), and unshieldedTriplesMiic_().

Here is the caller graph for this function:

◆ verbosity()

INLINE bool gum::ApproximationScheme::verbosity ( ) const
overridevirtualinherited

Returns true if verbosity is enabled.

Returns
Returns true if verbosity is enabled.

Implements gum::IApproximationSchemeConfiguration.

Definition at line 161 of file approximationScheme_inl.h.

161{ return verbosity_; }

Referenced by ApproximationScheme(), gum::learning::EMApproximationScheme::EMApproximationScheme(), continueApproximationScheme(), gum::learning::IBNLearner::EMVerbosity(), history(), and gum::learning::IBNLearner::verbosity().

Here is the caller graph for this function:

Member Data Documentation

◆ _arcProbas_

ArcProperty< double > gum::learning::Miic::_arcProbas_
private

Definition at line 187 of file Miic.h.

Referenced by _orientingVstructureMiic_(), and _propagatingOrientationMiic_().

◆ _emptySet_

const std::vector< NodeId > gum::learning::ConstraintBasedLearning::_emptySet_
protectedinherited

◆ _forbiddenGraph_

◆ _initialMarks_

HashTable< std::pair< NodeId, NodeId >, char > gum::learning::ConstraintBasedLearning::_initialMarks_
protectedinherited

◆ _latentCouples_

◆ _mandatoryGraph_

gum::DAG gum::learning::ConstraintBasedLearning::_mandatoryGraph_
protectedinherited

◆ _maxIndegree_

gum::Size gum::learning::ConstraintBasedLearning::_maxIndegree_ {std::numeric_limits< gum::Size >::max()}
privateinherited

◆ _maxLog_

int gum::learning::ConstraintBasedLearning::_maxLog_ {100}
protectedinherited

◆ burn_in_

Size gum::ApproximationScheme::burn_in_
protectedinherited

◆ current_epsilon_

double gum::ApproximationScheme::current_epsilon_ {-1.}
protectedinherited

Current epsilon.

Definition at line 419 of file approximationScheme.h.

Referenced by continueApproximationScheme(), and initApproximationScheme().

◆ current_rate_

double gum::ApproximationScheme::current_rate_ {-1.}
protectedinherited

Current rate.

Definition at line 425 of file approximationScheme.h.

Referenced by continueApproximationScheme(), and initApproximationScheme().

◆ current_state_

ApproximationSchemeSTATE gum::ApproximationScheme::current_state_
protectedinherited

◆ current_step_

◆ enabled_eps_

bool gum::ApproximationScheme::enabled_eps_
protectedinherited

If true, the threshold convergence is enabled.

Definition at line 443 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), disableEpsilon(), enableEpsilon(), isEnabledEpsilon(), and setEpsilon().

◆ enabled_max_iter_

bool gum::ApproximationScheme::enabled_max_iter_
protectedinherited

If true, the maximum iterations stopping criterion is enabled.

Definition at line 461 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), disableMaxIter(), enableMaxIter(), isEnabledMaxIter(), and setMaxIter().

◆ enabled_max_time_

bool gum::ApproximationScheme::enabled_max_time_
protectedinherited

If true, the timeout is enabled.

Definition at line 455 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), disableMaxTime(), enableMaxTime(), isEnabledMaxTime(), and setMaxTime().

◆ enabled_min_rate_eps_

bool gum::ApproximationScheme::enabled_min_rate_eps_
protectedinherited

If true, the minimal threshold for epsilon rate is enabled.

Definition at line 449 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), disableMinEpsilonRate(), enableMinEpsilonRate(), isEnabledMinEpsilonRate(), and setMinEpsilonRate().

◆ eps_

double gum::ApproximationScheme::eps_
protectedinherited

Threshold for convergence.

Definition at line 440 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), epsilon(), and setEpsilon().

◆ history_

std::vector< double > gum::ApproximationScheme::history_
protectedinherited

The scheme history, used only if verbosity == true.

Definition at line 437 of file approximationScheme.h.

Referenced by continueApproximationScheme(), history(), and initApproximationScheme().

◆ last_epsilon_

double gum::ApproximationScheme::last_epsilon_ {-1.}
protectedinherited

Last epsilon value.

Definition at line 422 of file approximationScheme.h.

Referenced by continueApproximationScheme().

◆ max_iter_

Size gum::ApproximationScheme::max_iter_
protectedinherited

The maximum iterations.

Definition at line 458 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), maxIter(), and setMaxIter().

◆ max_time_

double gum::ApproximationScheme::max_time_
protectedinherited

The timeout.

Definition at line 452 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), maxTime(), and setMaxTime().

◆ meekRules_

gum::MeekRules gum::learning::ConstraintBasedLearning::meekRules_
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().

◆ mi_

CorrectedMutualInformation* gum::learning::Miic::mi_ {nullptr}
private

Definition at line 186 of file Miic.h.

Referenced by learnMixedStructure(), learnSkeleton(), and setMutualInformation().

◆ min_rate_eps_

double gum::ApproximationScheme::min_rate_eps_
protectedinherited

Threshold for the epsilon rate.

Definition at line 446 of file approximationScheme.h.

Referenced by ApproximationScheme(), continueApproximationScheme(), minEpsilonRate(), and setMinEpsilonRate().

◆ onProgress

◆ onStop

Signaler< std::string_view > gum::IApproximationSchemeConfiguration::onStop
inherited

Criteria messageApproximationScheme.

Definition at line 84 of file IApproximationSchemeConfiguration.h.

Referenced by gum::learning::IBNLearner::distributeStop().

◆ onStructuralModification

Signaler< gum::NodeId, gum::NodeId, std::string, std::string > gum::learning::ConstraintBasedLearning::onStructuralModification
inherited

Definition at line 145 of file ConstraintBasedLearning.h.

◆ period_size_

Size gum::ApproximationScheme::period_size_
protectedinherited

Checking criteria frequency.

Definition at line 467 of file approximationScheme.h.

Referenced by ApproximationScheme(), periodSize(), and setPeriodSize().

◆ timer_

◆ verbosity_

bool gum::ApproximationScheme::verbosity_
protectedinherited

If true, verbosity is enabled.

Definition at line 470 of file approximationScheme.h.

Referenced by ApproximationScheme(), and setVerbosity().


The documentation for this class was generated from the following files: