![]() |
aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
|
#include <K2.h>
Public Member Functions | |
Constructors / Destructors | |
K2 () | |
default constructor More... | |
K2 (const K2 &from) | |
copy constructor More... | |
K2 (K2 &&from) | |
move constructor More... | |
~K2 () | |
destructor More... | |
Operators | |
K2 & | operator= (const K2 &from) |
copy operator More... | |
K2 & | operator= (K2 &&from) |
move operator More... | |
Accessors / Modifiers | |
Sequence< NodeId > | order__ |
the order on the variable used for learning More... | |
ApproximationScheme & | approximationScheme () |
returns the approximation policy of the learning algorithm More... | |
void | setOrder (const Sequence< NodeId > &order) |
sets the order on the variables More... | |
void | setOrder (const std::vector< NodeId > &order) |
sets the order on the variables More... | |
const Sequence< NodeId > & | order () const noexcept |
returns the current order More... | |
template<typename GRAPH_CHANGES_SELECTOR > | |
DAG | learnStructure (GRAPH_CHANGES_SELECTOR &selector, DAG initial_dag=DAG()) |
learns the structure of a Bayes net More... | |
template<typename GUM_SCALAR , typename GRAPH_CHANGES_SELECTOR , typename PARAM_ESTIMATOR > | |
BayesNet< GUM_SCALAR > | learnBN (GRAPH_CHANGES_SELECTOR &selector, PARAM_ESTIMATOR &estimator, DAG initial_dag=DAG()) |
learns the structure and the parameters of a BN More... | |
void | checkOrder__ (const std::vector< Size > &modal) |
checks that the order passed to K2 is coherent with the variables as specified by their modalities More... | |
|
stronginherited |
The different state of an approximation scheme.
Enumerator | |
---|---|
Undefined | |
Continue | |
Epsilon | |
Rate | |
Limit | |
TimeLimit | |
Stopped |
Definition at line 64 of file IApproximationSchemeConfiguration.h.
gum::learning::K2::K2 | ( | ) |
default constructor
gum::learning::K2::K2 | ( | const K2 & | from | ) |
copy constructor
gum::learning::K2::K2 | ( | K2 && | from | ) |
move constructor
gum::learning::K2::~K2 | ( | ) |
destructor
ApproximationScheme& gum::learning::K2::approximationScheme | ( | ) |
returns the approximation policy of the learning algorithm
|
private |
checks that the order passed to K2 is coherent with the variables as specified by their modalities
Update the scheme w.r.t the new error.
Test the stopping criterion that are enabled.
error | The new error value. |
OperationNotAllowed | Raised if state != ApproximationSchemeSTATE::Continue. |
Definition at line 226 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the current running time in second.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 127 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 53 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 104 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 130 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 78 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 56 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 107 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 133 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 83 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 50 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the scheme history.
OperationNotAllowed | Raised if the scheme did not performed or if verbosity is set to false. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 172 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Initialise the scheme.
Definition at line 186 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on epsilon is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 60 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on max iterations is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 111 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on timeout is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 137 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if stopping criterion on epsilon rate is enabled, false otherwise.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 89 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
BayesNet< GUM_SCALAR > gum::learning::K2::learnBN | ( | GRAPH_CHANGES_SELECTOR & | selector, |
PARAM_ESTIMATOR & | estimator, | ||
DAG | initial_dag = DAG() |
||
) |
learns the structure and the parameters of a BN
Definition at line 62 of file K2_tpl.h.
References gum::learning::genericBNLearner::Database::Database().
DAG gum::learning::K2::learnStructure | ( | GRAPH_CHANGES_SELECTOR & | selector, |
DAG | initial_dag = DAG() |
||
) |
learns the structure of a Bayes net
selector | A selector class that computes the best changes that can be applied and that enables the user to get them very easily. Typically, the selector is a GraphChangesSelector4DiGraph<SCORE, STRUCT_CONSTRAINT, GRAPH_CHANGES_GENERATOR>. |
initial_dag | the DAG we start from for our learning |
Definition at line 40 of file K2_tpl.h.
References gum::learning::genericBNLearner::Database::Database().
|
virtualinherited |
Returns the criterion on number of iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 101 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the timeout (in seconds).
Implements gum::IApproximationSchemeConfiguration.
Definition at line 124 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the approximation scheme message.
Definition at line 39 of file IApproximationSchemeConfiguration_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 73 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the number of iterations.
OperationNotAllowed | Raised if the scheme did not perform. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 162 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the period size.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 148 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns the remaining burn in.
Definition at line 209 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)|.
If the criterion was disabled it will be enabled.
eps | The new epsilon value. |
OutOfLowerBound | Raised if eps < 0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 42 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Stopping criterion on number of iterations.
If the criterion was disabled it will be enabled.
max | The maximum number of iterations. |
OutOfLowerBound | Raised if max <= 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 94 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Stopping criterion on timeout.
If the criterion was disabled it will be enabled.
timeout | The timeout value in seconds. |
OutOfLowerBound | Raised if timeout <= 0.0. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 117 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Given that we approximate f(t), stopping criterion on d/dt(|f(t+1)-f(t)|).
If the criterion was disabled it will be enabled
rate | The minimal epsilon rate. |
OutOfLowerBound | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 65 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
sets the order on the variables
void gum::learning::K2::setOrder | ( | const std::vector< NodeId > & | order | ) |
sets the order on the variables
|
virtualinherited |
How many samples between two stopping is enable.
p | The new period value. |
OutOfLowerBound | Raised if p < 1. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 142 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Set the verbosity on (true) or off (false).
v | If true, then verbosity is turned on. |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 151 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Returns true if we are at the beginning of a period (compute error is mandatory).
Definition at line 196 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns the approximation scheme state.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 157 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Stop the approximation scheme.
Definition at line 218 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
inherited |
Update the scheme w.r.t the new error and increment steps.
incr | The new increment steps. |
Definition at line 205 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
Returns true if verbosity is enabled.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 153 of file approximationScheme_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
Number of iterations before checking stopping criteria.
Definition at line 413 of file approximationScheme.h.
|
protectedinherited |
Current epsilon.
Definition at line 368 of file approximationScheme.h.
|
protectedinherited |
Current rate.
Definition at line 374 of file approximationScheme.h.
|
protectedinherited |
The current state.
Definition at line 383 of file approximationScheme.h.
|
protectedinherited |
The current step.
Definition at line 377 of file approximationScheme.h.
|
protectedinherited |
If true, the threshold convergence is enabled.
Definition at line 392 of file approximationScheme.h.
|
protectedinherited |
If true, the maximum iterations stopping criterion is enabled.
Definition at line 410 of file approximationScheme.h.
|
protectedinherited |
If true, the timeout is enabled.
Definition at line 404 of file approximationScheme.h.
|
protectedinherited |
If true, the minimal threshold for epsilon rate is enabled.
Definition at line 398 of file approximationScheme.h.
|
protectedinherited |
Threshold for convergence.
Definition at line 389 of file approximationScheme.h.
|
protectedinherited |
The scheme history, used only if verbosity == true.
Definition at line 386 of file approximationScheme.h.
|
protectedinherited |
Last epsilon value.
Definition at line 371 of file approximationScheme.h.
|
protectedinherited |
The maximum iterations.
Definition at line 407 of file approximationScheme.h.
|
protectedinherited |
The timeout.
Definition at line 401 of file approximationScheme.h.
|
protectedinherited |
Threshold for the epsilon rate.
Definition at line 395 of file approximationScheme.h.
Progression, error and time.
Definition at line 58 of file IApproximationSchemeConfiguration.h.
|
inherited |
Criteria messageApproximationScheme.
Definition at line 61 of file IApproximationSchemeConfiguration.h.
|
protectedinherited |
Checking criteria frequency.
Definition at line 416 of file approximationScheme.h.
|
protectedinherited |
The timer.
Definition at line 380 of file approximationScheme.h.
|
protectedinherited |
If true, verbosity is enabled.
Definition at line 419 of file approximationScheme.h.