![]() |
aGrUM 3.3.2
a C++ library for (probabilistic) graphical models
|
A pack of learning algorithms that can easily be used. More...
#include <IBNLearner.h>
Classes | |
| class | Database |
| a helper to easily read databases More... | |
Public Types | |
| enum class | ScoreType { AIC , BD , BDeu , BIC , fNML , K2 , LOG2LIKELIHOOD , MDL } |
| an enumeration enabling to select easily the score we wish to use More... | |
| enum class | ParamEstimatorType { ML } |
| an enumeration to select the type of parameter estimation we shall apply More... | |
| enum class | BNLearnerPriorType { NO_prior , SMOOTHING , DIRICHLET_FROM_DATABASE , DIRICHLET_FROM_BAYESNET , BDEU } |
| an enumeration to select the prior More... | |
| enum class | AlgoType { K2 , GREEDY_HILL_CLIMBING , LOCAL_SEARCH_WITH_TABU_LIST , MIIC , PC , FCI , EXTENDED_GREEDY_HILL_CLIMBING , GREEDY_THICK_THINNING } |
| an enumeration to select easily the learning algorithm to use More... | |
| enum class | ApproximationSchemeSTATE : char { Undefined , Continue , Epsilon , Rate , Limit , TimeLimit , Stopped } |
| The different state of an approximation scheme. More... | |
Public Member Functions | |
| void | unsetTotalOrder () |
| removes the current total ordering constraint, if any | |
| void | setForbiddenArcs (const ArcSet &set) |
| removes a total | |
| void | setMandatoryArcs (const ArcSet &set) |
| assign a set of mandatory arcs | |
Constructors / Destructors | |
| IBNLearner (std::string_view filename, const std::vector< std::string > &missingSymbols, bool induceTypes=true) | |
| read the database file for the score / parameter estimation and var names | |
| IBNLearner (const DatabaseTable &db) | |
| read the database file for the score / parameter estimation and var names | |
| template<GUM_Numeric GUM_SCALAR> | |
| IBNLearner (std::string_view filename, const gum::BayesNet< GUM_SCALAR > &src, const std::vector< std::string > &missing_symbols) | |
| read the database file for the score / parameter estimation and var names | |
| IBNLearner (const IBNLearner &) | |
| copy constructor | |
| IBNLearner (IBNLearner &&) | |
| move constructor | |
| ~IBNLearner () override | |
| destructor | |
Operators | |
| IBNLearner & | operator= (const IBNLearner &) |
| copy operator | |
| IBNLearner & | operator= (IBNLearner &&) |
| move operator | |
Accessors / Modifiers | |
| DAG | learnDAG () |
| learn a structure from a file (must have read the db before) | |
| PDAG | learnPDAG () |
| learn a partial structure from a file (must have read the db before and must have selected miic) | |
| PAG | learnPAG () |
| learn a PAG — only valid when useFCI() has been called | |
| void | setInitialDAG (const DAG &) |
| sets an initial DAG structure | |
| DAG | initialDAG () |
| returns the initial DAG structure | |
| const std::vector< std::string > & | names () const |
| returns the names of the variables in the database | |
| const std::vector< std::size_t > & | domainSizes () const |
| returns the domain sizes of the variables in the database | |
| Size | domainSize (NodeId var) const |
| learn a structure from a file (must have read the db before) | |
| Size | domainSize (std::string_view var) const |
| learn a structure from a file (must have read the db before) | |
| NodeId | idFromName (std::string_view var_name) const |
| returns the node id corresponding to a variable name | |
| const DatabaseTable & | database () const |
| returns the database used by the BNLearner | |
| void | setDatabaseWeight (const double new_weight) |
| assign a weight to all the rows of the learning database so that the sum of their weights is equal to new_weight | |
| void | setRecordWeight (const std::size_t i, const double weight) |
| sets the weight of the ith record of the database | |
| double | recordWeight (const std::size_t i) const |
| returns the weight of the ith record | |
| double | databaseWeight () const |
| returns the weight of the whole database | |
| const std::string & | nameFromId (NodeId id) const |
| returns the variable name corresponding to a given node id | |
| void | useDatabaseRanges (const std::vector< std::pair< std::size_t, std::size_t > > &new_ranges) |
| use a new set of database rows' ranges to perform learning | |
| void | clearDatabaseRanges () |
| reset the ranges to the one range corresponding to the whole database | |
| const std::vector< std::pair< std::size_t, std::size_t > > & | databaseRanges () const |
| returns the current database rows' ranges used for learning | |
| std::pair< std::size_t, std::size_t > | useCrossValidationFold (const std::size_t learning_fold, const std::size_t k_fold) |
| sets the ranges of rows to be used for cross-validation learning | |
| std::pair< double, double > | chi2 (NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={}) |
| Return the <statistic,pvalue> pair for chi2 test in the database. | |
| std::pair< double, double > | chi2 (std::string_view name1, std::string_view name2, const std::vector< std::string > &knowing={}) |
| Return the <statistic,pvalue> pair for the BNLearner. | |
| std::pair< double, double > | G2 (NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={}) |
| Return the <statistic,pvalue> pair for for G2 test in the database. | |
| std::pair< double, double > | G2 (std::string_view name1, std::string_view name2, const std::vector< std::string > &knowing={}) |
| Return the <statistic,pvalue> pair for for G2 test in the database. | |
| double | logLikelihood (const std::vector< NodeId > &vars, const std::vector< NodeId > &knowing={}) |
| Return the loglikelihood of vars in the base, conditioned by knowing for the BNLearner. | |
| double | logLikelihood (const std::vector< std::string > &vars, const std::vector< std::string > &knowing={}) |
| Return the loglikelihood of vars in the base, conditioned by knowing for the BNLearner. | |
| double | mutualInformation (NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={}) |
| Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner. | |
| double | mutualInformation (std::string_view var1, std::string_view var2, const std::vector< std::string > &knowing={}) |
| Return the mutual information of var1 and var2 in the base, conditioned by knowing for the BNLearner. | |
| double | correctedMutualInformation (NodeId id1, NodeId id2, const std::vector< NodeId > &knowing={}) |
| Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner. | |
| double | correctedMutualInformation (std::string_view var1, std::string_view var2, const std::vector< std::string > &knowing={}) |
| Return the mutual information of var1 and var2 in the base, conditioned by knowing for the BNLearner. | |
| double | score (NodeId vars, const std::vector< NodeId > &knowing={}) |
| Return the value of the score currently in use by the BNLearner of a variable given a set of other variables. | |
| double | score (std::string_view vars, const std::vector< std::string > &knowing={}) |
| Return the value of the score currently in use by the BNLearner of a variable given a set of other variables The score used is the one currently selected in the BNLearner. | |
| std::vector< double > | rawPseudoCount (const std::vector< NodeId > &vars) |
| Return the pseudo-counts of NodeIds vars in the base in a raw array. | |
| std::vector< double > | rawPseudoCount (const std::vector< std::string > &vars) |
| Return the pseudoconts of vars in the base in a raw array. | |
| Size | nbCols () const |
| Size | nbRows () const |
| void | useEM (const double epsilon, const double noise) |
| use The EM algorithm to learn parameters | |
| void | useEM (const double epsilon) |
| use The EM algorithm to learn parameters, with the default noise | |
| void | useEMWithRateCriterion (const double epsilon, const double noise) |
| use The EM algorithm to learn parameters with the rate stopping criterion | |
| void | useEMWithRateCriterion (const double epsilon) |
| use The EM algorithm with the rate stopping criterion and the default noise (key emNoise) | |
| void | useEMWithDiffCriterion (const double epsilon, const double noise) |
| use The EM algorithm to learn parameters with the diff stopping criterion | |
| void | useEMWithDiffCriterion (const double epsilon) |
| use The EM algorithm with the diff stopping criterion and the default noise (key emNoise) | |
| void | forbidEM () |
| prevent using the EM algorithm for parameter learning | |
| bool | isUsingEM () const |
| indicates whether we use EM for parameter learning | |
| EMApproximationScheme & | EM () |
| returns the EM parameter learning approximation scheme if EM is enabled | |
| ApproximationSchemeSTATE | EMState () const |
| returns the state of the last EM algorithm executed | |
| std::string | EMStateMessage () const |
| returns the state of the EM algorithm | |
| bool | hasMissingValues () const |
| returns true if the learner's database has missing values | |
Score selection | |
| void | useScoreAIC () |
| indicate that we wish to use an AIC score | |
| void | useScoreBD () |
| indicate that we wish to use a BD score | |
| void | useScoreBDeu () |
| indicate that we wish to use a BDeu score | |
| void | useScoreBIC () |
| indicate that we wish to use a BIC score | |
| void | useScorefNML () |
| indicate that we wish to use a fNML score | |
| void | useScoreK2 () |
| indicate that we wish to use a K2 score | |
| void | useScoreLog2Likelihood () |
| indicate that we wish to use a Log2Likelihood score | |
| void | useScoreMDL () |
| indicate that we wish to use a MDL score | |
a prior selection / parameterization | |
| void | useNoPrior () |
| use no prior | |
| void | useBDeuPrior (double weight) |
| use the BDeu prior | |
| void | useBDeuPrior () |
| use the BDeu prior with the default weight (key priorWeight of the section learning) | |
| void | useSmoothingPrior (double weight) |
| use the prior smoothing | |
| void | useSmoothingPrior () |
| use the prior smoothing with the default weight (key priorWeight of the section learning) | |
| void | useDirichletPrior (std::string_view filename, double weight) |
| use the Dirichlet prior from a database | |
| void | useDirichletPrior (std::string_view filename) |
| use the Dirichlet prior from a database with the default weight (key priorWeight) | |
| std::string | checkScorePriorCompatibility () const |
| checks whether the current score and prior are compatible | |
allow/forbid the graph operations used during learning | |
| void | allowArcAdditions (bool allow=true) |
| allow (true)/forbid (false) to add arcs during learning. | |
| void | allowArcDeletions (bool allow=true) |
| allow (true)/forbid (false) to delete arcs during learning. | |
| void | allowArcReversals (bool allow=true) |
| allow (true)/forbid (false) to reverse arcs during learning. | |
| void | allowArcTriangleDeletions (bool allow=true) |
| allow (true)/forbid (false) to delete arc triangles during learning. | |
MIIC parameterization and specific results | |
| void | useNMLCorrection () |
| indicate that we wish to use the NML correction for and MIIC | |
| void | useMDLCorrection () |
| indicate that we wish to use the MDL correction for MIIC | |
| void | useNoCorrection () |
| indicate that we wish to use the NoCorr correction for MIIC | |
| std::vector< Arc > | latentVariables () const |
| get the list of arcs hiding latent variables | |
PC parameterization | |
| void | useChi2Test () |
| indicate that we wish to use Chi2 independence test for PC | |
| void | useG2Test () |
| indicate that we wish to use G2 independence test for PC | |
| void | setPCAlpha (double alpha) |
| set the significance threshold alpha for PC. If it is never set, PC uses the key learning.alpha of the configuration, as it was when the learner was constructed. | |
| void | setPCStable (bool stable) |
| set stable mode for PC — defer removals to end of each depth level (default true) | |
| void | setPCMaxCondSetSize (Size max_k) |
| set maximum conditioning set size for PC (default Size(-1) = unlimited) | |
| void | setPCUnshieldedColliderSorted (bool sorted) |
| set unshielded-collider ordering for PC: sorted=true uses descending p-value order (strongest evidence first); sorted=false uses natural traversal order (default false) | |
FCI parameterization | |
| void | useFCIChi2Test () |
| indicate that we wish to use Chi2 independence test for FCI | |
| void | useFCIG2Test () |
| indicate that we wish to use G2 independence test for FCI | |
| void | setFCIAlpha (double alpha) |
| set the significance threshold alpha for FCI. If it is never set, FCI uses the key learning.alpha of the configuration, as it was when the learner was constructed. | |
| void | setFCIMaxPathLength (Size max_len) |
| set maximum discriminating-path length for FCI R4 (default Size(-1) = unlimited) | |
| void | setFCIExhaustiveSepSet (bool exhaustive) |
| enable exhaustive sepset mode for FCI skeleton learning (default false) | |
| bool | fciExhaustiveSepSet () const |
| return true when FCI uses exhaustive sepset mode | |
Accessors / Modifiers for adding constraints on learning | |
| void | setMaxIndegree (Size max_indegree) |
| sets the max indegree | |
| void | setSliceOrder (const NodeProperty< NodeId > &slice_order) |
| sets a partial order on the nodes | |
| void | setSliceOrder (const std::vector< std::vector< std::string > > &slices) |
| sets a partial order on the nodes | |
| void | unsetSliceOrder () |
| removes the slice order constraint | |
| void | setTotalOrder (const Sequence< NodeId > &order) |
| sets a total order over some nodes | |
| void | setTotalOrder (const std::vector< std::string > &order) |
| sets the max indegree | |
assign a new forbidden arc | |
| void | addForbiddenArc (const Arc &arc) |
| void | addForbiddenArc (NodeId tail, NodeId head) |
| void | addForbiddenArc (std::string_view tail, std::string_view head) |
remove a forbidden arc | |
| void | eraseForbiddenArc (const Arc &arc) |
| void | eraseForbiddenArc (NodeId tail, NodeId head) |
| void | eraseForbiddenArc (std::string_view tail, std::string_view head) |
assign a new mandatory arc | |
| void | addMandatoryArc (const Arc &arc) |
| void | addMandatoryArc (NodeId tail, NodeId head) |
| void | addMandatoryArc (std::string_view tail, std::string_view head) |
remove a mandatory arc | |
| void | eraseMandatoryArc (const Arc &arc) |
| void | eraseMandatoryArc (NodeId tail, NodeId head) |
| void | eraseMandatoryArc (std::string_view tail, std::string_view head) |
add a node with no parent | |
| void | addNoParentNode (NodeId node) |
| void | addNoParentNode (std::string_view node) |
remove a node with no parent | |
| void | eraseNoParentNode (NodeId node) |
| void | eraseNoParentNode (std::string_view node) |
add a node with no children | |
| void | addNoChildrenNode (NodeId node) |
| void | addNoChildrenNode (std::string_view node) |
remove a node with no children | |
| void | eraseNoChildrenNode (NodeId node) |
| void | eraseNoChildrenNode (std::string_view node) |
| void | setPossibleEdges (const EdgeSet &set) |
| assign a set of possible edges | |
| void | setPossibleSkeleton (const UndiGraph &skeleton) |
| assign a set of possible edges | |
assign a new possible edge | |
| |
| void | addPossibleEdge (const Edge &edge) |
| void | addPossibleEdge (NodeId tail, NodeId head) |
| void | addPossibleEdge (std::string_view tail, std::string_view head) |
remove a possible edge | |
| void | erasePossibleEdge (const Edge &edge) |
| void | erasePossibleEdge (NodeId tail, NodeId head) |
| void | erasePossibleEdge (std::string_view tail, std::string_view head) |
Multithreading | |
| void | setNumberOfThreads (Size nb) override |
| sets the number max of threads that can be used | |
redistribute signals AND implementation of interface | |
| void | setCurrentApproximationScheme (const ApproximationScheme *approximationScheme) |
| {@ /// distribute signals | |
| void | distributeProgress (const ApproximationScheme *approximationScheme, Size pourcent, double error, double time) |
| {@ /// distribute signals | |
| void | distributeStop (const ApproximationScheme *approximationScheme, std::string_view message) |
| distribute signals | |
| void | setEpsilon (double eps) override |
| Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)| If the criterion was disabled it will be enabled. | |
| double | epsilon () const override |
| Get the value of epsilon. | |
| void | disableEpsilon () override |
| Disable stopping criterion on epsilon. | |
| void | enableEpsilon () override |
| Enable stopping criterion on epsilon. | |
| bool | isEnabledEpsilon () const override |
| void | setMinEpsilonRate (double rate) override |
| 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. | |
| double | minEpsilonRate () const override |
| Get 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 |
| void | setMaxIter (Size max) override |
| stopping criterion on number of iterationsIf the criterion was disabled it will be enabled | |
| Size | maxIter () const override |
| void | disableMaxIter () override |
| Disable stopping criterion on max iterations. | |
| void | enableMaxIter () override |
| Enable stopping criterion on max iterations. | |
| bool | isEnabledMaxIter () const override |
| void | setMaxTime (double timeout) override |
| stopping criterion on timeout If the criterion was disabled it will be enabled | |
| double | maxTime () const override |
| returns the timeout (in seconds) | |
| double | currentTime () const override |
| get the current running time in second (double) | |
| void | disableMaxTime () override |
| Disable stopping criterion on timeout. | |
| void | enableMaxTime () override |
| stopping criterion on timeout If the criterion was disabled it will be enabled | |
| bool | isEnabledMaxTime () const override |
| void | setPeriodSize (Size p) override |
| how many samples between 2 stopping isEnableds | |
| Size | periodSize () const override |
| how many samples between 2 stopping isEnableds | |
| void | setVerbosity (bool v) override |
| verbosity | |
| bool | verbosity () const override |
| verbosity | |
| ApproximationSchemeSTATE | stateApproximationScheme () const override |
| history | |
| Size | nbrIterations () const override |
| const std::vector< double > & | history () const override |
EM approximation scheme for parameter learning | |
| void | EMsetEpsilon (double eps) |
| sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods | |
| double | EMEpsilon () const |
| Get the value of EM's min diff epsilon. | |
| void | EMdisableEpsilon () |
| Disable the min log-likelihood diff stopping criterion for EM. | |
| void | EMenableEpsilon () |
| Enable the log-likelihood min diff stopping criterion in EM. | |
| bool | EMisEnabledEpsilon () const |
| return true if EM's stopping criterion is the log-likelihood min diff | |
| void | EMsetMinEpsilonRate (double rate) |
| sets the stopping criterion of EM as being the minimal log-likelihood's evolution rate | |
| double | EMMinEpsilonRate () const |
| Get the value of the minimal log-likelihood evolution rate of EM. | |
| void | EMdisableMinEpsilonRate () |
| Disable the log-likelihood evolution rate stopping criterion. | |
| void | EMenableMinEpsilonRate () |
| Enable the log-likelihood evolution rate stopping criterion. | |
| bool | EMisEnabledMinEpsilonRate () const |
| void | EMsetMaxIter (Size max) |
| add a max iteration stopping criterion | |
| Size | EMMaxIter () const |
| return the max number of iterations criterion | |
| void | EMdisableMaxIter () |
| Disable stopping criterion on max iterations. | |
| void | EMenableMaxIter () |
| Enable stopping criterion on max iterations. | |
| bool | EMisEnabledMaxIter () const |
| void | EMsetMaxTime (double timeout) |
| add a stopping criterion on timeout | |
| double | EMMaxTime () const |
| @brief returns EM's timeout (in milliseconds) | |
| double | EMCurrentTime () const |
| get the current running time in second (double) | |
| void | EMdisableMaxTime () |
| Disable EM's timeout stopping criterion. | |
| void | EMenableMaxTime () |
| sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods | |
| bool | EMisEnabledMaxTime () const |
| void | EMsetPeriodSize (Size p) |
| how many samples between 2 stoppings isEnabled | |
| Size | EMPeriodSize () const |
| sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods | |
| void | EMsetVerbosity (bool v) |
| sets or unsets EM's verbosity | |
| bool | EMVerbosity () const |
| returns the EM's verbosity status | |
| ApproximationSchemeSTATE | EMStateApproximationScheme () const |
| get the current state of EM | |
| Size | EMnbrIterations () const |
| returns the number of iterations performed by the last EM execution | |
| const std::vector< double > & | EMHistory () const |
| returns the history of the last EM execution | |
Getters and setters | |
| std::string | messageApproximationScheme () const |
| Returns the approximation scheme message. | |
Accessors/Modifiers | |
| Size | getNumberOfThreads () const override |
| returns the current max number of threads used by the class containing this ThreadNumberManager | |
| bool | isGumNumberOfThreadsOverriden () const override |
| indicates whether the class containing this ThreadNumberManager set its own number of threads | |
Public Attributes | |
| Signaler< Size, double, double > | onProgress |
| Progression, error and time. | |
| Signaler< std::string_view > | onStop |
| Criteria messageApproximationScheme. | |
Protected Types | |
| enum class | IndepTestType { Chi2 , G2 } |
| independence test type for PC More... | |
Protected Member Functions | |
| PAG | learnPAG_ () |
| PDAG | learnPDAG_ () |
| void | _setPriorWeight_ (double weight) |
| sets the prior weight | |
| virtual void | createPrior_ ()=0 |
| create the prior used for learning | |
| void | createScore_ () |
| create the score used for learning | |
| ParamEstimator * | createParamEstimator_ (const DBRowGeneratorParser &parser, bool take_into_account_score=true) |
| create the parameter estimator used for learning | |
| DAG | learnDag_ () |
| returns the DAG learnt | |
| MixedGraph | prepareMiic_ () |
| prepares the initial graph for miic | |
| MixedGraph | preparePC_ () |
| prepares the initial graph and independence test for PC | |
| MixedGraph | prepareFCI_ () |
| prepares the initial graph and independence test for FCI | |
| PriorType | getPriorType_ () const |
| returns the type (as a string) of a given prior | |
| void | createCorrectedMutualInformation_ () |
| create the Corrected Mutual Information instance for Miic | |
Static Protected Member Functions | |
| static DatabaseTable | readFile_ (std::string_view filename, const std::vector< std::string > &missing_symbols) |
| reads a file and returns a databaseVectInRam | |
| static void | isCSVFileName_ (std::string_view filename) |
| checks whether the extension of a CSV filename is correct | |
Protected Attributes | |
| bool | inducedTypes_ {false} |
| the policy for typing variables | |
| ScoreType | scoreType_ {ScoreType::BDeu} |
| the score selected for learning | |
| Score * | score_ {nullptr} |
| the score used | |
| ParamEstimatorType | paramEstimatorType_ {ParamEstimatorType::ML} |
| the type of the parameter estimator | |
| bool | useEM_ {false} |
| a Boolean indicating whether we should use EM for parameter learning or not | |
| CorrectedMutualInformation * | mutualInfo_ {nullptr} |
| the selected correction for miic | |
| BNLearnerPriorType | priorType_ {BNLearnerPriorType::NO_prior} |
| the a priorselected for the score and parameters | |
| Prior * | prior_ {nullptr} |
| the prior used | |
| NoPrior * | noPrior_ {nullptr} |
| double | priorWeight_ {1.0f} |
| the weight of the prior. It is always written by the useXxxPrior() methods, which read learning.priorWeight when no weight is given. | |
| StructuralConstraintSliceOrder | constraintSliceOrder_ |
| the constraint for 2TBNs | |
| StructuralConstraintTotalOrder | constraintTotalOrder_ |
| the total order ing constraint | |
| StructuralConstraintIndegree | constraintIndegree_ |
| the constraint for indegrees | |
| StructuralConstraintTabuList | constraintTabuList_ |
| the constraint for tabu lists | |
| StructuralConstraintForbiddenArcs | constraintForbiddenArcs_ |
| the constraint on forbidden arcs | |
| StructuralConstraintPossibleEdges | constraintPossibleEdges_ |
| the constraint on possible Edges | |
| StructuralConstraintMandatoryArcs | constraintMandatoryArcs_ |
| the constraint on mandatory arcs | |
| StructuralConstraintNoParentNodes | constraintNoParentNodes_ |
| the constraint on no parent nodes | |
| StructuralConstraintNoChildrenNodes | constraintNoChildrenNodes_ |
| the constraint on no children nodes | |
| AlgoType | selectedAlgo_ {preferredAlgo()} |
| the learning algorithm ; it is initialized from the configuration, see preferredAlgo() | |
| bool | allowArcAdditions_ {true} |
| whether we allow or not arc additions during learning | |
| bool | allowArcDeletions_ {true} |
| whether we allow or not arc deletions during learning | |
| bool | allowArcReversals_ {true} |
| whether we allow or not arc reversals during learning | |
| bool | allowArcTriangleDeletions_ {true} |
| whether we allow or not arc deletions during learning | |
| K2 | algoK2_ |
| the K2 algorithm | |
| Miic | algoMiic_ |
| the Constraint MIIC algorithm | |
| CorrectedMutualInformation::KModeTypes | kmodeMiic_ |
| the penalty used in MIIC | |
| gum::learning::PC | algoPC_ |
| the PC algorithm | |
| IndepTestType | indepTestTypePC_ {IndepTestType::Chi2} |
| IndependenceTest * | indepTestPC_ {nullptr} |
| owned independence test object for PC (rebuilt before each learn call) | |
| double | alphaPc_ {gum::config().typed< double >("learning", "alpha")} |
| PC parameters the threshold of the tests ; it is initialized from the key learning.alpha. | |
| bool | stablePc_ {true} |
| Size | maxCondSetSizePc_ {Size(-1)} |
| bool | sortedUCPc_ {false} |
| gum::learning::FCI | algoFCI_ |
| the FCI algorithm | |
| IndepTestType | indepTestTypeFCI_ {IndepTestType::Chi2} |
| independence test type for FCI (reuses IndepTestType defined above) | |
| IndependenceTest * | indepTestFCI_ {nullptr} |
| owned independence test object for FCI (rebuilt before each learn call) | |
| double | alphaFci_ {gum::config().typed< double >("learning", "alpha")} |
| FCI parameters the threshold of the tests ; it is initialized from the key learning.alpha. | |
| Size | maxPathLengthFci_ {Size(-1)} |
| bool | exhaustiveSepSetFci_ {false} |
| DAG2BNLearner | dag2BN_ |
| the parametric EM | |
| GreedyHillClimbing | greedyHillClimbing_ |
| the greedy hill climbing algorithm | |
| GreedyHillClimbing | extendedGreedyHillClimbing_ |
| the extended greedy hill climbing | |
| GreedyThickThinning | greedyThickThinning_ |
| the greedy thick-thinning algorithm | |
| LocalSearchWithTabuList | localSearchWithTabuList_ |
| the local search with tabu list algorithm | |
| Database | scoreDatabase_ |
| the database to be used by the scores and parameter estimators | |
| std::vector< std::pair< std::size_t, std::size_t > > | ranges_ |
| the set of rows' ranges within the database in which learning is done | |
| Database * | priorDatabase_ {nullptr} |
| the database used by the Dirichlet a priori | |
| std::string | priorDbname_ |
| the filename for the Dirichlet a priori, if any | |
| DAG | initialDag_ |
| an initial DAG given to learners | |
| std::string | filename_ {"-"} |
| the filename database | |
| Size | tabuListSize_ {100} |
| Size | nbDecreasingChanges_ {2} |
| const ApproximationScheme * | currentAlgorithm_ {nullptr} |
Private Attributes | |
| Size | _nb_threads_ {0} |
| the max number of threads used by the class | |
Learning algorithm selection | |
| void | useGreedyHillClimbing () |
| indicate that we wish to use a greedy hill climbing algorithm | |
| void | useExtendedGreedyHillClimbing () |
| indicate that we wish to use the extended greedy hill climbing algorithm | |
| void | useLocalSearchWithTabuList (Size tabu_size, Size nb_decrease) |
| indicate that we wish to use a local search with tabu list | |
| void | useLocalSearchWithTabuList (Size tabu_size) |
| indicate that we wish to use a local search with tabu list | |
| void | useLocalSearchWithTabuList () |
| indicate that we wish to use a local search with tabu list and the default parameters | |
| void | useK2 (const Sequence< NodeId > &order) |
| indicate that we wish to use K2 | |
| void | useK2 (const std::vector< NodeId > &order) |
| indicate that we wish to use K2 | |
| void | useMIIC () |
| indicate that we wish to use MIIC | |
| void | usePC () |
| indicate that we wish to use PC (Chi2 test by default) | |
| void | useFCI () |
| indicate that we wish to use FCI (Chi2 test by default) | |
| void | useGreedyThickThinning () |
| indicate that we wish to use greedy thick-thinning | |
| void | setGreedyThickThinningReversals (bool allow) |
| enable or disable arc reversals in the thin phase of greedy thick-thinning | |
| bool | greedyThickThinningReversals () const |
| returns whether arc reversals are allowed in the thin phase of greedy thick-thinning | |
| bool | isConstraintBased () const |
| indicate if the selected algorithm is constraint-based | |
| bool | isScoreBased () const |
| indicate if the selected algorithm is score-based | |
| static AlgoType | preferredAlgo () |
| the algorithm used by the learners when none is selected explicitly | |
A pack of learning algorithms that can easily be used.
The pack currently contains K2, GreedyHillClimbing and LocalSearchWithTabuList also miic
Definition at line 105 of file IBNLearner.h.
|
strong |
an enumeration to select easily the learning algorithm to use
| Enumerator | |
|---|---|
| K2 | |
| GREEDY_HILL_CLIMBING | |
| LOCAL_SEARCH_WITH_TABU_LIST | |
| MIIC | |
| PC | |
| FCI | |
| EXTENDED_GREEDY_HILL_CLIMBING | |
| GREEDY_THICK_THINNING | |
Definition at line 126 of file IBNLearner.h.
|
stronginherited |
The different state of an approximation scheme.
| Enumerator | |
|---|---|
| Undefined | |
| Continue | |
| Epsilon | |
| Rate | |
| Limit | |
| TimeLimit | |
| Stopped | |
Definition at line 87 of file IApproximationSchemeConfiguration.h.
|
strong |
an enumeration to select the prior
| Enumerator | |
|---|---|
| NO_prior | |
| SMOOTHING | |
| DIRICHLET_FROM_DATABASE | |
| DIRICHLET_FROM_BAYESNET | |
| BDEU | |
Definition at line 117 of file IBNLearner.h.
|
strongprotected |
independence test type for PC
| Enumerator | |
|---|---|
| Chi2 | |
| G2 | |
Definition at line 1249 of file IBNLearner.h.
|
strong |
an enumeration to select the type of parameter estimation we shall apply
| Enumerator | |
|---|---|
| ML | |
Definition at line 114 of file IBNLearner.h.
|
strong |
an enumeration enabling to select easily the score we wish to use
| Enumerator | |
|---|---|
| AIC | |
| BD | |
| BDeu | |
| BIC | |
| fNML | |
| K2 | |
| LOG2LIKELIHOOD | |
| MDL | |
Definition at line 110 of file IBNLearner.h.
| gum::learning::IBNLearner::IBNLearner | ( | std::string_view | filename, |
| const std::vector< std::string > & | missingSymbols, | ||
| bool | induceTypes = true ) |
read the database file for the score / parameter estimation and var names
| filename | the name of a CSV file containing the dataset |
| missing_symbols | the set of symbols in the CSV that should be interpreted as missing values |
| induceTypes | when some columns of the dataset have only numerical values, it is certainly be better to tag them as corresponding to integer, range or continuous variables. By setting induceTypes to true (default), this is precisely what the BNLearner will do. If inducedTypes is false, all the values in the dataset are interpreted as "labels", i.e., as categorical values. |
Definition at line 201 of file IBNLearner.cpp.
References IBNLearner(), gum::learning::NoPrior::NoPrior(), gum::learning::IBNLearner::Database::databaseTable(), filename_, inducedTypes_, noPrior_, and scoreDatabase_.
Referenced by gum::learning::IBNLearner::Database::Database(), IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), ~IBNLearner(), gum::learning::BNLearner< GUM_SCALAR >::EMsetPeriodSize(), operator=(), and operator=().
|
explicit |
read the database file for the score / parameter estimation and var names
| filename | the name of a CSV file containing the dataset |
| missing_symbols | the set of symbols in the CSV that should be interpreted as missing values |
| induceTypes | when some columns of the dataset have only numerical values, it is certainly be better to tag them as corresponding to integer, range or continuous variables. By setting induceTypes to true (default), this is precisely what the BNLearner will do. If inducedTypes is false, all the values in the dataset are interpreted as "labels", i.e., as categorical values. |
Definition at line 211 of file IBNLearner.cpp.
References IBNLearner(), gum::learning::NoPrior::NoPrior(), gum::learning::IBNLearner::Database::databaseTable(), noPrior_, and scoreDatabase_.
| gum::learning::IBNLearner::IBNLearner | ( | std::string_view | filename, |
| const gum::BayesNet< GUM_SCALAR > & | src, | ||
| const std::vector< std::string > & | missing_symbols ) |
read the database file for the score / parameter estimation and var names
| filename | The file to learn from. |
| src | indicate for some nodes (not necessarily all the nodes of the BN) which modalities they should have and in which order these modalities should be stored into the nodes. For instance, if modalities = { 1 -> {True, False, Big} }, then the node of id 1 in the BN will have 3 modalities, the first one being True, the second one being False, and the third bein Big. The modalities specified by the user will be considered as being exactly those of the variables of the BN (as a consequence, if we find other values in the database, an exception will be raised during learning). |
| missing_symbols | the set of symbols in the CSV that should be interpreted as missing values |
Definition at line 101 of file IBNLearner_tpl.h.
References IBNLearner(), gum::learning::NoPrior::NoPrior(), gum::learning::IBNLearner::Database::databaseTable(), filename_, inducedTypes_, noPrior_, and scoreDatabase_.
| gum::learning::IBNLearner::IBNLearner | ( | const IBNLearner & | from | ) |
copy constructor
Definition at line 216 of file IBNLearner.cpp.
References gum::IApproximationSchemeConfiguration::IApproximationSchemeConfiguration(), IBNLearner(), gum::learning::NoPrior::NoPrior(), gum::ThreadNumberManager::ThreadNumberManager(), algoK2_, algoMiic_, allowArcAdditions_, allowArcDeletions_, allowArcReversals_, allowArcTriangleDeletions_, alphaFci_, alphaPc_, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintSliceOrder_, constraintTabuList_, dag2BN_, gum::learning::IBNLearner::Database::databaseTable(), exhaustiveSepSetFci_, extendedGreedyHillClimbing_, filename_, greedyHillClimbing_, greedyThickThinning_, indepTestTypeFCI_, indepTestTypePC_, inducedTypes_, initialDag_, kmodeMiic_, localSearchWithTabuList_, maxCondSetSizePc_, maxPathLengthFci_, nbDecreasingChanges_, noPrior_, paramEstimatorType_, priorDbname_, priorType_, priorWeight_, ranges_, scoreDatabase_, scoreType_, selectedAlgo_, sortedUCPc_, stablePc_, tabuListSize_, and useEM_.
| gum::learning::IBNLearner::IBNLearner | ( | IBNLearner && | from | ) |
move constructor
Definition at line 247 of file IBNLearner.cpp.
References IBNLearner(), gum::learning::NoPrior::NoPrior(), gum::ThreadNumberManager::ThreadNumberManager(), algoK2_, algoMiic_, allowArcAdditions_, allowArcDeletions_, allowArcReversals_, allowArcTriangleDeletions_, alphaFci_, alphaPc_, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintSliceOrder_, constraintTabuList_, dag2BN_, gum::learning::IBNLearner::Database::databaseTable(), exhaustiveSepSetFci_, extendedGreedyHillClimbing_, filename_, greedyHillClimbing_, greedyThickThinning_, indepTestTypeFCI_, indepTestTypePC_, inducedTypes_, initialDag_, kmodeMiic_, localSearchWithTabuList_, maxCondSetSizePc_, maxPathLengthFci_, nbDecreasingChanges_, noPrior_, paramEstimatorType_, priorDbname_, priorType_, priorWeight_, ranges_, scoreDatabase_, scoreType_, selectedAlgo_, sortedUCPc_, stablePc_, tabuListSize_, and useEM_.
|
override |
destructor
Definition at line 279 of file IBNLearner.cpp.
References IBNLearner(), indepTestFCI_, indepTestPC_, mutualInfo_, noPrior_, prior_, priorDatabase_, and score_.
|
protected |
sets the prior weight
Definition at line 675 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), GUM_ERROR, and priorWeight_.
Referenced by useBDeuPrior(), useDirichletPrior(), and useSmoothingPrior().
| INLINE void gum::learning::IBNLearner::addForbiddenArc | ( | const Arc & | arc | ) |
Definition at line 548 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintForbiddenArcs::addArc(), and constraintForbiddenArcs_.
Referenced by addForbiddenArc(), and addForbiddenArc().
Definition at line 556 of file IBNLearner_inl.h.
References gum::Arc::Arc(), and addForbiddenArc().
| INLINE void gum::learning::IBNLearner::addForbiddenArc | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 566 of file IBNLearner_inl.h.
References gum::Arc::Arc(), addForbiddenArc(), and idFromName().
| INLINE void gum::learning::IBNLearner::addMandatoryArc | ( | const Arc & | arc | ) |
Definition at line 581 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintMandatoryArcs::addArc(), and constraintMandatoryArcs_.
Referenced by addMandatoryArc(), and addMandatoryArc().
Definition at line 629 of file IBNLearner_inl.h.
References gum::Arc::Arc(), and addMandatoryArc().
| INLINE void gum::learning::IBNLearner::addMandatoryArc | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 619 of file IBNLearner_inl.h.
References gum::Arc::Arc(), addMandatoryArc(), and idFromName().
| INLINE void gum::learning::IBNLearner::addNoChildrenNode | ( | NodeId | node | ) |
Definition at line 602 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintNoChildrenNodes::addNode(), and constraintNoChildrenNodes_.
Referenced by addNoChildrenNode().
| INLINE void gum::learning::IBNLearner::addNoChildrenNode | ( | std::string_view | node | ) |
Definition at line 606 of file IBNLearner_inl.h.
References addNoChildrenNode(), and idFromName().
| INLINE void gum::learning::IBNLearner::addNoParentNode | ( | NodeId | node | ) |
Definition at line 588 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintNoParentNodes::addNode(), and constraintNoParentNodes_.
Referenced by addNoParentNode().
| INLINE void gum::learning::IBNLearner::addNoParentNode | ( | std::string_view | node | ) |
Definition at line 590 of file IBNLearner_inl.h.
References addNoParentNode(), and idFromName().
| INLINE void gum::learning::IBNLearner::addPossibleEdge | ( | const Edge & | edge | ) |
Definition at line 513 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintPossibleEdges::addEdge(), and constraintPossibleEdges_.
Referenced by addPossibleEdge(), and addPossibleEdge().
Definition at line 523 of file IBNLearner_inl.h.
References gum::Edge::Edge(), and addPossibleEdge().
| INLINE void gum::learning::IBNLearner::addPossibleEdge | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 533 of file IBNLearner_inl.h.
References gum::Edge::Edge(), addPossibleEdge(), and idFromName().
| INLINE void gum::learning::IBNLearner::allowArcAdditions | ( | bool | allow = true | ) |
allow (true)/forbid (false) to add arcs during learning.
This affects only Extended Greedy Hill Climbing and Local Search with Tabu List. Greedy Hill Climbing and K2 always allow arc additions.
Definition at line 485 of file IBNLearner_inl.h.
References allowArcAdditions_.
| INLINE void gum::learning::IBNLearner::allowArcDeletions | ( | bool | allow = true | ) |
allow (true)/forbid (false) to delete arcs during learning.
This affects only Extended Greedy Hill Climbing and Local Search with Tabu List. Greedy Hill Climbing always allows arc deletions while K2 always forbid them. If you wish a K2-like algorithm that enables arc deletions, use and extended greedy hill climbing combined with a TotalOrder constraint.
Definition at line 488 of file IBNLearner_inl.h.
References allowArcDeletions_.
| INLINE void gum::learning::IBNLearner::allowArcReversals | ( | bool | allow = true | ) |
allow (true)/forbid (false) to reverse arcs during learning.
This affects only Extended Greedy Hill Climbing and Local Search with Tabu List. Greedy Hill Climbing always allows arc reversals while K2 always forbid them (due to its total ordering constraint).
Definition at line 491 of file IBNLearner_inl.h.
References allowArcReversals_.
| INLINE void gum::learning::IBNLearner::allowArcTriangleDeletions | ( | bool | allow = true | ) |
allow (true)/forbid (false) to delete arc triangles during learning.
This affects only Extended Greedy Hill Climbing and Local Search with Tabu List. Greedy Hill Climbing and K2 always forbid arc triangle deletions.
Definition at line 494 of file IBNLearner_inl.h.
References allowArcTriangleDeletions_.
| std::string gum::learning::IBNLearner::checkScorePriorCompatibility | ( | ) | const |
checks whether the current score and prior are compatible
Definition at line 1300 of file IBNLearner.cpp.
References getPriorType_(), isConstraintBased(), gum::learning::ScoreAIC::isPriorCompatible(), gum::learning::ScoreBD::isPriorCompatible(), gum::learning::ScoreBDeu::isPriorCompatible(), gum::learning::ScoreBIC::isPriorCompatible(), gum::learning::ScorefNML::isPriorCompatible(), gum::learning::ScoreK2::isPriorCompatible(), gum::learning::ScoreLog2Likelihood::isPriorCompatible(), priorWeight_, and scoreType_.
Referenced by _setPriorWeight_(), useBDeuPrior(), useDirichletPrior(), useNoPrior(), useScoreAIC(), useScoreBD(), useScoreBDeu(), useScoreBIC(), useScorefNML(), useScoreK2(), useScoreLog2Likelihood(), useScoreMDL(), and useSmoothingPrior().
| std::pair< double, double > gum::learning::IBNLearner::chi2 | ( | NodeId | id1, |
| NodeId | id2, | ||
| const std::vector< NodeId > & | knowing = {} ) |
Return the <statistic,pvalue> pair for chi2 test in the database.
| id1 | first variable |
| id2 | second variable |
| knowing | list of observed variables |
Definition at line 1368 of file IBNLearner.cpp.
References createPrior_(), databaseRanges(), gum::learning::IBNLearner::Database::parser(), prior_, scoreDatabase_, and gum::learning::IndepTestChi2::statistics().
Referenced by chi2().
| std::pair< double, double > gum::learning::IBNLearner::chi2 | ( | std::string_view | name1, |
| std::string_view | name2, | ||
| const std::vector< std::string > & | knowing = {} ) |
Return the <statistic,pvalue> pair for the BNLearner.
| id1 | first variable |
| id2 | second variable |
| knowing | list of observed variables |
Definition at line 1375 of file IBNLearner.cpp.
References chi2(), and idFromName().
| INLINE void gum::learning::IBNLearner::clearDatabaseRanges | ( | ) |
reset the ranges to the one range corresponding to the whole database
Definition at line 775 of file IBNLearner_inl.h.
References ranges_.
| double gum::learning::IBNLearner::correctedMutualInformation | ( | NodeId | id1, |
| NodeId | id2, | ||
| const std::vector< NodeId > & | knowing = {} ) |
Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner.
| id1 | nodeId |
| id2 | nodeId |
| knowing | an optional vector of conditioning NodeIds |
Definition at line 1433 of file IBNLearner.cpp.
References createPrior_(), databaseRanges(), GUM_ERROR, kmodeMiic_, gum::learning::IBNLearner::Database::parser(), prior_, gum::learning::CorrectedMutualInformation::score(), scoreDatabase_, gum::learning::CorrectedMutualInformation::useMDL(), gum::learning::CorrectedMutualInformation::useNML(), gum::learning::CorrectedMutualInformation::useNoCorr(), and gum::learning::IBNLearner::Database::weight().
Referenced by correctedMutualInformation().
| double gum::learning::IBNLearner::correctedMutualInformation | ( | std::string_view | var1, |
| std::string_view | var2, | ||
| const std::vector< std::string > & | knowing = {} ) |
Return the mutual information of var1 and var2 in the base, conditioned by knowing for the BNLearner.
| var1 | name of a row |
| var2 | name of a row |
| knowing | an optional vector of conditioning rows |
Definition at line 1458 of file IBNLearner.cpp.
References correctedMutualInformation(), and idFromName().
|
protected |
create the Corrected Mutual Information instance for Miic
Definition at line 996 of file IBNLearner.cpp.
References gum::learning::CorrectedMutualInformation::CorrectedMutualInformation(), GUM_ERROR, kmodeMiic_, mutualInfo_, gum::learning::IBNLearner::Database::nodeId2Columns(), noPrior_, gum::learning::IBNLearner::Database::parser(), ranges_, scoreDatabase_, gum::learning::CorrectedMutualInformation::useMDL(), gum::learning::CorrectedMutualInformation::useNML(), and gum::learning::CorrectedMutualInformation::useNoCorr().
Referenced by createPrior_(), and prepareMiic_().
|
protected |
create the parameter estimator used for learning
Definition at line 589 of file IBNLearner.cpp.
References gum::learning::ParamEstimatorML::ParamEstimatorML(), gum::ThreadNumberManager::getNumberOfThreads(), GUM_ERROR, gum::learning::Score::internalPrior(), gum::ThreadNumberManager::isGumNumberOfThreadsOverriden(), ML, gum::learning::IBNLearner::Database::nodeId2Columns(), noPrior_, paramEstimatorType_, prior_, ranges_, score_, scoreDatabase_, gum::learning::ParamEstimator::setNumberOfThreads(), and gum::learning::ParamEstimator::setRanges().
Referenced by createPrior_().
|
protectedpure virtual |
create the prior used for learning
Implemented in gum::learning::BNLearner< GUM_SCALAR >.
References createCorrectedMutualInformation_(), createParamEstimator_(), createScore_(), currentTime(), disableEpsilon(), disableMaxIter(), disableMaxTime(), disableMinEpsilonRate(), distributeProgress(), distributeStop(), EMCurrentTime(), EMdisableEpsilon(), EMdisableMaxIter(), EMdisableMaxTime(), EMdisableMinEpsilonRate(), EMenableEpsilon(), EMenableMaxIter(), EMenableMaxTime(), EMenableMinEpsilonRate(), EMEpsilon(), EMHistory(), EMisEnabledEpsilon(), EMisEnabledMaxIter(), EMisEnabledMaxTime(), EMisEnabledMinEpsilonRate(), EMMaxIter(), EMMaxTime(), EMMinEpsilonRate(), EMnbrIterations(), EMPeriodSize(), EMsetEpsilon(), EMsetMaxIter(), EMsetMaxTime(), EMsetMinEpsilonRate(), EMsetPeriodSize(), EMsetVerbosity(), EMStateApproximationScheme(), EMVerbosity(), enableEpsilon(), enableMaxIter(), enableMaxTime(), enableMinEpsilonRate(), epsilon(), getPriorType_(), history(), isEnabledEpsilon(), isEnabledMaxIter(), isEnabledMaxTime(), isEnabledMinEpsilonRate(), learnDag_(), maxIter(), maxTime(), minEpsilonRate(), nbrIterations(), periodSize(), prepareFCI_(), prepareMiic_(), preparePC_(), setCurrentApproximationScheme(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), setVerbosity(), stateApproximationScheme(), and verbosity().
Referenced by chi2(), correctedMutualInformation(), G2(), learnDAG(), logLikelihood(), rawPseudoCount(), and score().
|
protected |
create the score used for learning
Definition at line 516 of file IBNLearner.cpp.
References gum::learning::ScoreAIC::ScoreAIC(), gum::learning::ScoreBD::ScoreBD(), gum::learning::ScoreBDeu::ScoreBDeu(), gum::learning::ScoreBIC::ScoreBIC(), gum::learning::ScorefNML::ScorefNML(), gum::learning::ScoreK2::ScoreK2(), gum::learning::ScoreLog2Likelihood::ScoreLog2Likelihood(), AIC, BD, BDeu, BIC, fNML, gum::ThreadNumberManager::getNumberOfThreads(), GUM_ERROR, gum::ThreadNumberManager::isGumNumberOfThreadsOverriden(), K2, LOG2LIKELIHOOD, MDL, gum::learning::IBNLearner::Database::nodeId2Columns(), gum::learning::IBNLearner::Database::parser(), prior_, ranges_, score_, scoreDatabase_, scoreType_, and gum::learning::Score::setNumberOfThreads().
Referenced by createPrior_(), learnDAG(), and score().
|
overridevirtual |
get the current running time in second (double)
Implements gum::IApproximationSchemeConfiguration.
Definition at line 936 of file IBNLearner_inl.h.
References currentAlgorithm_, gum::ApproximationScheme::currentTime(), and GUM_ERROR.
Referenced by createPrior_().
| INLINE const DatabaseTable & gum::learning::IBNLearner::database | ( | ) | const |
returns the database used by the BNLearner
Definition at line 778 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::databaseTable(), and scoreDatabase_.
Referenced by readFile_().
| INLINE const std::vector< std::pair< std::size_t, std::size_t > > & gum::learning::IBNLearner::databaseRanges | ( | ) | const |
returns the current database rows' ranges used for learning
Definition at line 770 of file IBNLearner_inl.h.
References ranges_.
Referenced by chi2(), correctedMutualInformation(), G2(), logLikelihood(), mutualInformation(), and rawPseudoCount().
| INLINE double gum::learning::IBNLearner::databaseWeight | ( | ) | const |
returns the weight of the whole database
Definition at line 162 of file IBNLearner_inl.h.
References scoreDatabase_, and gum::learning::IBNLearner::Database::weight().
|
overridevirtual |
Disable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 843 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::disableEpsilon(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Disable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 905 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::disableMaxIter(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Disable stopping criterion on timeout.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 941 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::disableMaxTime(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Disable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 874 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::disableMinEpsilonRate(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::distributeProgress | ( | const ApproximationScheme * | approximationScheme, |
| Size | pourcent, | ||
| double | error, | ||
| double | time ) |
{@ /// distribute signals
Definition at line 817 of file IBNLearner_inl.h.
References GUM_EMIT3, gum::__sig__::BasicSignaler< Args... >::hasListener(), gum::IApproximationSchemeConfiguration::onProgress, and setCurrentApproximationScheme().
Referenced by createPrior_(), and gum::learning::BNLearnerListener::whenProgress().
| INLINE void gum::learning::IBNLearner::distributeStop | ( | const ApproximationScheme * | approximationScheme, |
| std::string_view | message ) |
distribute signals
Definition at line 825 of file IBNLearner_inl.h.
References GUM_EMIT1, gum::__sig__::BasicSignaler< Args... >::hasListener(), gum::IApproximationSchemeConfiguration::onStop, and setCurrentApproximationScheme().
Referenced by createPrior_(), and gum::learning::BNLearnerListener::whenStop().
learn a structure from a file (must have read the db before)
Definition at line 761 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::domainSizes(), and scoreDatabase_.
| INLINE Size gum::learning::IBNLearner::domainSize | ( | std::string_view | var | ) | const |
learn a structure from a file (must have read the db before)
Definition at line 764 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::domainSizes(), idFromName(), and scoreDatabase_.
| INLINE const std::vector< std::size_t > & gum::learning::IBNLearner::domainSizes | ( | ) | const |
returns the domain sizes of the variables in the database
Definition at line 756 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::domainSizes(), and scoreDatabase_.
| INLINE EMApproximationScheme & gum::learning::IBNLearner::EM | ( | ) |
returns the EM parameter learning approximation scheme if EM is enabled
returns the EM parameter learning approximation scheme
| NotFound | is raised if EM() is called while the EM algorithm has not been enabled by useEM(), useEMWithDiffCriterion() or useEMWithRateCriterion(). |
Definition at line 467 of file IBNLearner_inl.h.
| INLINE double gum::learning::IBNLearner::EMCurrentTime | ( | ) | const |
get the current running time in second (double)
Definition at line 1038 of file IBNLearner_inl.h.
References gum::ApproximationScheme::currentTime(), and dag2BN_.
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMdisableEpsilon | ( | ) |
Disable the min log-likelihood diff stopping criterion for EM.
Definition at line 1006 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::disableEpsilon().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMdisableMaxIter | ( | ) |
Disable stopping criterion on max iterations.
Definition at line 1028 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::disableMaxIter().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMdisableMaxTime | ( | ) |
Disable EM's timeout stopping criterion.
Definition at line 1040 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::disableMaxTime().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMdisableMinEpsilonRate | ( | ) |
Disable the log-likelihood evolution rate stopping criterion.
Definition at line 1016 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::disableMinEpsilonRate().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMenableEpsilon | ( | ) |
Enable the log-likelihood min diff stopping criterion in EM.
Definition at line 1008 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::enableEpsilon().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMenableMaxIter | ( | ) |
Enable stopping criterion on max iterations.
Definition at line 1030 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::enableMaxIter().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMenableMaxTime | ( | ) |
sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods
| eps | the log-likelihood difference below which EM stops its iterations |
| OutOfBounds | if eps <= 0 |
Definition at line 1042 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::enableMaxTime().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMenableMinEpsilonRate | ( | ) |
Enable the log-likelihood evolution rate stopping criterion.
Definition at line 1018 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::enableMinEpsilonRate().
Referenced by createPrior_().
| INLINE double gum::learning::IBNLearner::EMEpsilon | ( | ) | const |
Get the value of EM's min diff epsilon.
Get the value of EM's min diff epsilon
Definition at line 1004 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::epsilon().
Referenced by createPrior_().
| INLINE const std::vector< double > & gum::learning::IBNLearner::EMHistory | ( | ) | const |
returns the history of the last EM execution
Definition at line 1061 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::history().
Referenced by createPrior_().
| INLINE bool gum::learning::IBNLearner::EMisEnabledEpsilon | ( | ) | const |
return true if EM's stopping criterion is the log-likelihood min diff
Definition at line 1010 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::isEnabledEpsilon().
Referenced by createPrior_().
| INLINE bool gum::learning::IBNLearner::EMisEnabledMaxIter | ( | ) | const |
Definition at line 1032 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::isEnabledMaxIter().
Referenced by createPrior_().
| INLINE bool gum::learning::IBNLearner::EMisEnabledMaxTime | ( | ) | const |
Definition at line 1044 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::isEnabledMaxTime().
Referenced by createPrior_().
| INLINE bool gum::learning::IBNLearner::EMisEnabledMinEpsilonRate | ( | ) | const |
Definition at line 1020 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::isEnabledMinEpsilonRate().
Referenced by createPrior_().
| INLINE Size gum::learning::IBNLearner::EMMaxIter | ( | ) | const |
return the max number of iterations criterion
Definition at line 1026 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::maxIter().
Referenced by createPrior_().
| INLINE double gum::learning::IBNLearner::EMMaxTime | ( | ) | const |
@brief returns EM's timeout (in milliseconds)
Definition at line 1036 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::maxTime().
Referenced by createPrior_().
| INLINE double gum::learning::IBNLearner::EMMinEpsilonRate | ( | ) | const |
Get the value of the minimal log-likelihood evolution rate of EM.
Definition at line 1014 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::minEpsilonRate().
Referenced by createPrior_().
| INLINE Size gum::learning::IBNLearner::EMnbrIterations | ( | ) | const |
returns the number of iterations performed by the last EM execution
Definition at line 1059 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::nbrIterations().
Referenced by createPrior_().
| INLINE Size gum::learning::IBNLearner::EMPeriodSize | ( | ) | const |
sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods
| eps | the log-likelihood difference below which EM stops its iterations |
| OutOfBounds | if eps <= 0 |
Definition at line 1048 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::periodSize().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetEpsilon | ( | double | eps | ) |
sets the stopping criterion of EM as being the minimal difference between two consecutive log-likelihoods
| eps | the log-likelihood difference below which EM stops its iterations |
| OutOfBounds | if eps <= 0 |
Definition at line 1002 of file IBNLearner_inl.h.
References dag2BN_, and gum::learning::EMApproximationScheme::setEpsilon().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetMaxIter | ( | Size | max | ) |
add a max iteration stopping criterion
| max | the max number of iterations that EM is allowed to perform |
| OutOfBounds | if max<=1 |
Definition at line 1024 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::setMaxIter().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetMaxTime | ( | double | timeout | ) |
add a stopping criterion on timeout
| timeout | the timeout in milliseconds |
| OutOfBounds | if timeout<=0.0 |
Definition at line 1034 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::setMaxTime().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetMinEpsilonRate | ( | double | rate | ) |
sets the stopping criterion of EM as being the minimal log-likelihood's evolution rate
| rate | the log-likelihood evolution rate below which EM stops its iterations |
| OutOfBounds | if rate<=0 |
Definition at line 1012 of file IBNLearner_inl.h.
References dag2BN_, and gum::learning::EMApproximationScheme::setMinEpsilonRate().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetPeriodSize | ( | Size | p | ) |
how many samples between 2 stoppings isEnabled
| OutOfBounds | if p<1 |
Definition at line 1046 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::setPeriodSize().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::EMsetVerbosity | ( | bool | v | ) |
sets or unsets EM's verbosity
Definition at line 1050 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::setVerbosity().
Referenced by createPrior_().
| INLINE IApproximationSchemeConfiguration::ApproximationSchemeSTATE gum::learning::IBNLearner::EMState | ( | ) | const |
returns the state of the last EM algorithm executed
Definition at line 473 of file IBNLearner_inl.h.
References dag2BN_, gum::ApproximationScheme::stateApproximationScheme(), gum::IApproximationSchemeConfiguration::Undefined, and useEM_.
| INLINE IApproximationSchemeConfiguration::ApproximationSchemeSTATE gum::learning::IBNLearner::EMStateApproximationScheme | ( | ) | const |
get the current state of EM
Definition at line 1055 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::stateApproximationScheme().
Referenced by createPrior_().
| INLINE std::string gum::learning::IBNLearner::EMStateMessage | ( | ) | const |
returns the state of the EM algorithm
Definition at line 479 of file IBNLearner_inl.h.
References dag2BN_, gum::IApproximationSchemeConfiguration::messageApproximationScheme(), and useEM_.
| INLINE bool gum::learning::IBNLearner::EMVerbosity | ( | ) | const |
returns the EM's verbosity status
Definition at line 1052 of file IBNLearner_inl.h.
References dag2BN_, and gum::ApproximationScheme::verbosity().
Referenced by createPrior_().
|
overridevirtual |
Enable stopping criterion on epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 850 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::enableEpsilon(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Enable stopping criterion on max iterations.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 912 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::enableMaxIter(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
stopping criterion on timeout If the criterion was disabled it will be enabled
| OutOfBounds | if timeout<=0.0 timeout is time in second (double). |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 948 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::enableMaxTime(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Enable stopping criterion on epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 881 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, gum::ApproximationScheme::enableMinEpsilonRate(), greedyHillClimbing_, and localSearchWithTabuList_.
Referenced by createPrior_().
|
overridevirtual |
Get the value of epsilon.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 838 of file IBNLearner_inl.h.
References currentAlgorithm_, gum::ApproximationScheme::epsilon(), and GUM_ERROR.
Referenced by createPrior_(), gum::learning::BNLearner< GUM_SCALAR >::useEM(), gum::learning::BNLearner< GUM_SCALAR >::useEM(), useEM(), useEM(), gum::learning::BNLearner< GUM_SCALAR >::useEMWithDiffCriterion(), gum::learning::BNLearner< GUM_SCALAR >::useEMWithDiffCriterion(), useEMWithDiffCriterion(), useEMWithDiffCriterion(), gum::learning::BNLearner< GUM_SCALAR >::useEMWithRateCriterion(), gum::learning::BNLearner< GUM_SCALAR >::useEMWithRateCriterion(), useEMWithRateCriterion(), and useEMWithRateCriterion().
| INLINE void gum::learning::IBNLearner::eraseForbiddenArc | ( | const Arc & | arc | ) |
Definition at line 551 of file IBNLearner_inl.h.
References constraintForbiddenArcs_, and gum::learning::StructuralConstraintForbiddenArcs::eraseArc().
Referenced by eraseForbiddenArc(), and eraseForbiddenArc().
Definition at line 561 of file IBNLearner_inl.h.
References gum::Arc::Arc(), and eraseForbiddenArc().
| INLINE void gum::learning::IBNLearner::eraseForbiddenArc | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 571 of file IBNLearner_inl.h.
References gum::Arc::Arc(), eraseForbiddenArc(), and idFromName().
| INLINE void gum::learning::IBNLearner::eraseMandatoryArc | ( | const Arc & | arc | ) |
Definition at line 584 of file IBNLearner_inl.h.
References constraintMandatoryArcs_, and gum::learning::StructuralConstraintMandatoryArcs::eraseArc().
Referenced by eraseMandatoryArc(), and eraseMandatoryArc().
Definition at line 634 of file IBNLearner_inl.h.
References gum::Arc::Arc(), and eraseMandatoryArc().
| INLINE void gum::learning::IBNLearner::eraseMandatoryArc | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 624 of file IBNLearner_inl.h.
References gum::Arc::Arc(), eraseMandatoryArc(), and idFromName().
| INLINE void gum::learning::IBNLearner::eraseNoChildrenNode | ( | NodeId | node | ) |
Definition at line 610 of file IBNLearner_inl.h.
References constraintNoChildrenNodes_, and gum::learning::StructuralConstraintNoChildrenNodes::eraseNode().
Referenced by eraseNoChildrenNode().
| INLINE void gum::learning::IBNLearner::eraseNoChildrenNode | ( | std::string_view | node | ) |
Definition at line 614 of file IBNLearner_inl.h.
References eraseNoChildrenNode(), and idFromName().
| INLINE void gum::learning::IBNLearner::eraseNoParentNode | ( | NodeId | node | ) |
Definition at line 594 of file IBNLearner_inl.h.
References constraintNoParentNodes_, and gum::learning::StructuralConstraintNoParentNodes::eraseNode().
Referenced by eraseNoParentNode().
| INLINE void gum::learning::IBNLearner::eraseNoParentNode | ( | std::string_view | node | ) |
Definition at line 598 of file IBNLearner_inl.h.
References eraseNoParentNode(), and idFromName().
| INLINE void gum::learning::IBNLearner::erasePossibleEdge | ( | const Edge & | edge | ) |
Definition at line 518 of file IBNLearner_inl.h.
References constraintPossibleEdges_, and gum::learning::StructuralConstraintPossibleEdges::eraseEdge().
Referenced by erasePossibleEdge(), and erasePossibleEdge().
Definition at line 528 of file IBNLearner_inl.h.
References gum::Edge::Edge(), and erasePossibleEdge().
| INLINE void gum::learning::IBNLearner::erasePossibleEdge | ( | std::string_view | tail, |
| std::string_view | head ) |
Definition at line 538 of file IBNLearner_inl.h.
References gum::Edge::Edge(), erasePossibleEdge(), and idFromName().
| INLINE bool gum::learning::IBNLearner::fciExhaustiveSepSet | ( | ) | const |
return true when FCI uses exhaustive sepset mode
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 272 of file IBNLearner_inl.h.
References exhaustiveSepSetFci_, FCI, GUM_ERROR, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::forbidEM | ( | ) |
prevent using the EM algorithm for parameter learning
forbid to use EM
Definition at line 461 of file IBNLearner_inl.h.
References useEM_.
| std::pair< double, double > gum::learning::IBNLearner::G2 | ( | NodeId | id1, |
| NodeId | id2, | ||
| const std::vector< NodeId > & | knowing = {} ) |
Return the <statistic,pvalue> pair for for G2 test in the database.
| id1 | first variable |
| id2 | second variable |
| knowing | list of observed variables |
Definition at line 1387 of file IBNLearner.cpp.
References createPrior_(), databaseRanges(), gum::learning::IBNLearner::Database::parser(), prior_, scoreDatabase_, and gum::learning::IndepTestG2::statistics().
Referenced by G2().
| std::pair< double, double > gum::learning::IBNLearner::G2 | ( | std::string_view | name1, |
| std::string_view | name2, | ||
| const std::vector< std::string > & | knowing = {} ) |
Return the <statistic,pvalue> pair for for G2 test in the database.
| id1 | first variable |
| id2 | second variable |
| knowing | list of observed variables |
Definition at line 1393 of file IBNLearner.cpp.
References G2(), and idFromName().
|
nodiscardoverridevirtualinherited |
returns the current max number of threads used by the class containing this ThreadNumberManager
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), gum::learning::IBNLearner::createScore_(), gum::credal::InferenceEngine< GUM_SCALAR >::dispatchMarginalsToThreads_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::enum_combi_(), gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::expFusion_(), gum::ScheduledInference::operator=(), gum::ScheduledInference::operator=(), gum::ScheduledInference::scheduler(), and gum::credal::MultipleInferenceEngine< GUM_SCALAR, BNInferenceEngine >::verticesFusion_().
|
protected |
returns the type (as a string) of a given prior
Definition at line 735 of file IBNLearner_inl.h.
References gum::learning::BDeuPriorType, gum::learning::DirichletPriorType, GUM_ERROR, gum::learning::NoPriorType, priorType_, and gum::learning::SmoothingPriorType.
Referenced by checkScorePriorCompatibility(), and createPrior_().
| INLINE bool gum::learning::IBNLearner::greedyThickThinningReversals | ( | ) | const |
returns whether arc reversals are allowed in the thin phase of greedy thick-thinning
Definition at line 383 of file IBNLearner_inl.h.
References gum::learning::GreedyThickThinning::allowReversalsInThinPhase(), and greedyThickThinning_.
| INLINE bool gum::learning::IBNLearner::hasMissingValues | ( | ) | const |
returns true if the learner's database has missing values
Definition at line 498 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::databaseTable(), gum::learning::IDatabaseTable< T_DATA >::hasMissingValues(), and scoreDatabase_.
Referenced by rawPseudoCount().
|
overridevirtual |
| OperationNotAllowed | if scheme not performed or verbosity=false |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 995 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::history().
Referenced by createPrior_().
| INLINE NodeId gum::learning::IBNLearner::idFromName | ( | std::string_view | var_name | ) | const |
returns the node id corresponding to a variable name
| MissingVariableInDatabase | if a variable of the BN is not found in the database. |
Definition at line 137 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::idFromName(), and scoreDatabase_.
Referenced by addForbiddenArc(), addMandatoryArc(), addNoChildrenNode(), addNoParentNode(), addPossibleEdge(), chi2(), correctedMutualInformation(), domainSize(), eraseForbiddenArc(), eraseMandatoryArc(), eraseNoChildrenNode(), eraseNoParentNode(), erasePossibleEdge(), G2(), logLikelihood(), mutualInformation(), rawPseudoCount(), score(), setSliceOrder(), and setTotalOrder().
| INLINE DAG gum::learning::IBNLearner::initialDAG | ( | ) |
returns the initial DAG structure
Definition at line 167 of file IBNLearner_inl.h.
References initialDag_.
| INLINE bool gum::learning::IBNLearner::isConstraintBased | ( | ) | const |
indicate if the selected algorithm is constraint-based
Definition at line 796 of file IBNLearner_inl.h.
References EXTENDED_GREEDY_HILL_CLIMBING, FCI, GREEDY_HILL_CLIMBING, GREEDY_THICK_THINNING, K2, LOCAL_SEARCH_WITH_TABU_LIST, MIIC, PC, and selectedAlgo_.
Referenced by checkScorePriorCompatibility(), and isScoreBased().
|
staticprotected |
checks whether the extension of a CSV filename is correct
Definition at line 474 of file IBNLearner.cpp.
References GUM_ERROR.
Referenced by gum::learning::IBNLearner::Database::Database(), gum::learning::IBNLearner::Database::Database(), and readFile_().
|
overridevirtual |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 857 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::isEnabledEpsilon().
Referenced by createPrior_().
|
overridevirtual |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 919 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::isEnabledMaxIter().
Referenced by createPrior_().
|
overridevirtual |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 955 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::isEnabledMaxTime().
Referenced by createPrior_().
|
overridevirtual |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 888 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::isEnabledMinEpsilonRate().
Referenced by createPrior_().
|
nodiscardoverridevirtualinherited |
indicates whether the class containing this ThreadNumberManager set its own number of threads
Implements gum::IThreadNumberManager.
Referenced by gum::learning::IBNLearner::createParamEstimator_(), gum::learning::IBNLearner::createScore_(), gum::ScheduledInference::operator=(), and gum::ScheduledInference::operator=().
| INLINE bool gum::learning::IBNLearner::isScoreBased | ( | ) | const |
indicate if the selected algorithm is score-based
Definition at line 810 of file IBNLearner_inl.h.
References isConstraintBased().
| INLINE bool gum::learning::IBNLearner::isUsingEM | ( | ) | const |
indicates whether we use EM for parameter learning
Definition at line 464 of file IBNLearner_inl.h.
References useEM_.
| INLINE std::vector< Arc > gum::learning::IBNLearner::latentVariables | ( | ) | const |
get the list of arcs hiding latent variables
| OperationNotAllowed | when MIIC is not the selected algorithm |
Definition at line 346 of file IBNLearner_inl.h.
References algoMiic_, and gum::learning::ConstraintBasedLearning::latentVariables().
| DAG gum::learning::IBNLearner::learnDAG | ( | ) |
learn a structure from a file (must have read the db before)
Definition at line 986 of file IBNLearner.cpp.
References createPrior_(), createScore_(), gum::learning::IBNLearner::Database::databaseTable(), learnDag_(), scoreDatabase_, and gum::learning::IDatabaseTable< T_DATA >::variableName().
|
protected |
returns the DAG learnt
Definition at line 1015 of file IBNLearner.cpp.
References gum::DAG::addArc(), gum::NodeGraphPart::addNodeWithId(), algoFCI_, algoK2_, algoMiic_, algoPC_, allowArcAdditions_, allowArcDeletions_, allowArcReversals_, allowArcTriangleDeletions_, gum::learning::K2::approximationScheme(), gum::learning::StructuralConstraintForbiddenArcs::arcs(), gum::learning::StructuralConstraintMandatoryArcs::arcs(), constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintPossibleEdges_, constraintSliceOrder_, constraintTabuList_, constraintTotalOrder_, gum::learning::IBNLearner::Database::databaseTable(), DIRICHLET_FROM_DATABASE, gum::ArcGraphPart::eraseArc(), gum::NodeGraphPart::exists(), EXTENDED_GREEDY_HILL_CLIMBING, extendedGreedyHillClimbing_, FCI, GREEDY_HILL_CLIMBING, GREEDY_THICK_THINNING, greedyHillClimbing_, greedyThickThinning_, GUM_ERROR, gum::learning::IDatabaseTable< T_DATA >::hasMissingValues(), initialDag_, K2, gum::learning::ConstraintBasedLearning::learnDAG(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::GreedyThickThinning::learnStructure(), gum::learning::K2::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), LOCAL_SEARCH_WITH_TABU_LIST, localSearchWithTabuList_, MIIC, mutualInfo_, gum::learning::K2::order(), PC, gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::pos(), prepareFCI_(), prepareMiic_(), preparePC_(), priorDatabase_, priorType_, score_, scoreDatabase_, selectedAlgo_, gum::learning::Miic::setMutualInformation(), gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcAdditions(), gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcDeletions(), gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcReversals(), and gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcTriangleDeletions().
Referenced by createPrior_(), and learnDAG().
| PAG gum::learning::IBNLearner::learnPAG | ( | ) |
learn a PAG — only valid when useFCI() has been called
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 978 of file IBNLearner.cpp.
References gum::learning::IBNLearner::Database::databaseTable(), learnPAG_(), scoreDatabase_, and gum::learning::IDatabaseTable< T_DATA >::variableName().
|
protected |
Definition at line 964 of file IBNLearner.cpp.
References algoFCI_, gum::learning::IBNLearner::Database::databaseTable(), FCI, GUM_ERROR, gum::learning::IDatabaseTable< T_DATA >::hasMissingValues(), gum::learning::FCI::learnPAG(), prepareFCI_(), scoreDatabase_, and selectedAlgo_.
Referenced by learnPAG().
| PDAG gum::learning::IBNLearner::learnPDAG | ( | ) |
learn a partial structure from a file (must have read the db before and must have selected miic)
Definition at line 956 of file IBNLearner.cpp.
References gum::learning::IBNLearner::Database::databaseTable(), learnPDAG_(), scoreDatabase_, and gum::learning::IDatabaseTable< T_DATA >::variableName().
|
protected |
Definition at line 923 of file IBNLearner.cpp.
References algoFCI_, algoMiic_, algoPC_, gum::learning::IBNLearner::Database::databaseTable(), FCI, GUM_ERROR, gum::learning::IDatabaseTable< T_DATA >::hasMissingValues(), gum::learning::ConstraintBasedLearning::learnPDAG(), MIIC, mutualInfo_, PC, prepareFCI_(), prepareMiic_(), preparePC_(), scoreDatabase_, selectedAlgo_, and gum::learning::Miic::setMutualInformation().
Referenced by learnPDAG().
| double gum::learning::IBNLearner::logLikelihood | ( | const std::vector< NodeId > & | vars, |
| const std::vector< NodeId > & | knowing = {} ) |
Return the loglikelihood of vars in the base, conditioned by knowing for the BNLearner.
| vars | a vector of NodeIds |
| knowing | an optional vector of conditioning NodeIds |
Definition at line 1404 of file IBNLearner.cpp.
References gum::learning::IdCondSet::IdCondSet(), createPrior_(), databaseRanges(), gum::learning::IBNLearner::Database::parser(), prior_, gum::learning::ScoreLog2Likelihood::score(), and scoreDatabase_.
Referenced by logLikelihood().
| double gum::learning::IBNLearner::logLikelihood | ( | const std::vector< std::string > & | vars, |
| const std::vector< std::string > & | knowing = {} ) |
Return the loglikelihood of vars in the base, conditioned by knowing for the BNLearner.
| vars | a vector of name of rows |
| knowing | an optional vector of conditioning rows |
Definition at line 1420 of file IBNLearner.cpp.
References idFromName(), and logLikelihood().
|
overridevirtual |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 900 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::maxIter().
Referenced by createPrior_().
|
overridevirtual |
returns the timeout (in seconds)
Implements gum::IApproximationSchemeConfiguration.
Definition at line 931 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::maxTime().
Referenced by createPrior_().
|
inherited |
Returns the approximation scheme message.
Definition at line 64 of file IApproximationSchemeConfiguration.cpp.
References Continue, Epsilon, epsilon(), Limit, maxIter(), maxTime(), minEpsilonRate(), Rate, stateApproximationScheme(), Stopped, TimeLimit, and Undefined.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::learning::IBNLearner::EMStateMessage(), and gum::credal::InferenceEngine< GUM_SCALAR >::getApproximationSchemeMsg().
|
overridevirtual |
Get the value of the minimal epsilon rate.
Implements gum::IApproximationSchemeConfiguration.
Definition at line 869 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::minEpsilonRate().
Referenced by createPrior_().
| double gum::learning::IBNLearner::mutualInformation | ( | NodeId | id1, |
| NodeId | id2, | ||
| const std::vector< NodeId > & | knowing = {} ) |
Return the mutual information of id1 and id2 in the base, conditioned by knowing for the BNLearner.
| id1 | nodeId |
| id2 | nodeId |
| knowing | an optional vector of conditioning NodeIds |
Definition at line 1470 of file IBNLearner.cpp.
References gum::learning::NoPrior::NoPrior(), databaseRanges(), gum::learning::IBNLearner::Database::databaseTable(), gum::learning::IBNLearner::Database::nodeId2Columns(), gum::learning::IBNLearner::Database::parser(), gum::learning::CorrectedMutualInformation::score(), scoreDatabase_, gum::learning::CorrectedMutualInformation::useNoCorr(), and gum::learning::IBNLearner::Database::weight().
Referenced by mutualInformation().
| double gum::learning::IBNLearner::mutualInformation | ( | std::string_view | var1, |
| std::string_view | var2, | ||
| const std::vector< std::string > & | knowing = {} ) |
Return the mutual information of var1 and var2 in the base, conditioned by knowing for the BNLearner.
| var1 | name of a row |
| var2 | name of a row |
| knowing | an optional vector of conditioning rows |
Definition at line 1481 of file IBNLearner.cpp.
References idFromName(), and mutualInformation().
| INLINE const std::string & gum::learning::IBNLearner::nameFromId | ( | NodeId | id | ) | const |
returns the variable name corresponding to a given node id
Definition at line 142 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::nameFromId(), and scoreDatabase_.
| INLINE const std::vector< std::string > & gum::learning::IBNLearner::names | ( | ) | const |
returns the names of the variables in the database
Definition at line 751 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::names(), and scoreDatabase_.
| INLINE Size gum::learning::IBNLearner::nbCols | ( | ) | const |
Definition at line 782 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::domainSizes(), and scoreDatabase_.
|
overridevirtual |
| OperationNotAllowed | if scheme not performed |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 990 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::nbrIterations().
Referenced by createPrior_().
| INLINE Size gum::learning::IBNLearner::nbRows | ( | ) | const |
Definition at line 784 of file IBNLearner_inl.h.
References gum::learning::IBNLearner::Database::databaseTable(), scoreDatabase_, and gum::learning::IDatabaseTable< T_DATA >::size().
| IBNLearner & gum::learning::IBNLearner::operator= | ( | const IBNLearner & | from | ) |
copy operator
Definition at line 297 of file IBNLearner.cpp.
References IBNLearner(), algoK2_, algoMiic_, allowArcAdditions_, allowArcDeletions_, allowArcReversals_, allowArcTriangleDeletions_, alphaFci_, alphaPc_, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintSliceOrder_, constraintTabuList_, currentAlgorithm_, dag2BN_, exhaustiveSepSetFci_, extendedGreedyHillClimbing_, filename_, greedyHillClimbing_, greedyThickThinning_, indepTestTypeFCI_, indepTestTypePC_, initialDag_, kmodeMiic_, localSearchWithTabuList_, maxCondSetSizePc_, maxPathLengthFci_, mutualInfo_, nbDecreasingChanges_, gum::ThreadNumberManager::operator=(), paramEstimatorType_, prior_, priorDatabase_, priorDbname_, priorType_, priorWeight_, ranges_, score_, scoreDatabase_, scoreType_, selectedAlgo_, sortedUCPc_, stablePc_, tabuListSize_, and useEM_.
| IBNLearner & gum::learning::IBNLearner::operator= | ( | IBNLearner && | from | ) |
move operator
Definition at line 367 of file IBNLearner.cpp.
References IBNLearner(), algoK2_, algoMiic_, allowArcAdditions_, allowArcDeletions_, allowArcReversals_, allowArcTriangleDeletions_, alphaFci_, alphaPc_, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintSliceOrder_, constraintTabuList_, currentAlgorithm_, dag2BN_, exhaustiveSepSetFci_, extendedGreedyHillClimbing_, filename_, greedyHillClimbing_, greedyThickThinning_, indepTestTypeFCI_, indepTestTypePC_, initialDag_, kmodeMiic_, localSearchWithTabuList_, maxCondSetSizePc_, maxPathLengthFci_, mutualInfo_, nbDecreasingChanges_, gum::ThreadNumberManager::operator=(), paramEstimatorType_, prior_, priorDatabase_, priorDbname_, priorType_, priorWeight_, ranges_, score_, scoreDatabase_, scoreType_, selectedAlgo_, sortedUCPc_, stablePc_, tabuListSize_, and useEM_.
|
overridevirtual |
how many samples between 2 stopping isEnableds
| OutOfBounds | if p<1 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 967 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::periodSize().
Referenced by createPrior_().
|
static |
the algorithm used by the learners when none is selected explicitly
It is read from the configuration key "learning" / "BNLearnerPreferredAlgo". A learner takes it when it is constructed and does not follow later changes of the configuration. K2 cannot be the preferred algorithm since it requires an order.
| InvalidArgument | if the configured name is not a known algorithm |
Definition at line 910 of file IBNLearner.cpp.
References gum::config(), EXTENDED_GREEDY_HILL_CLIMBING, FCI, GREEDY_HILL_CLIMBING, GREEDY_THICK_THINNING, GUM_ERROR, LOCAL_SEARCH_WITH_TABU_LIST, MIIC, PC, and gum::Configuration::typed().
|
protected |
prepares the initial graph and independence test for FCI
Definition at line 820 of file IBNLearner.cpp.
References gum::learning::IndepTestChi2::IndepTestChi2(), gum::learning::IndepTestG2::IndepTestG2(), gum::DAG::addArc(), gum::DiGraph::addArc(), gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), algoFCI_, alphaFci_, gum::learning::StructuralConstraintForbiddenArcs::arcs(), gum::learning::StructuralConstraintMandatoryArcs::arcs(), Chi2, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintPossibleEdges_, constraintSliceOrder_, constraintTotalOrder_, gum::learning::IBNLearner::Database::databaseTable(), gum::learning::StructuralConstraintPossibleEdges::edges(), gum::Set< Key >::empty(), exhaustiveSepSetFci_, indepTestFCI_, indepTestTypeFCI_, gum::learning::StructuralConstraintIndegree::maxIndegree(), maxPathLengthFci_, gum::learning::IBNLearner::Database::nodeId2Columns(), gum::learning::StructuralConstraintNoChildrenNodes::nodes(), gum::learning::StructuralConstraintNoParentNodes::nodes(), gum::NodeGraphPart::nodes(), noPrior_, gum::learning::IBNLearner::Database::parser(), ranges_, scoreDatabase_, gum::learning::CIBasedLearning::setAlpha(), gum::learning::CIBasedLearning::setExhaustiveSepSet(), gum::learning::ConstraintBasedLearning::setForbiddenGraph(), gum::learning::CIBasedLearning::setIndependenceTest(), gum::learning::ConstraintBasedLearning::setMandatoryGraph(), gum::learning::ConstraintBasedLearning::setMaxIndegree(), gum::learning::FCI::setMaxPathLength(), gum::learning::StructuralConstraintSliceOrder::sliceOrder(), and gum::learning::StructuralConstraintTotalOrder::totalOrder().
Referenced by createPrior_(), learnDag_(), learnPAG_(), and learnPDAG_().
|
protected |
prepares the initial graph for miic
Definition at line 628 of file IBNLearner.cpp.
References gum::DAG::addArc(), gum::DiGraph::addArc(), gum::learning::ConstraintBasedLearning::addConstraints(), gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), algoMiic_, gum::learning::StructuralConstraintForbiddenArcs::arcs(), gum::learning::StructuralConstraintMandatoryArcs::arcs(), constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintPossibleEdges_, constraintSliceOrder_, constraintTotalOrder_, createCorrectedMutualInformation_(), gum::learning::IBNLearner::Database::databaseTable(), gum::learning::StructuralConstraintPossibleEdges::edges(), gum::Set< Key >::empty(), gum::learning::StructuralConstraintIndegree::maxIndegree(), gum::learning::StructuralConstraintNoChildrenNodes::nodes(), gum::learning::StructuralConstraintNoParentNodes::nodes(), gum::NodeGraphPart::nodes(), scoreDatabase_, gum::learning::ConstraintBasedLearning::setForbiddenGraph(), gum::learning::ConstraintBasedLearning::setMandatoryGraph(), gum::learning::ConstraintBasedLearning::setMaxIndegree(), gum::learning::StructuralConstraintSliceOrder::sliceOrder(), and gum::learning::StructuralConstraintTotalOrder::totalOrder().
Referenced by createPrior_(), learnDag_(), and learnPDAG_().
|
protected |
prepares the initial graph and independence test for PC
Definition at line 727 of file IBNLearner.cpp.
References gum::learning::IndepTestChi2::IndepTestChi2(), gum::learning::IndepTestG2::IndepTestG2(), gum::DAG::addArc(), gum::DiGraph::addArc(), gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), algoPC_, alphaPc_, gum::learning::StructuralConstraintForbiddenArcs::arcs(), gum::learning::StructuralConstraintMandatoryArcs::arcs(), Chi2, constraintForbiddenArcs_, constraintIndegree_, constraintMandatoryArcs_, constraintNoChildrenNodes_, constraintNoParentNodes_, constraintPossibleEdges_, constraintSliceOrder_, constraintTotalOrder_, gum::learning::IBNLearner::Database::databaseTable(), gum::learning::StructuralConstraintPossibleEdges::edges(), gum::Set< Key >::empty(), indepTestPC_, indepTestTypePC_, maxCondSetSizePc_, gum::learning::StructuralConstraintIndegree::maxIndegree(), gum::learning::IBNLearner::Database::nodeId2Columns(), gum::learning::StructuralConstraintNoChildrenNodes::nodes(), gum::learning::StructuralConstraintNoParentNodes::nodes(), gum::NodeGraphPart::nodes(), noPrior_, gum::learning::IBNLearner::Database::parser(), ranges_, scoreDatabase_, gum::learning::CIBasedLearning::setAlpha(), gum::learning::ConstraintBasedLearning::setForbiddenGraph(), gum::learning::CIBasedLearning::setIndependenceTest(), gum::learning::ConstraintBasedLearning::setMandatoryGraph(), gum::learning::CIBasedLearning::setMaxCondSetSize(), gum::learning::ConstraintBasedLearning::setMaxIndegree(), gum::learning::CIBasedLearning::setStable(), gum::learning::CIBasedLearning::setUCPriority(), gum::learning::StructuralConstraintSliceOrder::sliceOrder(), gum::learning::CIBasedLearning::Sorted, sortedUCPc_, stablePc_, gum::learning::CIBasedLearning::Standard, and gum::learning::StructuralConstraintTotalOrder::totalOrder().
Referenced by createPrior_(), learnDag_(), and learnPDAG_().
| std::vector< double > gum::learning::IBNLearner::rawPseudoCount | ( | const std::vector< NodeId > & | vars | ) |
Return the pseudo-counts of NodeIds vars in the base in a raw array.
| vars | a vector of |
Definition at line 1511 of file IBNLearner.cpp.
References createPrior_(), databaseRanges(), gum::learning::PseudoCount::get(), GUM_ERROR, hasMissingValues(), gum::learning::IBNLearner::Database::parser(), prior_, scoreDatabase_, and gum::Tensor< double >.
Referenced by rawPseudoCount().
| std::vector< double > gum::learning::IBNLearner::rawPseudoCount | ( | const std::vector< std::string > & | vars | ) |
Return the pseudoconts of vars in the base in a raw array.
| vars | a vector of name |
Definition at line 1526 of file IBNLearner.cpp.
References idFromName(), and rawPseudoCount().
|
staticprotected |
reads a file and returns a databaseVectInRam
Definition at line 491 of file IBNLearner.cpp.
References database(), gum::learning::IDBInitializer::fillDatabase(), gum::learning::DBTranslatorSet::insertTranslator(), isCSVFileName_(), gum::learning::DatabaseTable::reorder(), gum::learning::DatabaseTable::setVariableNames(), and gum::learning::IDBInitializer::variableNames().
Referenced by gum::learning::IBNLearner::Database::Database().
| INLINE double gum::learning::IBNLearner::recordWeight | ( | const std::size_t | i | ) | const |
returns the weight of the ith record
| OutOfBounds | if i is outside the set of indices of the records |
Definition at line 157 of file IBNLearner_inl.h.
References scoreDatabase_, and gum::learning::IBNLearner::Database::weight().
Return the value of the score currently in use by the BNLearner of a variable given a set of other variables.
| var | the NodeId of the LHS variable |
| knowing | an optional vector of conditioning variables, specified by their NodeIds |
Definition at line 1493 of file IBNLearner.cpp.
References createPrior_(), createScore_(), gum::learning::Score::score(), and score_.
Referenced by score(), and useDatabaseRanges().
| double gum::learning::IBNLearner::score | ( | std::string_view | vars, |
| const std::vector< std::string > & | knowing = {} ) |
Return the value of the score currently in use by the BNLearner of a variable given a set of other variables The score used is the one currently selected in the BNLearner.
| var | the name of the variable |
| knowing | an optional vector of conditioning variables, specified by their names |
Definition at line 1500 of file IBNLearner.cpp.
References idFromName(), and score().
| INLINE void gum::learning::IBNLearner::setCurrentApproximationScheme | ( | const ApproximationScheme * | approximationScheme | ) |
{@ /// distribute signals
Definition at line 813 of file IBNLearner_inl.h.
References currentAlgorithm_.
Referenced by gum::learning::BNLearnerListener::BNLearnerListener(), createPrior_(), distributeProgress(), and distributeStop().
| INLINE void gum::learning::IBNLearner::setDatabaseWeight | ( | const double | new_weight | ) |
assign a weight to all the rows of the learning database so that the sum of their weights is equal to new_weight
assign new weight to the rows of the learning database
Definition at line 147 of file IBNLearner_inl.h.
References scoreDatabase_, and gum::learning::IBNLearner::Database::setDatabaseWeight().
|
overridevirtual |
Given that we approximate f(t), stopping criterion on |f(t+1)-f(t)| If the criterion was disabled it will be enabled.
| OutOfBounds | if eps<0 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 831 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, gum::ApproximationScheme::setEpsilon(), and gum::learning::EMApproximationScheme::setEpsilon().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::setFCIAlpha | ( | double | alpha | ) |
set the significance threshold alpha for FCI. If it is never set, FCI uses the key learning.alpha of the configuration, as it was when the learner was constructed.
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 248 of file IBNLearner_inl.h.
References alphaFci_, FCI, GUM_ERROR, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::setFCIExhaustiveSepSet | ( | bool | exhaustive | ) |
enable exhaustive sepset mode for FCI skeleton learning (default false)
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 264 of file IBNLearner_inl.h.
References exhaustiveSepSetFci_, FCI, GUM_ERROR, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::setFCIMaxPathLength | ( | Size | max_len | ) |
set maximum discriminating-path length for FCI R4 (default Size(-1) = unlimited)
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 256 of file IBNLearner_inl.h.
References FCI, GUM_ERROR, maxPathLengthFci_, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::setForbiddenArcs | ( | const ArcSet & | set | ) |
removes a total
assign a set of forbidden arcs
Definition at line 543 of file IBNLearner_inl.h.
References constraintForbiddenArcs_, and gum::learning::StructuralConstraintForbiddenArcs::setArcs().
| INLINE void gum::learning::IBNLearner::setGreedyThickThinningReversals | ( | bool | allow | ) |
enable or disable arc reversals in the thin phase of greedy thick-thinning
Definition at line 378 of file IBNLearner_inl.h.
References greedyThickThinning_, and gum::learning::GreedyThickThinning::setAllowReversalsInThinPhase().
| INLINE void gum::learning::IBNLearner::setInitialDAG | ( | const DAG & | dag | ) |
sets an initial DAG structure
Definition at line 165 of file IBNLearner_inl.h.
References initialDag_.
| INLINE void gum::learning::IBNLearner::setMandatoryArcs | ( | const ArcSet & | set | ) |
assign a set of mandatory arcs
Definition at line 576 of file IBNLearner_inl.h.
References constraintMandatoryArcs_, and gum::learning::StructuralConstraintMandatoryArcs::setArcs().
| INLINE void gum::learning::IBNLearner::setMaxIndegree | ( | Size | max_indegree | ) |
sets the max indegree
Definition at line 218 of file IBNLearner_inl.h.
References constraintIndegree_, and gum::learning::StructuralConstraintIndegree::setMaxIndegree().
|
overridevirtual |
stopping criterion on number of iterationsIf the criterion was disabled it will be enabled
| max | The maximum number of iterations |
| OutOfBounds | if max<=1 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 893 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, and gum::ApproximationScheme::setMaxIter().
Referenced by createPrior_().
|
overridevirtual |
stopping criterion on timeout If the criterion was disabled it will be enabled
| OutOfBounds | if timeout<=0.0 timeout is time in second (double). |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 924 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, and gum::ApproximationScheme::setMaxTime().
Referenced by createPrior_().
|
overridevirtual |
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.
| OutOfBounds | if rate<0 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 862 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, gum::ApproximationScheme::setMinEpsilonRate(), and gum::learning::EMApproximationScheme::setMinEpsilonRate().
Referenced by createPrior_().
|
overridevirtual |
sets the number max of threads that can be used
| nb | the number max of threads to be used. If this number is set to 0, then it is defaulted to aGrUM's max number of threads |
Implements gum::IThreadNumberManager.
Definition at line 787 of file IBNLearner_inl.h.
References score_, gum::learning::Score::setNumberOfThreads(), and gum::ThreadNumberManager::setNumberOfThreads().
| INLINE void gum::learning::IBNLearner::setPCAlpha | ( | double | alpha | ) |
set the significance threshold alpha for PC. If it is never set, PC uses the key learning.alpha of the configuration, as it was when the learner was constructed.
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 297 of file IBNLearner_inl.h.
References alphaPc_, GUM_ERROR, PC, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::setPCMaxCondSetSize | ( | Size | max_k | ) |
set maximum conditioning set size for PC (default Size(-1) = unlimited)
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 313 of file IBNLearner_inl.h.
References GUM_ERROR, maxCondSetSizePc_, PC, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::setPCStable | ( | bool | stable | ) |
set stable mode for PC — defer removals to end of each depth level (default true)
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 305 of file IBNLearner_inl.h.
References GUM_ERROR, PC, selectedAlgo_, and stablePc_.
| INLINE void gum::learning::IBNLearner::setPCUnshieldedColliderSorted | ( | bool | sorted | ) |
set unshielded-collider ordering for PC: sorted=true uses descending p-value order (strongest evidence first); sorted=false uses natural traversal order (default false)
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 322 of file IBNLearner_inl.h.
References GUM_ERROR, PC, selectedAlgo_, and sortedUCPc_.
|
overridevirtual |
how many samples between 2 stopping isEnableds
| OutOfBounds | if p<1 |
Implements gum::IApproximationSchemeConfiguration.
Definition at line 960 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, and gum::ApproximationScheme::setPeriodSize().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::setPossibleEdges | ( | const EdgeSet & | set | ) |
assign a set of possible edges
Definition at line 503 of file IBNLearner_inl.h.
References constraintPossibleEdges_, and gum::learning::StructuralConstraintPossibleEdges::setEdges().
Referenced by setPossibleSkeleton().
| INLINE void gum::learning::IBNLearner::setPossibleSkeleton | ( | const UndiGraph & | skeleton | ) |
assign a set of possible edges
Definition at line 508 of file IBNLearner_inl.h.
References gum::EdgeGraphPart::edges(), and setPossibleEdges().
| INLINE void gum::learning::IBNLearner::setRecordWeight | ( | const std::size_t | i, |
| const double | weight ) |
sets the weight of the ith record of the database
assign new weight to the ith row of the learning database
| OutOfBounds | if i is outside the set of indices of the records or if the weight is negative |
Definition at line 152 of file IBNLearner_inl.h.
References scoreDatabase_, and gum::learning::IBNLearner::Database::setWeight().
| INLINE void gum::learning::IBNLearner::setSliceOrder | ( | const NodeProperty< NodeId > & | slice_order | ) |
sets a partial order on the nodes
| slice_order | a NodeProperty given the rank (priority) of nodes in the partial order |
Definition at line 639 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintSliceOrder::StructuralConstraintSliceOrder(), and constraintSliceOrder_.
Referenced by setSliceOrder(), and unsetSliceOrder().
| INLINE void gum::learning::IBNLearner::setSliceOrder | ( | const std::vector< std::vector< std::string > > & | slices | ) |
sets a partial order on the nodes
| slices | the list of list of variable names. If it is empty, this is equivalent to removing the constraint (useful if you had previously added a slice order constraint and you do not want to use it anymore) |
Definition at line 643 of file IBNLearner_inl.h.
References idFromName(), gum::HashTable< Key, Val >::insert(), and setSliceOrder().
sets a total order over some nodes
This defines a total ordering constraint on the nodes belonging to the sequence. If you plan to use K2, do not use this constraint, prefer using method useK2(order).
Note that all the nodes of the graph to be learned need not belong to order: if a node does not belong to it, then it just means that there is no constraint on this node in the total ordering.
Note also that you can both exploit a total ordering and slice ordering. For instance, we may wish that the topological ordering of the graph we learn satisfies that 1 < 3 < 4 < 5 and 2 < 3, 4 and 5, then use a total ordering 1 < 3 < 4 < 5 combined with a slice ordering {2} < {3,4,5}.
| order |
Definition at line 658 of file IBNLearner_inl.h.
References gum::learning::StructuralConstraintTotalOrder::StructuralConstraintTotalOrder(), and constraintTotalOrder_.
Referenced by setTotalOrder(), and unsetTotalOrder().
| INLINE void gum::learning::IBNLearner::setTotalOrder | ( | const std::vector< std::string > & | order | ) |
sets the max indegree
Definition at line 663 of file IBNLearner_inl.h.
References idFromName(), gum::SequenceImplementation< Key, std::is_scalar< Key >::value >::insert(), and setTotalOrder().
|
overridevirtual |
verbosity
Implements gum::IApproximationSchemeConfiguration.
Definition at line 972 of file IBNLearner_inl.h.
References algoK2_, gum::learning::K2::approximationScheme(), dag2BN_, greedyHillClimbing_, localSearchWithTabuList_, and gum::ApproximationScheme::setVerbosity().
Referenced by createPrior_().
|
overridevirtual |
history
Implements gum::IApproximationSchemeConfiguration.
Definition at line 985 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::stateApproximationScheme().
Referenced by createPrior_().
| INLINE void gum::learning::IBNLearner::unsetSliceOrder | ( | ) |
removes the slice order constraint
The methd is useful if you had previously added a slice order constraint and you do not want to use it anymore
Definition at line 655 of file IBNLearner_inl.h.
References setSliceOrder().
| INLINE void gum::learning::IBNLearner::unsetTotalOrder | ( | ) |
removes the current total ordering constraint, if any
Definition at line 672 of file IBNLearner_inl.h.
References setTotalOrder().
| INLINE void gum::learning::IBNLearner::useBDeuPrior | ( | ) |
use the BDeu prior with the default weight (key priorWeight of the section learning)
Definition at line 720 of file IBNLearner_inl.h.
References gum::config(), and useBDeuPrior().
| INLINE void gum::learning::IBNLearner::useBDeuPrior | ( | double | weight | ) |
use the BDeu prior
The BDeu prior adds weight to all the cells of the counts tables. In other words, it adds weight rows in the database with equally probable values.
Definition at line 725 of file IBNLearner_inl.h.
References _setPriorWeight_(), BDEU, checkScorePriorCompatibility(), GUM_ERROR, and priorType_.
Referenced by useBDeuPrior().
| INLINE void gum::learning::IBNLearner::useChi2Test | ( | ) |
indicate that we wish to use Chi2 independence test for PC
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 281 of file IBNLearner_inl.h.
References Chi2, GUM_ERROR, indepTestTypePC_, PC, and selectedAlgo_.
| std::pair< std::size_t, std::size_t > gum::learning::IBNLearner::useCrossValidationFold | ( | const std::size_t | learning_fold, |
| const std::size_t | k_fold ) |
sets the ranges of rows to be used for cross-validation learning
When applied on (x,k), the method indicates to the subsequent learnings that they should be performed on the xth fold in a k-fold cross-validation context. For instance, if a database has 1000 rows, and if we perform a 10-fold cross-validation, then, the first learning fold (learning_fold=0) corresponds to rows interval [100,1000) and the test dataset corresponds to [0,100). The second learning fold (learning_fold=1) is [0,100) U [200,1000) and the corresponding test dataset is [100,200).
| learning_fold | a number indicating the set of rows used for learning. If N denotes the size of the database, and k_fold represents the number of folds in the cross validation, then the set of rows used for testing is [learning_fold * N / k_fold, (learning_fold+1) * N / k_fold) and the learning database is the complement in the database |
| k_fold | the value of "k" in k-fold cross validation |
| OutOfBounds | is raised if k_fold is equal to 0 or learning_fold is greater than or eqal to k_fold, or if k_fold is greater than or equal to the size of the database. |
Definition at line 1329 of file IBNLearner.cpp.
References gum::learning::IBNLearner::Database::databaseTable(), GUM_ERROR, gum::learning::IDatabaseTable< T_DATA >::nbRows(), ranges_, and scoreDatabase_.
| void gum::learning::IBNLearner::useDatabaseRanges | ( | const std::vector< std::pair< std::size_t, std::size_t > > & | new_ranges | ) |
use a new set of database rows' ranges to perform learning
| ranges | a set of pairs {(X1,Y1),...,(Xn,Yn)} of database's rows indices. The subsequent learnings are then performed only on the union of the rows [Xi,Yi), i in {1,...,n}. This is useful, e.g, when performing cross validation tasks, in which part of the database should be ignored. An empty set of ranges is equivalent to an interval [X,Y) ranging over the whole database. |
Definition at line 1536 of file IBNLearner.cpp.
References noPrior_, gum::learning::IBNLearner::Database::parser(), gum::learning::Score::ranges(), ranges_, score(), scoreDatabase_, and gum::learning::Score::setRanges().
| INLINE void gum::learning::IBNLearner::useDirichletPrior | ( | std::string_view | filename | ) |
use the Dirichlet prior from a database with the default weight (key priorWeight)
Definition at line 704 of file IBNLearner_inl.h.
References gum::config(), and useDirichletPrior().
| INLINE void gum::learning::IBNLearner::useDirichletPrior | ( | std::string_view | filename, |
| double | weight ) |
use the Dirichlet prior from a database
Definition at line 709 of file IBNLearner_inl.h.
References _setPriorWeight_(), checkScorePriorCompatibility(), DIRICHLET_FROM_DATABASE, GUM_ERROR, priorDbname_, and priorType_.
Referenced by useDirichletPrior().
| INLINE void gum::learning::IBNLearner::useEM | ( | const double | epsilon | ) |
use The EM algorithm to learn parameters, with the default noise
use The EM algorithm to learn parameters with the default noise
| epsilon | sets the approximation stopping criterion (see useEM(epsilon, noise)) |
| OutOfBounds | is raised if epsilon is strictly negative. |
Definition at line 411 of file IBNLearner_inl.h.
References gum::config(), epsilon(), and useEM().
use The EM algorithm to learn parameters
| epsilon | sets the approximation stopping criterion: EM stops whenever the absolute value of the relative difference between two consecutive log-likelihoods drops below epsilon. Note that epsilon=0 is considered as a directive to not use EM. However, if you wish to forbid the use of EM, prefer executing Method forbidEM() rather than useEM(0) as it is more unequivocal. |
| noise | When EM starts, it initializes all the CPTs of the Bayes net. EM adds a noise to these CPTs by mixing their values with some random noise. The formula used is, up to some normalizing constant: new_cpt = (1-noise) * cpt + noise * random_cpt(). Of course, noise must belong to interval [0,1]. |
| OutOfBounds | is raised if epsilon is strictly negative or if noise does not belong to interval [0,1]. |
Definition at line 416 of file IBNLearner_inl.h.
References dag2BN_, epsilon(), GUM_ERROR, gum::learning::EMApproximationScheme::setMinEpsilonRate(), gum::learning::DAG2BNLearner::setNoise(), and useEM_.
Referenced by useEM(), and useEMWithRateCriterion().
| INLINE void gum::learning::IBNLearner::useEMWithDiffCriterion | ( | const double | epsilon | ) |
use The EM algorithm with the diff stopping criterion and the default noise (key emNoise)
use The EM algorithm to learn parameters with the diff stopping criterion and the default noise
Definition at line 445 of file IBNLearner_inl.h.
References gum::config(), epsilon(), and useEMWithDiffCriterion().
| INLINE void gum::learning::IBNLearner::useEMWithDiffCriterion | ( | const double | epsilon, |
| const double | noise ) |
use The EM algorithm to learn parameters with the diff stopping criterion
use The EM algorithm to learn parameters with the diff stoppîng criterion
| epsilon | epsilon sets the approximation stopping criterion: EM stops whenever the difference between two consecutive log-likelihoods drops below epsilon. Note that, for using EM, epsilon should be strictly positive. |
| noise | When EM starts, it initializes all the CPTs of the Bayes net. EM adds a noise to these CPTs by mixing their values with some random noise. The formula used is, up to some normalizing constant: new_cpt = (1-noise) * cpt + noise * random_cpt(). Of course, noise must belong to interval [0,1]. |
| OutOfBounds | is raised if epsilon is not strictly positive or if noise does not belong to interval [0,1]. |
Definition at line 450 of file IBNLearner_inl.h.
References dag2BN_, epsilon(), GUM_ERROR, gum::learning::EMApproximationScheme::setEpsilon(), gum::learning::DAG2BNLearner::setNoise(), and useEM_.
Referenced by useEMWithDiffCriterion().
| INLINE void gum::learning::IBNLearner::useEMWithRateCriterion | ( | const double | epsilon | ) |
use The EM algorithm with the rate stopping criterion and the default noise (key emNoise)
use The EM algorithm to learn parameters with the rate stopping criterion and the default noise
Definition at line 432 of file IBNLearner_inl.h.
References gum::config(), epsilon(), and useEMWithRateCriterion().
| INLINE void gum::learning::IBNLearner::useEMWithRateCriterion | ( | const double | epsilon, |
| const double | noise ) |
use The EM algorithm to learn parameters with the rate stopping criterion
| epsilon | epsilon sets the approximation stopping criterion: EM stops whenever the absolute value of the relative difference between two consecutive log-likelihoods drops below epsilon. Note that, for using EM, epsilon should be strictly positive. |
| noise | When EM starts, it initializes all the CPTs of the Bayes net. EM adds a noise to these CPTs by mixing their values with some random noise. The formula used is, up to some normalizing constant: new_cpt = (1-noise) * cpt + noise * random_cpt(). Of course, noise must belong to interval [0,1]. |
| OutOfBounds | is raised if epsilon is not strictly positive or if noise does not belong to interval [0,1]. |
Definition at line 437 of file IBNLearner_inl.h.
References epsilon(), GUM_ERROR, and useEM().
Referenced by useEMWithRateCriterion().
| INLINE void gum::learning::IBNLearner::useExtendedGreedyHillClimbing | ( | ) |
indicate that we wish to use the extended greedy hill climbing algorithm
The extended greedy hill climbing adds to the classical operations (arc addition, arc reversal, arc deletion) two additional operations: arc triangle deletion1 and arc triangle deletion2. The former modifies a structure X1->X2->X3 + X1->X3 into a v-structure centered on X1, i.e., X2->X1<-X3. Arc triangle deletion2 modifies structure X1->X2->X3 + X1->X3 into a v-structure centered on X2, i.e., X1->X2<-X3.
In addition, the extended greedy hill climbing allows the user to select which operations among arc additions, arc reversals, arc deletions, arc triangle deletions, are allowed.
Definition at line 368 of file IBNLearner_inl.h.
References EXTENDED_GREEDY_HILL_CLIMBING, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useFCI | ( | ) |
indicate that we wish to use FCI (Chi2 test by default)
Definition at line 229 of file IBNLearner_inl.h.
References FCI, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useFCIChi2Test | ( | ) |
indicate that we wish to use Chi2 independence test for FCI
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 232 of file IBNLearner_inl.h.
References Chi2, FCI, GUM_ERROR, indepTestTypeFCI_, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useFCIG2Test | ( | ) |
indicate that we wish to use G2 independence test for FCI
| OperationNotAllowed | when FCI is not the selected algorithm |
Definition at line 240 of file IBNLearner_inl.h.
References FCI, G2, GUM_ERROR, indepTestTypeFCI_, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useG2Test | ( | ) |
indicate that we wish to use G2 independence test for PC
| OperationNotAllowed | when PC is not the selected algorithm |
Definition at line 289 of file IBNLearner_inl.h.
References G2, GUM_ERROR, indepTestTypePC_, PC, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useGreedyHillClimbing | ( | ) |
indicate that we wish to use a greedy hill climbing algorithm
Definition at line 363 of file IBNLearner_inl.h.
References GREEDY_HILL_CLIMBING, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useGreedyThickThinning | ( | ) |
indicate that we wish to use greedy thick-thinning
Definition at line 373 of file IBNLearner_inl.h.
References GREEDY_THICK_THINNING, and selectedAlgo_.
indicate that we wish to use K2
Definition at line 351 of file IBNLearner_inl.h.
References algoK2_, K2, selectedAlgo_, and gum::learning::K2::setOrder().
| INLINE void gum::learning::IBNLearner::useK2 | ( | const std::vector< NodeId > & | order | ) |
indicate that we wish to use K2
Definition at line 357 of file IBNLearner_inl.h.
References algoK2_, K2, selectedAlgo_, and gum::learning::K2::setOrder().
| INLINE void gum::learning::IBNLearner::useLocalSearchWithTabuList | ( | ) |
indicate that we wish to use a local search with tabu list and the default parameters
The size of the tabu list and the max number of consecutive decreasing changes are given by the keys tabuListSize and tabuNbDecrease of the section learning of gum::Configuration
Definition at line 388 of file IBNLearner_inl.h.
References gum::config(), and useLocalSearchWithTabuList().
| INLINE void gum::learning::IBNLearner::useLocalSearchWithTabuList | ( | Size | tabu_size | ) |
indicate that we wish to use a local search with tabu list
| tabu_size | indicate the size of the tabu list The max number of consecutive decreasing changes is the default one (key tabuNbDecrease of the section learning of gum::Configuration) |
Definition at line 395 of file IBNLearner_inl.h.
References gum::config(), and useLocalSearchWithTabuList().
| INLINE void gum::learning::IBNLearner::useLocalSearchWithTabuList | ( | Size | tabu_size, |
| Size | nb_decrease ) |
indicate that we wish to use a local search with tabu list
| tabu_size | indicate the size of the tabu list |
| nb_decrease | indicate the max number of changes decreasing the score consecutively that we allow to apply |
Definition at line 402 of file IBNLearner_inl.h.
References constraintTabuList_, LOCAL_SEARCH_WITH_TABU_LIST, localSearchWithTabuList_, nbDecreasingChanges_, selectedAlgo_, gum::learning::LocalSearchWithTabuList::setMaxNbDecreasingChanges(), gum::learning::StructuralConstraintTabuList::setTabuListSize(), and tabuListSize_.
Referenced by useLocalSearchWithTabuList(), and useLocalSearchWithTabuList().
| INLINE void gum::learning::IBNLearner::useMDLCorrection | ( | ) |
indicate that we wish to use the MDL correction for MIIC
| OperationNotAllowed | when MIIC is not the selected algorithm |
Definition at line 336 of file IBNLearner_inl.h.
References kmodeMiic_, and gum::learning::CorrectedMutualInformation::MDL.
| INLINE void gum::learning::IBNLearner::useMIIC | ( | ) |
indicate that we wish to use MIIC
Definition at line 223 of file IBNLearner_inl.h.
References MIIC, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useNMLCorrection | ( | ) |
indicate that we wish to use the NML correction for and MIIC
indicate that we wish to use the NML correction for MIIC
| OperationNotAllowed | when MIIC is not the selected algorithm |
Definition at line 331 of file IBNLearner_inl.h.
References kmodeMiic_, and gum::learning::CorrectedMutualInformation::NML.
| INLINE void gum::learning::IBNLearner::useNoCorrection | ( | ) |
indicate that we wish to use the NoCorr correction for MIIC
| OperationNotAllowed | when MIIC is not the selected algorithm |
Definition at line 341 of file IBNLearner_inl.h.
References kmodeMiic_, and gum::learning::CorrectedMutualInformation::NoCorr.
| INLINE void gum::learning::IBNLearner::useNoPrior | ( | ) |
use no prior
Definition at line 683 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), NO_prior, and priorType_.
| INLINE void gum::learning::IBNLearner::usePC | ( | ) |
indicate that we wish to use PC (Chi2 test by default)
Definition at line 226 of file IBNLearner_inl.h.
References PC, and selectedAlgo_.
| INLINE void gum::learning::IBNLearner::useScoreAIC | ( | ) |
indicate that we wish to use an AIC score
Definition at line 170 of file IBNLearner_inl.h.
References AIC, checkScorePriorCompatibility(), and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreBD | ( | ) |
indicate that we wish to use a BD score
Definition at line 176 of file IBNLearner_inl.h.
References BD, checkScorePriorCompatibility(), and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreBDeu | ( | ) |
indicate that we wish to use a BDeu score
Definition at line 182 of file IBNLearner_inl.h.
References BDeu, checkScorePriorCompatibility(), and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreBIC | ( | ) |
indicate that we wish to use a BIC score
Definition at line 188 of file IBNLearner_inl.h.
References BIC, checkScorePriorCompatibility(), and scoreType_.
| INLINE void gum::learning::IBNLearner::useScorefNML | ( | ) |
indicate that we wish to use a fNML score
Definition at line 194 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), fNML, and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreK2 | ( | ) |
indicate that we wish to use a K2 score
Definition at line 200 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), K2, and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreLog2Likelihood | ( | ) |
indicate that we wish to use a Log2Likelihood score
Definition at line 206 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), LOG2LIKELIHOOD, and scoreType_.
| INLINE void gum::learning::IBNLearner::useScoreMDL | ( | ) |
indicate that we wish to use a MDL score
Definition at line 212 of file IBNLearner_inl.h.
References checkScorePriorCompatibility(), MDL, and scoreType_.
| INLINE void gum::learning::IBNLearner::useSmoothingPrior | ( | ) |
use the prior smoothing with the default weight (key priorWeight of the section learning)
Definition at line 689 of file IBNLearner_inl.h.
References gum::config(), and useSmoothingPrior().
| INLINE void gum::learning::IBNLearner::useSmoothingPrior | ( | double | weight | ) |
use the prior smoothing
| weight | the weight assigned to the smoothing |
Definition at line 694 of file IBNLearner_inl.h.
References _setPriorWeight_(), checkScorePriorCompatibility(), GUM_ERROR, priorType_, and SMOOTHING.
Referenced by useSmoothingPrior().
|
overridevirtual |
verbosity
Implements gum::IApproximationSchemeConfiguration.
Definition at line 979 of file IBNLearner_inl.h.
References currentAlgorithm_, GUM_ERROR, and gum::ApproximationScheme::verbosity().
Referenced by createPrior_().
|
privateinherited |
the max number of threads used by the class
Definition at line 126 of file threadNumberManager.h.
|
protected |
the FCI algorithm
Definition at line 1263 of file IBNLearner.h.
Referenced by learnDag_(), learnPAG_(), learnPDAG_(), and prepareFCI_().
|
protected |
the K2 algorithm
Definition at line 1236 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), disableEpsilon(), disableMaxIter(), disableMaxTime(), disableMinEpsilonRate(), enableEpsilon(), enableMaxIter(), enableMaxTime(), enableMinEpsilonRate(), learnDag_(), operator=(), operator=(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), setVerbosity(), useK2(), and useK2().
|
protected |
the Constraint MIIC algorithm
Definition at line 1239 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), latentVariables(), learnDag_(), learnPDAG_(), operator=(), operator=(), and prepareMiic_().
|
protected |
the PC algorithm
Definition at line 1246 of file IBNLearner.h.
Referenced by learnDag_(), learnPDAG_(), and preparePC_().
|
protected |
whether we allow or not arc additions during learning
Definition at line 1224 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), allowArcAdditions(), learnDag_(), operator=(), and operator=().
|
protected |
whether we allow or not arc deletions during learning
Definition at line 1227 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), allowArcDeletions(), learnDag_(), operator=(), and operator=().
|
protected |
whether we allow or not arc reversals during learning
Definition at line 1230 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), allowArcReversals(), learnDag_(), operator=(), and operator=().
|
protected |
whether we allow or not arc deletions during learning
Definition at line 1233 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), allowArcTriangleDeletions(), learnDag_(), operator=(), and operator=().
|
protected |
FCI parameters the threshold of the tests ; it is initialized from the key learning.alpha.
Definition at line 1273 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), prepareFCI_(), and setFCIAlpha().
|
protected |
PC parameters the threshold of the tests ; it is initialized from the key learning.alpha.
Definition at line 1257 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), preparePC_(), and setPCAlpha().
|
protected |
the constraint on forbidden arcs
Definition at line 1206 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), addForbiddenArc(), eraseForbiddenArc(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), preparePC_(), and setForbiddenArcs().
|
protected |
the constraint for indegrees
Definition at line 1200 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), preparePC_(), and setMaxIndegree().
|
protected |
the constraint on mandatory arcs
Definition at line 1212 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), addMandatoryArc(), eraseMandatoryArc(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), preparePC_(), and setMandatoryArcs().
|
protected |
the constraint on no children nodes
Definition at line 1218 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), addNoChildrenNode(), eraseNoChildrenNode(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), and preparePC_().
|
protected |
the constraint on no parent nodes
Definition at line 1215 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), addNoParentNode(), eraseNoParentNode(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), and preparePC_().
|
protected |
the constraint on possible Edges
Definition at line 1209 of file IBNLearner.h.
Referenced by addPossibleEdge(), erasePossibleEdge(), learnDag_(), prepareFCI_(), prepareMiic_(), preparePC_(), and setPossibleEdges().
|
protected |
the constraint for 2TBNs
Definition at line 1194 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), learnDag_(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), preparePC_(), and setSliceOrder().
|
protected |
the constraint for tabu lists
Definition at line 1203 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), learnDag_(), operator=(), operator=(), and useLocalSearchWithTabuList().
|
protected |
the total order ing constraint
Definition at line 1197 of file IBNLearner.h.
Referenced by learnDag_(), prepareFCI_(), prepareMiic_(), preparePC_(), and setTotalOrder().
|
protected |
Definition at line 1317 of file IBNLearner.h.
Referenced by currentTime(), epsilon(), history(), isEnabledEpsilon(), isEnabledMaxIter(), isEnabledMaxTime(), isEnabledMinEpsilonRate(), maxIter(), maxTime(), minEpsilonRate(), nbrIterations(), operator=(), operator=(), periodSize(), setCurrentApproximationScheme(), stateApproximationScheme(), and verbosity().
|
protected |
the parametric EM
Definition at line 1278 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), disableEpsilon(), disableMaxIter(), disableMaxTime(), disableMinEpsilonRate(), EM(), EMCurrentTime(), EMdisableEpsilon(), EMdisableMaxIter(), EMdisableMaxTime(), EMdisableMinEpsilonRate(), EMenableEpsilon(), EMenableMaxIter(), EMenableMaxTime(), EMenableMinEpsilonRate(), EMEpsilon(), EMHistory(), EMisEnabledEpsilon(), EMisEnabledMaxIter(), EMisEnabledMaxTime(), EMisEnabledMinEpsilonRate(), EMMaxIter(), EMMaxTime(), EMMinEpsilonRate(), EMnbrIterations(), EMPeriodSize(), EMsetEpsilon(), EMsetMaxIter(), EMsetMaxTime(), EMsetMinEpsilonRate(), EMsetPeriodSize(), EMsetVerbosity(), EMState(), EMStateApproximationScheme(), EMStateMessage(), EMVerbosity(), enableEpsilon(), enableMaxIter(), enableMaxTime(), enableMinEpsilonRate(), operator=(), operator=(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), setVerbosity(), useEM(), and useEMWithDiffCriterion().
|
protected |
Definition at line 1275 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), fciExhaustiveSepSet(), operator=(), operator=(), prepareFCI_(), and setFCIExhaustiveSepSet().
|
protected |
the extended greedy hill climbing
Definition at line 1284 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), learnDag_(), operator=(), and operator=().
|
protected |
the filename database
Definition at line 1308 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), operator=(), and operator=().
|
protected |
the greedy hill climbing algorithm
Definition at line 1281 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), disableEpsilon(), disableMaxIter(), disableMaxTime(), disableMinEpsilonRate(), enableEpsilon(), enableMaxIter(), enableMaxTime(), enableMinEpsilonRate(), learnDag_(), operator=(), operator=(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), and setVerbosity().
|
protected |
the greedy thick-thinning algorithm
Definition at line 1287 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), greedyThickThinningReversals(), learnDag_(), operator=(), operator=(), and setGreedyThickThinningReversals().
|
protected |
owned independence test object for FCI (rebuilt before each learn call)
Definition at line 1269 of file IBNLearner.h.
Referenced by ~IBNLearner(), and prepareFCI_().
|
protected |
owned independence test object for PC (rebuilt before each learn call)
Definition at line 1253 of file IBNLearner.h.
Referenced by ~IBNLearner(), and preparePC_().
|
protected |
independence test type for FCI (reuses IndepTestType defined above)
Definition at line 1266 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), prepareFCI_(), useFCIChi2Test(), and useFCIG2Test().
|
protected |
Definition at line 1250 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), preparePC_(), useChi2Test(), and useG2Test().
|
protected |
the policy for typing variables
Definition at line 1164 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), IBNLearner(), and IBNLearner().
|
protected |
an initial DAG given to learners
Definition at line 1305 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), initialDAG(), learnDag_(), operator=(), operator=(), and setInitialDAG().
|
protected |
the penalty used in MIIC
Definition at line 1242 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), correctedMutualInformation(), createCorrectedMutualInformation_(), operator=(), operator=(), useMDLCorrection(), useNMLCorrection(), and useNoCorrection().
|
protected |
the local search with tabu list algorithm
Definition at line 1290 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), disableEpsilon(), disableMaxIter(), disableMaxTime(), disableMinEpsilonRate(), enableEpsilon(), enableMaxIter(), enableMaxTime(), enableMinEpsilonRate(), learnDag_(), operator=(), operator=(), setEpsilon(), setMaxIter(), setMaxTime(), setMinEpsilonRate(), setPeriodSize(), setVerbosity(), and useLocalSearchWithTabuList().
Definition at line 1259 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), preparePC_(), and setPCMaxCondSetSize().
Definition at line 1274 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), prepareFCI_(), and setFCIMaxPathLength().
|
protected |
the selected correction for miic
Definition at line 1179 of file IBNLearner.h.
Referenced by ~IBNLearner(), createCorrectedMutualInformation_(), learnDag_(), learnPDAG_(), operator=(), and operator=().
|
protected |
Definition at line 1314 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), and useLocalSearchWithTabuList().
|
protected |
Definition at line 1187 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), ~IBNLearner(), createCorrectedMutualInformation_(), createParamEstimator_(), prepareFCI_(), preparePC_(), and useDatabaseRanges().
Progression, error and time.
Definition at line 81 of file IApproximationSchemeConfiguration.h.
Referenced by gum::ApproximationScheme::continueApproximationScheme(), gum::learning::IBNLearner::distributeProgress(), gum::learning::Miic::initiation_(), gum::learning::Miic::iteration_(), and gum::learning::Miic::orientationMiic_().
|
inherited |
Criteria messageApproximationScheme.
Definition at line 84 of file IApproximationSchemeConfiguration.h.
Referenced by gum::learning::IBNLearner::distributeStop().
|
protected |
the type of the parameter estimator
Definition at line 1173 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), createParamEstimator_(), operator=(), and operator=().
|
protected |
the prior used
Definition at line 1185 of file IBNLearner.h.
Referenced by ~IBNLearner(), chi2(), correctedMutualInformation(), createParamEstimator_(), createScore_(), G2(), logLikelihood(), operator=(), operator=(), and rawPseudoCount().
|
protected |
the database used by the Dirichlet a priori
Definition at line 1299 of file IBNLearner.h.
Referenced by ~IBNLearner(), learnDag_(), operator=(), and operator=().
|
protected |
the filename for the Dirichlet a priori, if any
Definition at line 1302 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), and useDirichletPrior().
|
protected |
the a priorselected for the score and parameters
Definition at line 1182 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), getPriorType_(), learnDag_(), operator=(), operator=(), useBDeuPrior(), useDirichletPrior(), useNoPrior(), and useSmoothingPrior().
|
protected |
the weight of the prior. It is always written by the useXxxPrior() methods, which read learning.priorWeight when no weight is given.
Definition at line 1191 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), _setPriorWeight_(), checkScorePriorCompatibility(), operator=(), and operator=().
|
protected |
the set of rows' ranges within the database in which learning is done
Definition at line 1296 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), clearDatabaseRanges(), createCorrectedMutualInformation_(), createParamEstimator_(), createScore_(), databaseRanges(), operator=(), operator=(), prepareFCI_(), preparePC_(), useCrossValidationFold(), and useDatabaseRanges().
|
protected |
the score used
Definition at line 1170 of file IBNLearner.h.
Referenced by ~IBNLearner(), createParamEstimator_(), createScore_(), learnDag_(), operator=(), operator=(), score(), and setNumberOfThreads().
|
protected |
the database to be used by the scores and parameter estimators
Definition at line 1293 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), IBNLearner(), chi2(), correctedMutualInformation(), createCorrectedMutualInformation_(), createParamEstimator_(), createScore_(), database(), databaseWeight(), domainSize(), domainSize(), domainSizes(), G2(), hasMissingValues(), idFromName(), learnDAG(), learnDag_(), learnPAG(), learnPAG_(), learnPDAG(), learnPDAG_(), logLikelihood(), mutualInformation(), nameFromId(), names(), nbCols(), nbRows(), operator=(), operator=(), prepareFCI_(), prepareMiic_(), preparePC_(), rawPseudoCount(), recordWeight(), setDatabaseWeight(), setRecordWeight(), useCrossValidationFold(), and useDatabaseRanges().
|
protected |
the score selected for learning
Definition at line 1167 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), checkScorePriorCompatibility(), createScore_(), operator=(), operator=(), useScoreAIC(), useScoreBD(), useScoreBDeu(), useScoreBIC(), useScorefNML(), useScoreK2(), useScoreLog2Likelihood(), and useScoreMDL().
|
protected |
the learning algorithm ; it is initialized from the configuration, see preferredAlgo()
Definition at line 1221 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), fciExhaustiveSepSet(), isConstraintBased(), learnDag_(), learnPAG_(), learnPDAG_(), operator=(), operator=(), setFCIAlpha(), setFCIExhaustiveSepSet(), setFCIMaxPathLength(), setPCAlpha(), setPCMaxCondSetSize(), setPCStable(), setPCUnshieldedColliderSorted(), useChi2Test(), useExtendedGreedyHillClimbing(), useFCI(), useFCIChi2Test(), useFCIG2Test(), useG2Test(), useGreedyHillClimbing(), useGreedyThickThinning(), useK2(), useK2(), useLocalSearchWithTabuList(), useMIIC(), and usePC().
|
protected |
Definition at line 1260 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), preparePC_(), and setPCUnshieldedColliderSorted().
|
protected |
Definition at line 1258 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), preparePC_(), and setPCStable().
|
protected |
Definition at line 1313 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), operator=(), operator=(), and useLocalSearchWithTabuList().
|
protected |
a Boolean indicating whether we should use EM for parameter learning or not
Definition at line 1176 of file IBNLearner.h.
Referenced by IBNLearner(), IBNLearner(), EM(), EMState(), EMStateMessage(), forbidEM(), isUsingEM(), operator=(), operator=(), useEM(), and useEMWithDiffCriterion().